npm / npm/rfcs

[RRFC] Parallel script execution when value is set to an array of text.

Open
#610 1 comment 5 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
777
Forks
267
PR merge metrics
No merged PRs in 30d

Description

Currently a script can not be set to array. Add this to your package.json,

  "scripts": {
    "foo": [
      "echo bar",
      "echo baz"
    ]
  },

Now if you try to run it,

npm run-script foo

You'll get

npm ERR! Missing script: "foo"
npm ERR! 
npm ERR! To see a list of scripts, run:
npm ERR!   npm run

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/ecarroll/.npm/_logs/2022-07-02T19_32_38_351Z-debug-0.log

The obvious intent here is to run two scripts where neither one is concerned with the status of another. This RFC would define the behavior of script with a member set to an array to,

  1. Run both scripts without regard for return codes of other scripts defined,
  2. Run both scripts in parallel.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The RFC names package.json and npm run-script as the entry points; begin by tracing how scripts are read and invoked. Define and verify array-valued scripts so both commands run in parallel without one return code stopping the other, then check the behavior with npm run-script foo.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
cli
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.