Skip to content

Commit

Permalink
chore: standardize npm script names per #14827 (#16315)
Browse files Browse the repository at this point in the history
* chore: standardize npm script names per #14827

* put lint:fix right after lint

* chore: fix ordering of :fix

Co-authored-by: Milos Djermanovic <milos.djermanovic@gmail.com>

* chore: change release scripts to have "release:" prefix

Co-authored-by: Milos Djermanovic <milos.djermanovic@gmail.com>

* docs: update package.json naming to include 'release'

* docs: add css so abnf code formats okay

* chore: exclude linting from npm test

* docs: remove counter-reset. I guess that was a merge error

Co-authored-by: Milos Djermanovic <milos.djermanovic@gmail.com>
  • Loading branch information
pmcelhaney and mdjermanovic committed Dec 14, 2022
1 parent 6a8cd94 commit ba74253
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 31 deletions.
1 change: 0 additions & 1 deletion Makefile.js
Expand Up @@ -632,7 +632,6 @@ target.karma = () => {
};

target.test = function() {
target.lint();
target.checkRuleFiles();
target.mocha();
target.karma();
Expand Down
30 changes: 14 additions & 16 deletions docs/src/developer-guide/package-json-conventions.md
Expand Up @@ -9,22 +9,16 @@ The following applies to the "scripts" section of `package.json` files.

npm script names MUST contain only lower case letters, `:` to separate parts, `-` to separate words, and `+` to separate file extensions. Each part name SHOULD be either a full English word (e.g. `coverage` not `cov`) or a well-known initialism in all lowercase (e.g. `wasm`).

Here is a summary of the proposal in EBNF.

```ebnf
name = life-cycle | main ":fix"? target? option* ":watch"?
life-cycle = prepare | preinstall | install | postinstall | prepublish | preprepare | prepare | postprepare | prepack | postpack | prepublishOnly;
main = "build" | "lint" | "start" | "test";
target = ":" word ("-" word)* | extension ("+" extension)*;
option = ":" word ("-" word)*;
word = [a-z]+;
extension = [a-z0-9]+;
Here is a summary of the proposal in ABNF.

```abnf
name = life-cycle / main target? option* ":watch"?
life-cycle = "prepare" / "preinstall" / "install" / "postinstall" / "prepublish" / "preprepare" / "prepare" / "postprepare" / "prepack" / "postpack" / "prepublishOnly"
main = "build" / "lint" ":fix"? / "release" / "start" / "test"
target = ":" word ("-" word)* / extension ("+" extension)*
option = ":" word ("-" word)*
word = ALPHA +
extension = ( ALPHA / DIGIT )+
```

## Order
Expand All @@ -41,6 +35,10 @@ Scripts that generate a set of files from source code and / or data MUST have na

If a package contains any `build:*` scripts, there MAY be a script named `build`. If so, SHOULD produce the same output as running each of the `build` scripts individually. It MUST produce a subset of the output from running those scripts.

### Release

Scripts that have public side effects (publishing the web site, committing to Git, etc.) MUST begin with `release`.

### Lint

Scripts that statically analyze files (mostly, but not limited to running `eslint` itself) MUST have names that begin with `lint`.
Expand Down
28 changes: 14 additions & 14 deletions package.json
Expand Up @@ -13,22 +13,22 @@
"./use-at-your-own-risk": "./lib/unsupported-api.js"
},
"scripts": {
"build:docs:update-links": "node tools/fetch-docs-links.js",
"release:generate:latest": "node Makefile.js generateRelease",
"release:generate:alpha": "node Makefile.js generatePrerelease -- alpha",
"release:generate:beta": "node Makefile.js generatePrerelease -- beta",
"release:publish": "node Makefile.js publishRelease",
"release:generate:rc": "node Makefile.js generatePrerelease -- rc",
"build:site": "node Makefile.js gensite",
"build:webpack": "node Makefile.js webpack",
"lint": "node Makefile.js lint",
"lint:fix": "node Makefile.js lint -- fix",
"lint:docs:js": "node Makefile.js lintDocsJS",
"lint:fix:docs:js": "node Makefile.js lintDocsJS -- fix",
"test": "node Makefile.js test",
"test:cli": "mocha",
"lint": "node Makefile.js lint",
"lint:docsjs": "node Makefile.js lintDocsJS",
"fix": "node Makefile.js lint -- fix",
"fix:docsjs": "node Makefile.js lintDocsJS -- fix",
"fuzz": "node Makefile.js fuzz",
"generate-release": "node Makefile.js generateRelease",
"generate-alpharelease": "node Makefile.js generatePrerelease -- alpha",
"generate-betarelease": "node Makefile.js generatePrerelease -- beta",
"generate-rcrelease": "node Makefile.js generatePrerelease -- rc",
"publish-release": "node Makefile.js publishRelease",
"gensite": "node Makefile.js gensite",
"webpack": "node Makefile.js webpack",
"perf": "node Makefile.js perf",
"docs:update-links": "node tools/fetch-docs-links.js"
"test:fuzz": "node Makefile.js fuzz",
"test:performance": "node Makefile.js perf"
},
"gitHooks": {
"pre-commit": "lint-staged"
Expand Down

0 comments on commit ba74253

Please sign in to comment.