From ca9303ec771d1e88a8507db964852170862e1dd0 Mon Sep 17 00:00:00 2001 From: Matthew Herman Date: Wed, 4 Mar 2026 16:24:28 -0600 Subject: [PATCH 1/2] Try fixing the mbTest lockfile again --- tasks/dist.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tasks/dist.js b/tasks/dist.js index 9a0f8b01..8b737344 100644 --- a/tasks/dist.js +++ b/tasks/dist.js @@ -33,10 +33,20 @@ async function packageMountebank () { async function packageMbTest () { await distPackage('mbTest', 'test', pkg => { + /* + * 1. Update the lockfile to reflect the new dependency reference + * 2. Update root dependency reference to point to '../mountebank' instead of '..' + * 3. Update the package entry key for mountebank to match the new path '../mountebank' instead of '..' + * 4. Remove the old package entry for '..' since it's no longer valid + * 5. Update the package-lock.json file with the modified lockfile content + */ pkg.dependencies.mountebank = 'file:../mountebank'; + const lockfile = JSON.parse(fs.readFileSync('dist/test/package-lock.json')); + lockfile.packages[''].dependencies.mountebank = 'file:../mountebank'; lockfile.packages['../mountebank'] = lockfile.packages['..']; delete lockfile.packages['..']; + fs.writeFileSync('dist/test/package-lock.json', JSON.stringify(lockfile, null, 2)); }); } From 065d9004ad5983ea4a88654bf5bbe2ecf4b670d3 Mon Sep 17 00:00:00 2001 From: Matthew Herman Date: Wed, 4 Mar 2026 16:50:29 -0600 Subject: [PATCH 2/2] Fix dist.js to remove references in the lockfile during deploy --- tasks/dist.js | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/tasks/dist.js b/tasks/dist.js index 8b737344..0871d5c7 100644 --- a/tasks/dist.js +++ b/tasks/dist.js @@ -34,18 +34,32 @@ async function packageMountebank () { async function packageMbTest () { await distPackage('mbTest', 'test', pkg => { /* - * 1. Update the lockfile to reflect the new dependency reference - * 2. Update root dependency reference to point to '../mountebank' instead of '..' - * 3. Update the package entry key for mountebank to match the new path '../mountebank' instead of '..' - * 4. Remove the old package entry for '..' since it's no longer valid - * 5. Update the package-lock.json file with the modified lockfile content + * Update the mountebank dependency path from 'file:..' to 'file:../mountebank' + * In v3 lockfile format: + * 1. Update root package's dependency reference + * 2. Rename the mountebank package entry from '..' to '../mountebank' + * 3. Remove ALL other '../*' entries (these are parent's node_modules that shouldn't be here) */ pkg.dependencies.mountebank = 'file:../mountebank'; const lockfile = JSON.parse(fs.readFileSync('dist/test/package-lock.json')); + + // Update the root package's dependency reference lockfile.packages[''].dependencies.mountebank = 'file:../mountebank'; - lockfile.packages['../mountebank'] = lockfile.packages['..']; - delete lockfile.packages['..']; + + // Save the mountebank package entry before we delete it + const mountebankPackage = lockfile.packages['..']; + + // Remove all package entries that start with '../' (including '..' and '../node_modules/*') + // These are from the parent directory and shouldn't be in the test package lockfile + Object.keys(lockfile.packages).forEach(key => { + if (key.startsWith('../')) { + delete lockfile.packages[key]; + } + }); + + // Re-add only the mountebank package entry with the corrected path + lockfile.packages['../mountebank'] = mountebankPackage; fs.writeFileSync('dist/test/package-lock.json', JSON.stringify(lockfile, null, 2)); });