Skip to content

Commit

Permalink
Add npm-run-all package to simplify running scripts (#37558)
Browse files Browse the repository at this point in the history
* Add npm-run-all package to simplify running scripts

The npm-run-all package allows for an easier way to run multiple scripts
from the package.json file. We are going to run a few scripts to
generate api docs, so instead of joining multiple commands using && it
can be simplified to creating a command for each and then running:

`npm-run-all api-docs:*`

Package docs:
https://www.npmjs.com/package/npm-run-all

* Update lint-staged (pre-commit hook) with api-docs

Use the npm-run-all in the lint-staged command that gets run by husky on
pre-commit hooks. This allows for checking if any block.json and core
blocks are modified that triggers an update to the reference doc.

* Update package.json

Co-authored-by: Greg Ziółkowski <[email protected]>

Co-authored-by: Greg Ziółkowski <[email protected]>
  • Loading branch information
mkaz and gziolo committed Dec 23, 2021
1 parent a15e9f1 commit fcc2a79
Show file tree
Hide file tree
Showing 2 changed files with 113 additions and 3 deletions.
106 changes: 106 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 7 additions & 3 deletions package.json
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@
"mkdirp": "0.5.1",
"nock": "12.0.3",
"node-watch": "0.7.0",
"npm-run-all": "4.1.5",
"patch-package": "6.2.2",
"postcss": "8.2.15",
"postcss-loader": "6.1.1",
Expand Down Expand Up @@ -223,6 +224,8 @@
},
"scripts": {
"analyze-bundles": "npm run build -- --webpack-bundle-analyzer",
"api-docs:ref": "node ./bin/api-docs/update-api-docs.js",
"api-docs:blocks": "node ./bin/api-docs/gen-block-lib-list.js",
"clean:packages": "rimraf \"./packages/*/@(build|build-module|build-style)\"",
"clean:package-types": "tsc --build --clean",
"prebuild:packages": "npm run clean:packages && lerna run build",
Expand All @@ -237,7 +240,8 @@
"dev": "npm run build:packages && concurrently \"wp-scripts start\" \"npm run dev:packages\"",
"dev:packages": "node ./bin/packages/watch.js",
"distclean": "rimraf node_modules packages/*/node_modules",
"docs:build": "node ./docs/tool/index.js && node ./bin/api-docs/update-api-docs.js && node ./bin/api-docs/gen-block-lib-list.js",
"docs:gen": "node ./docs/tool/index.js",
"docs:build": "npm-run-all docs:gen api-docs:*",
"fixtures:clean": "rimraf \"test/integration/fixtures/blocks/*.+(json|serialized.html)\"",
"fixtures:generate": "cross-env GENERATE_MISSING_FIXTURES=y npm run test-unit test/integration/full-content/ && npm run format test/integration/fixtures/blocks/*.json",
"fixtures:regenerate": "npm run fixtures:clean && npm run fixtures:generate",
Expand Down Expand Up @@ -305,8 +309,8 @@
"{docs/{toc.json,tool/*.js},packages/{*/README.md,components/src/*/**/README.md}}": [
"node ./docs/tool/index.js"
],
"packages/**/*.{js,ts,tsx}": [
"node ./bin/api-docs/update-api-docs.js",
"packages/**/*.{js,ts,tsx,json}": [
"npm-run-all api-docs:*",
"node ./bin/api-docs/are-api-docs-unstaged.js",
"node ./bin/packages/lint-staged-typecheck.js"
]
Expand Down

0 comments on commit fcc2a79

Please sign in to comment.