Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/archive.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = {}
15 changes: 15 additions & 0 deletions test/unit/archive.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => {
Expand Down