Skip to content

Commit

Permalink
fix(docs): add workspaces configuration
Browse files Browse the repository at this point in the history
Adds workspaces configuration to `docs`, `repo`, and `set-script`.

PR-URL: #3013
Credit: @wraithgar
Close: #3013
Reviewed-by: @darcyclarke
  • Loading branch information
wraithgar committed Apr 1, 2021
1 parent 4c42523 commit 9237d37
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 3 deletions.
13 changes: 13 additions & 0 deletions docs/content/commands/npm-docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,19 @@ Set to `true` to use default system URL opener.
The base URL of the npm package registry.
#### workspaces
Enables workspaces context while searching the `package.json` in the
current folder. Documentation urls for the packages named in each
workspace will be opened.
#### workspace
Enables workspaces context and limits results to only those specified by
this config item. Only the documentation urls for the packages named in
the workspaces given here will be opened.
### See Also
* [npm view](/commands/npm-view)
Expand Down
13 changes: 13 additions & 0 deletions docs/content/commands/npm-repo.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,19 @@ terminal.
Set to `true` to use default system URL opener.
#### workspaces
Enables workspaces context while searching the `package.json` in the
current folder. Repo urls for the packages named in each workspace will
be opened.
#### workspace
Enables workspaces context and limits results to only those specified by
this config item. Only the repo urls for the packages named in the
workspaces given here will be opened.
### See Also
* [npm docs](/commands/npm-docs)
Expand Down
15 changes: 14 additions & 1 deletion docs/content/commands/npm-set-script.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ description: Set tasks in the scripts section of package.json
---

### Synopsis
An npm command that lets you create a task in the scripts section of the package.json.
An npm command that lets you create a task in the `scripts` section of the `package.json`.

```bash
npm set-script [<script>] [<command>]
Expand All @@ -26,6 +26,19 @@ npm set-script [<script>] [<command>]
}
```

### Configuration

#### workspaces

Enables workspaces context. Tasks will be created in the `scripts` section
of the `package.json` of each workspace.

#### workspace

Enables workspaces context and limits creating a task to the
`package.json` files of the workspaces given.


### See Also

* [npm run-script](/commands/npm-run-script)
Expand Down
2 changes: 1 addition & 1 deletion lib/docs.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class Docs extends BaseCommand {

/* istanbul ignore next - see test/lib/load-all-commands.js */
static get params () {
return ['browser', 'workspace', 'workspaces']
return ['browser', 'registry', 'workspace', 'workspaces']
}

/* istanbul ignore next - see test/lib/load-all-commands.js */
Expand Down
2 changes: 1 addition & 1 deletion tap-snapshots/test-lib-utils-npm-usage.js-TAP.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ All commands:
npm docs [<pkgname> [<pkgname> ...]]
Options:
[--browser|--browser <browser>] [-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]] [-ws|--workspaces]
[--browser|--browser <browser>] [--registry <registry>] [-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]] [-ws|--workspaces]
alias: home
Expand Down

0 comments on commit 9237d37

Please sign in to comment.