Skip to content

Commit

Permalink
fix(run-script): don't cascade if-present config (#4678)
Browse files Browse the repository at this point in the history
Do not pass the `if-present` env config value to spawned processes.

Fixes: #3352
Close: #3589
  • Loading branch information
ruyadorno authored Apr 5, 2022
1 parent f37f7d2 commit 840c338
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 0 deletions.
2 changes: 2 additions & 0 deletions docs/content/commands/npm-run-script.md
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,8 @@ it's present and fail if the script fails. This is useful, for example, when
running scripts that may only apply for some builds in an otherwise generic
CI setup.

This value is not exported to the environment for child processes.

<!-- automatically generated, do not edit manually -->
<!-- see lib/utils/config/definitions.js -->

Expand Down
2 changes: 2 additions & 0 deletions docs/content/using-npm/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -762,6 +762,8 @@ it's present and fail if the script fails. This is useful, for example, when
running scripts that may only apply for some builds in an otherwise generic
CI setup.

This value is not exported to the environment for child processes.

<!-- automatically generated, do not edit manually -->
<!-- see lib/utils/config/definitions.js -->

Expand Down
1 change: 1 addition & 0 deletions lib/utils/config/definitions.js
Original file line number Diff line number Diff line change
Expand Up @@ -880,6 +880,7 @@ define('https-proxy', {
define('if-present', {
default: false,
type: Boolean,
envExport: false,
description: `
If true, npm will not exit with an error code when \`run-script\` is
invoked for a script that isn't defined in the \`scripts\` section of
Expand Down
2 changes: 2 additions & 0 deletions tap-snapshots/test/lib/utils/config/definitions.js.test.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -795,6 +795,8 @@ This option can be used when it's desirable to optionally run a script when
it's present and fail if the script fails. This is useful, for example, when
running scripts that may only apply for some builds in an otherwise generic
CI setup.
This value is not exported to the environment for child processes.
`

exports[`test/lib/utils/config/definitions.js TAP > config description for ignore-scripts 1`] = `
Expand Down
2 changes: 2 additions & 0 deletions tap-snapshots/test/lib/utils/config/describe-all.js.test.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -636,6 +636,8 @@ it's present and fail if the script fails. This is useful, for example, when
running scripts that may only apply for some builds in an otherwise generic
CI setup.
This value is not exported to the environment for child processes.
<!-- automatically generated, do not edit manually -->
<!-- see lib/utils/config/definitions.js -->
Expand Down

0 comments on commit 840c338

Please sign in to comment.