Skip to content

Commit 840c338

Browse files
authored
fix(run-script): don't cascade if-present config (#4678)
Do not pass the `if-present` env config value to spawned processes. Fixes: #3352 Close: #3589
1 parent f37f7d2 commit 840c338

File tree

5 files changed

+9
-0
lines changed

5 files changed

+9
-0
lines changed

docs/content/commands/npm-run-script.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,8 @@ it's present and fail if the script fails. This is useful, for example, when
220220
running scripts that may only apply for some builds in an otherwise generic
221221
CI setup.
222222

223+
This value is not exported to the environment for child processes.
224+
223225
<!-- automatically generated, do not edit manually -->
224226
<!-- see lib/utils/config/definitions.js -->
225227

docs/content/using-npm/config.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -762,6 +762,8 @@ it's present and fail if the script fails. This is useful, for example, when
762762
running scripts that may only apply for some builds in an otherwise generic
763763
CI setup.
764764

765+
This value is not exported to the environment for child processes.
766+
765767
<!-- automatically generated, do not edit manually -->
766768
<!-- see lib/utils/config/definitions.js -->
767769

lib/utils/config/definitions.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -880,6 +880,7 @@ define('https-proxy', {
880880
define('if-present', {
881881
default: false,
882882
type: Boolean,
883+
envExport: false,
883884
description: `
884885
If true, npm will not exit with an error code when \`run-script\` is
885886
invoked for a script that isn't defined in the \`scripts\` section of

tap-snapshots/test/lib/utils/config/definitions.js.test.cjs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -795,6 +795,8 @@ This option can be used when it's desirable to optionally run a script when
795795
it's present and fail if the script fails. This is useful, for example, when
796796
running scripts that may only apply for some builds in an otherwise generic
797797
CI setup.
798+
799+
This value is not exported to the environment for child processes.
798800
`
799801

800802
exports[`test/lib/utils/config/definitions.js TAP > config description for ignore-scripts 1`] = `

tap-snapshots/test/lib/utils/config/describe-all.js.test.cjs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -636,6 +636,8 @@ it's present and fail if the script fails. This is useful, for example, when
636636
running scripts that may only apply for some builds in an otherwise generic
637637
CI setup.
638638
639+
This value is not exported to the environment for child processes.
640+
639641
<!-- automatically generated, do not edit manually -->
640642
<!-- see lib/utils/config/definitions.js -->
641643

0 commit comments

Comments
 (0)