fix: run bundled deps postinstall for global npm

This commit is contained in:
Peter Steinberger
2026-04-01 08:37:52 +01:00
parent cfa307baed
commit 31ed09bc96
2 changed files with 50 additions and 1 deletions

View File

@@ -97,13 +97,24 @@ export function discoverBundledPluginRuntimeDeps(params = {}) {
export function createNestedNpmInstallEnv(env = process.env) {
const nextEnv = { ...env };
delete nextEnv.npm_config_global;
delete nextEnv.npm_config_location;
delete nextEnv.npm_config_prefix;
return nextEnv;
}
function isGlobalNpmInstall(env) {
if (env.npm_config_global === "true") {
return true;
}
if (typeof env.npm_config_location === "string") {
return env.npm_config_location.toLowerCase() === "global";
}
return false;
}
export function runBundledPluginPostinstall(params = {}) {
const env = params.env ?? process.env;
if (env.npm_config_global !== "true") {
if (!isGlobalNpmInstall(env)) {
return;
}
const extensionsDir = params.extensionsDir ?? DEFAULT_EXTENSIONS_DIR;