Skip to content

Commit 072d9af

Browse files
committed
feat: migrate from NPM_CONFIG_PRODUCTION to NPM_CONFIG_OMIT
Replace the deprecated NPM_CONFIG_PRODUCTION environment variable with NPM_CONFIG_OMIT=dev,optional for exact parity with previous behavior. Changes: - Remove --omit=dev flag from npm prune command - Set NPM_CONFIG_OMIT=dev,optional in prune step instead of NPM_CONFIG_PRODUCTION=true - This approach uses environment variables as recommended The new approach: - Omits devDependencies (via "dev") - Omits optionalDependencies (via "optional") - Maintains NODE_ENV=production for lifecycle scripts This provides exact behavioral parity with the old NPM_CONFIG_PRODUCTION=true approach while using the modern npm configuration method.
1 parent efa24e7 commit 072d9af

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

core/providers/node/node.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ func (p *NodeProvider) shouldPrune(ctx *generate.GenerateContext) bool {
243243

244244
func (p *NodeProvider) PruneNodeDeps(ctx *generate.GenerateContext, prune *generate.CommandStepBuilder) {
245245
ctx.Logger.LogInfo("Pruning node dependencies")
246-
prune.Variables["NPM_CONFIG_PRODUCTION"] = "true"
246+
prune.Variables["NPM_CONFIG_OMIT"] = "dev,optional"
247247
prune.Secrets = []string{}
248248
p.packageManager.PruneDeps(ctx, prune)
249249
}

core/providers/node/package_manager.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ func (p PackageManager) PruneDeps(ctx *generate.GenerateContext, prune *generate
145145

146146
switch p {
147147
case PackageManagerNpm:
148-
prune.AddCommand(plan.NewExecCommand("npm prune --omit=dev --ignore-scripts"))
148+
prune.AddCommand(plan.NewExecCommand("npm prune --ignore-scripts"))
149149
case PackageManagerPnpm:
150150
p.prunePnpm(ctx, prune)
151151
case PackageManagerBun:

0 commit comments

Comments
 (0)