From f6a209b84368219705d60d5e420038dc5cbb8ffc Mon Sep 17 00:00:00 2001 From: Chris Portscheller Date: Mon, 20 Jul 2026 17:42:23 -0500 Subject: [PATCH] fix(build): exclude root dev vendor/ (and other dev dirs) from the plugin zip MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A local 'composer install' at the repo root creates vendor/ with dev tools (phpstan.phar ~23MB, php_codesniffer, WP/Woo stubs). build.sh's rsync copied it into the plugin ZIP, bloating it from ~250KB to ~8MB and shipping dev dependencies (a WordPress.org rejection). Anchor the excludes to the plugin root so only the top-level vendor/ is dropped — admin/js/vendor/ (bundled Chart.js) is preserved. Also exclude .git/.github/node_modules/tests/composer + lint configs. --- build.sh | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/build.sh b/build.sh index aca5667..0a1200a 100755 --- a/build.sh +++ b/build.sh @@ -46,7 +46,17 @@ mkdir -p "${DIST_DIR}" # Copy plugin files into build directory echo "Copying plugin files..." -rsync -a --exclude='build' --exclude='dist' --exclude='build.sh' . "${BUILD_DIR}/${PLUGIN_SLUG}/" +# Excludes are anchored with a leading slash to the plugin root so we only drop +# the top-level dev vendor/ (composer dev tools) — NOT admin/js/vendor/, which +# holds the bundled Chart.js. +rsync -a \ + --exclude='/build' --exclude='/dist' --exclude='/build.sh' \ + --exclude='/.git' --exclude='/.github' --exclude='/.svn-wporg' \ + --exclude='/vendor' --exclude='/sdk/vendor' \ + --exclude='node_modules' --exclude='/tests' \ + --exclude='/composer.json' --exclude='/composer.lock' \ + --exclude='/phpcs.xml.dist' --exclude='/phpstan.neon' \ + . "${BUILD_DIR}/${PLUGIN_SLUG}/" # Update version in main plugin file echo "Setting version to ${VERSION}..."