npm / npm/rfcs

[RRFC] `npm run build:*`

Open
#168 8 comments 4 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

What / Why

package.json:

{
    "build:project": "",
    "build:static": "",
    "build:markdown": "",
    "build:docs": "",
    "build:export": "",
    "build": "npm run build:project && npm run build:static && npm run build:markdown && npm run build:docs && npm run something"
}

Idea is to avoid manual typing. In the example build:export not a part of build and something
script not exists. Or deletes everything - also possible. Any human mistake on routine.

In addition, such feature will require good naming and placement in script names for easier lifecycle handling. I.e. build:clear should be first, build:export last and build:clear should delete only build stuff, not launch server and make a commit.

When

On npm run

Where

npm run, bash

How

Current Behavior

npm ERR! missing script: build:*

Expected Behavior

Run consistently && all scripts from package.json without any sort that starts with given substring

Approximately:

const pattern: string = runScript
pattern.length--
const scripts2run = Object.keys(packageJson.scripts)
.filter(scr => scr.startsWith(pattern))
.forEach(scr => child_process(`npm run ${scr}`))

Who

  • n/a

References

https://github.com/npm/cli/issues/1440

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

Start by reviewing npm run and the package.json scripts shown in the issue, then read the referenced npm/cli issue #1440. The work is complete when the behavior and script-ordering rules are agreed and documented sufficiently for implementation.

Written by the indexing model from the issue text.

Assessment

Tech stack
bash, javascript
Domain
cli, tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.