From e13425416ae43e8c539cafc0158b3f4ce0262161 Mon Sep 17 00:00:00 2001 From: NullVoxPopuli <199018+NullVoxPopuli@users.noreply.github.com> Date: Wed, 15 Jan 2025 16:34:55 -0500 Subject: [PATCH] No way --- scripts/test-package-manager.mjs | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/scripts/test-package-manager.mjs b/scripts/test-package-manager.mjs index 13e5dcce8a..4149002516 100644 --- a/scripts/test-package-manager.mjs +++ b/scripts/test-package-manager.mjs @@ -262,9 +262,33 @@ async function runNoThrow(cwd, cmd) { async function install(packageManager, cwd) { // All package managers have an install command switch (packageManager) { - case 'npm': + case 'npm': { + let manifestContent = readFileSync(join(cwd, 'package.json')); + let manifest = JSON.parse(manifestContent); + let toInstall = []; + for (let [name, filePath] of Object.entries(manifest.devDependencies)) { + if (filePath.startsWith('file:')) { + toInstall.push(filePath.replace('file:', '')); + manifest.devDependencies[name] = '*'; + } + } + + writeFileSync(join(cwd, 'package.json'), JSON.stringify(manifest, null, 2)); + + console.log({ toInstall, manifest }); + + let command = `npm install --save-dev ${toInstall.join(' ')} --force`; + await $({ + preferLocal: true, + shell: true, + cwd, + stdio: 'inherit', + })(command); + // npm complains about tgz files in the version specifier part of package.json await $({ preferLocal: true, shell: true, cwd, stdio: 'inherit' })`${packageManager} install --force`; + return; + } default: await $({ preferLocal: true, shell: true, cwd, stdio: 'inherit' })`${packageManager} install`; }