Skip to content

Commit 3ddedd7

Browse files
uidev1116claude
andcommitted
fix(package): exclude node_modules/.git/.DS_Store from the built zip (sync skeleton)
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 807a708 commit 3ddedd7

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

‎scripts/Packager.php‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,13 @@ final class Packager
2929
*/
3030
private const IGNORES = ['composer.json', 'composer.lock'];
3131

32+
/**
33+
* Names never copied into the package, at any depth: dev-only dirs / VCS / OS cruft. Without
34+
* this a plugin that keeps a build project under src/ (e.g. a Webpack theme) would ship its
35+
* whole node_modules — tens of MB of dependencies that have no place in the deployed plugin.
36+
*/
37+
private const EXCLUDE_NAMES = ['node_modules', '.git', '.DS_Store'];
38+
3239
/**
3340
* Default root-level files/dirs bundled alongside src/ when present. Override per plugin via
3441
* composer.json `extra.acms-plugin-tools.extras` (e.g. ["docs"]). `images/` is the plugin thumbnail
@@ -332,6 +339,9 @@ private function zipTree(string $stageDir, string $name, string $zipPath): void
332339

333340
private function copyTree(string $from, string $to): void
334341
{
342+
if (in_array(basename($from), self::EXCLUDE_NAMES, true)) {
343+
return;
344+
}
335345
if (is_dir($from)) {
336346
$this->ensureDir($to);
337347
foreach (scandir($from) ?: [] as $item) {

0 commit comments

Comments
 (0)