diff --git a/lib/archive.js b/lib/archive.js index 4d2e7647e..fc36e93bd 100644 --- a/lib/archive.js +++ b/lib/archive.js @@ -18,7 +18,7 @@ const addModulesToArchive = async (archive, withoutAssets) => { return Promise.all(modules.map(module => addModuleToArchive(module, archive, withoutAssets))); }; -const addModuleToArchive = async (module, archive, withoutAssets, pattern = '**/{private,public}/**') => { +const addModuleToArchive = async (module, archive, withoutAssets, pattern = '{public,private}/**') => { const files = await glob(pattern, { cwd: path.join(dir.MODULES, module), onlyFiles: true diff --git a/test/fixtures/deploy/correct/modules/testModule/generators/crud.js b/test/fixtures/deploy/correct/modules/testModule/generators/crud.js new file mode 100644 index 000000000..4ba52ba2c --- /dev/null +++ b/test/fixtures/deploy/correct/modules/testModule/generators/crud.js @@ -0,0 +1 @@ +module.exports = {} diff --git a/test/unit/archive.test.js b/test/unit/archive.test.js index 87e5ca89c..eee5ae4a2 100644 --- a/test/unit/archive.test.js +++ b/test/unit/archive.test.js @@ -172,6 +172,21 @@ describe('Archive utilities', () => { const entries = await listZipEntries(zipPath); expect(entries.some(e => e.includes('/assets/'))).toBe(false); }); + + test('only includes module files under public/ or private/, not sibling directories', async () => { + // fixture has testModule/generators/crud.js and testModule/react-app/node_modules/.../page.png + // alongside testModule/public/ — neither should appear in the archive + process.chdir(path.join(fixturesPath, 'correct')); + const { makeArchive } = await import('#lib/archive.js'); + const zipPath = path.join(tmpDir, 'release.zip'); + + await makeArchive({ TARGET: zipPath }, { withoutAssets: false }); + + const entries = await listZipEntries(zipPath); + expect(entries.some(e => e.includes('generators'))).toBe(false); + expect(entries.some(e => e.includes('node_modules'))).toBe(false); + expect(entries.some(e => e.includes('hello-test-module.liquid'))).toBe(true); + }); }); describe('packAssets', () => {