Add -x / --node-run flag to bypass the package manager#225
Merged
Conversation
…ager
Adds opt-in support for running scripts via `node --run` rather than
npm/pnpm/yarn. This avoids the per-script startup overhead of the
package manager CLI, which is especially noticeable with run-p.
Supports a project-wide opt-in via package.json:
"npm-run-all2": { "nodeRun": true }
Intentional limitations inherited from node --run:
- No pre/post lifecycle hooks
- No npm_* environment variable injection
- No automatic PATH injection for local binaries
Closes #155
Corrects the documented limitations. node --run does prepend node_modules/.bin directories to PATH (traversing up to root), so that bullet was wrong. The actual omissions are only pre/post lifecycle hooks and npm_* env vars. Also note the NODE_RUN_SCRIPT_NAME and NODE_RUN_PACKAGE_JSON_PATH env vars that node --run does set.
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adds an opt-in -x/--node-run mode to execute scripts via node --run (bypassing npm/pnpm/yarn CLI overhead), with optional project-wide enablement via package.json config.
Changes:
- Add
-x/--node-runCLI flag parsing and support for combined short flags. - Implement a
node --runexecution path in task spawning, and thread the option through command entrypoints. - Document the new flag across
run-s,run-p, andnpm-run-all.
Reviewed changes
Copilot reviewed 5 out of 9 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| lib/run-task.js | Adds a node --run execution branch and routes spawning through common variables. |
| lib/index.js | Threads nodeRun option and adds package.json-based global opt-in. |
| bin/common/parse-cli-args.js | Parses -x/--node-run and allows x in concatenated short flags. |
| bin/run-s/main.js | Passes nodeRun through to the library entrypoint. |
| bin/run-p/main.js | Passes nodeRun through to the library entrypoint. |
| bin/npm-run-all/main.js | Passes nodeRun through to the library entrypoint for each group. |
| docs/run-s.md | Documents -x/--node-run behavior and config opt-in. |
| docs/run-p.md | Documents -x/--node-run behavior and config opt-in. |
| docs/npm-run-all.md | Documents -x/--node-run behavior and config opt-in. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- run-task.js: use first -- as the separator rather than filtering all -- tokens, so scripts that receive -- as an argument are not broken - lib/index.js: require pkgConfig.nodeRun === true instead of any truthy value, so 'nodeRun: "false"' does not accidentally enable it
Extracts the npm-run-all2 package.json config reading into a dedicated readPackageConfig() function with a PackageJsonConfig typedef, making it easy to add new config options in the future.
Covers sequential, parallel, and lifecycle hook suppression for the --node-run / -x flag via Node API, run-s, run-p, and npm-run-all. Adds pre/post lifecycle scripts to test-workspace to verify they are skipped when node --run is used.
Owner
Author
AnnAngela
added a commit
to MoegirlPediaInterfaceAdmins/MoegirlPediaInterfaceCodes
that referenced
this pull request
May 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds opt-in support for running scripts via
node --runinstead of npm/pnpm/yarn. The per-script startup cost of the package manager CLI adds up fast withrun-p— this flag lets you skip it entirely.-x/--node-runflag on all three commands (run-s,run-p,npm-run-all)package.json:"npm-run-all2": { "nodeRun": true }-lx)Intentional limitations (inherited from
node --run)pre/postlifecycle hooksnpm_*environment variable injection (NODE_RUN_SCRIPT_NAMEandNODE_RUN_PACKAGE_JSON_PATHare set instead)node_modules/.binis still added to PATH (traverses up to root)Because of these limitations the flag is strictly opt-in and never the default.
Changes
bin/common/parse-cli-args.jsnodeRunfield,-x/--node-runcases, extendedCONCAT_OPTIONSregexlib/run-task.jsnode --run <script> [-- args]lib/index.jsnodeRunoption; readspackage.jsonconfig opt-in (requirestrueboolean)bin/run-{s,p}/main.js,bin/npm-run-all/main.jsnodeRunthrough torunAll()docs/run-s.md,docs/run-p.md,docs/npm-run-all.mdCloses #155