From eda9162f2db19b512d3af6b0d43201d54045c13a Mon Sep 17 00:00:00 2001 From: Matsuuu Date: Fri, 3 Sep 2021 09:01:08 +0300 Subject: [PATCH] docs: Add --if-present flag documentation to workspaces PR-URL: https://github.com/npm/cli/pull/3715 Credit: @Matsuuu Close: #3715 Reviewed-by: @wraithgar --- docs/content/using-npm/workspaces.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/docs/content/using-npm/workspaces.md b/docs/content/using-npm/workspaces.md index 7cc125b3c7a7c..ae834c0cc7e22 100644 --- a/docs/content/using-npm/workspaces.md +++ b/docs/content/using-npm/workspaces.md @@ -176,6 +176,16 @@ npm run test --workspaces Will run the `test` script in both `./packages/a` and `./packages/b`. +### Ignoring missing scripts + +It is not required for all of the workspaces to implement scripts run with the `npm run` command. + +By running the command with the `--if-present` flag, npm will ignore workspaces missing target script. + +``` +npm run test --workspaces --if-present +``` + ### See also * [npm install](/commands/npm-install)