Skip to content

Commit

Permalink
docs: auto-generate npm usage for each command (#4450)
Browse files Browse the repository at this point in the history
Closes #4189

* docs: auto-generate synopsis sections
* feat: improve usage auto-generation'
* chore: auto-generate npm usage for each command
* docs: print default usage when usage is missing
* docs: add special case for npx
* fix: remove optional chaining
  • Loading branch information
manekinekko authored Feb 24, 2022
1 parent d438d61 commit 6b68c1a
Show file tree
Hide file tree
Showing 65 changed files with 821 additions and 164 deletions.
12 changes: 9 additions & 3 deletions docs/content/commands/npm-access.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,27 @@ description: Set access level on published packages

### Synopsis

<!-- AUTOGENERATED USAGE DESCRIPTIONS START -->
<!-- automatically generated, do not edit manually -->
<!-- see lib/commands/access.js -->

```bash
npm access public [<package>]
npm access restricted [<package>]

npm access grant <read-only|read-write> <scope:team> [<package>]
npm access revoke <scope:team> [<package>]

npm access 2fa-required [<package>]
npm access 2fa-not-required [<package>]

npm access ls-packages [<user>|<scope>|<scope:team>]
npm access ls-collaborators [<package> [<user>]]
npm access edit [<package>]
```
<!-- automatically generated, do not edit manually -->
<!-- see lib/commands/access.js -->
<!-- AUTOGENERATED USAGE DESCRIPTIONS END -->
### Description
Used to set access controls on private packages.
Expand Down
11 changes: 10 additions & 1 deletion docs/content/commands/npm-adduser.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,21 @@ description: Add a registry user account

### Synopsis

<!-- AUTOGENERATED USAGE DESCRIPTIONS START -->
<!-- automatically generated, do not edit manually -->
<!-- see lib/commands/adduser.js -->

```bash
npm adduser [--registry=url] [--scope=@orgname] [--auth-type=legacy]
npm adduser

aliases: login, add-user
```

<!-- automatically generated, do not edit manually -->
<!-- see lib/commands/adduser.js -->

<!-- AUTOGENERATED USAGE DESCRIPTIONS END -->

Note: This command is unaware of workspaces.

### Description
Expand Down
14 changes: 10 additions & 4 deletions docs/content/commands/npm-audit.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,19 @@ description: Run a security audit

### Synopsis

```bash
npm audit [--json] [--production] [--audit-level=(low|moderate|high|critical)]
npm audit fix [--force|--package-lock-only|--dry-run|--production|--only=(dev|prod)]
<!-- AUTOGENERATED USAGE DESCRIPTIONS START -->
<!-- automatically generated, do not edit manually -->
<!-- see lib/commands/audit.js -->

common options: [--production] [--only=(dev|prod)]
```bash
npm audit [fix]
```

<!-- automatically generated, do not edit manually -->
<!-- see lib/commands/audit.js -->

<!-- AUTOGENERATED USAGE DESCRIPTIONS END -->

### Description

The audit command submits a description of the dependencies configured in
Expand Down
11 changes: 10 additions & 1 deletion docs/content/commands/npm-bin.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,19 @@ description: Display npm bin folder

### Synopsis

<!-- AUTOGENERATED USAGE DESCRIPTIONS START -->
<!-- automatically generated, do not edit manually -->
<!-- see lib/commands/bin.js -->

```bash
npm bin [-g|--global]
npm bin
```

<!-- automatically generated, do not edit manually -->
<!-- see lib/commands/bin.js -->

<!-- AUTOGENERATED USAGE DESCRIPTIONS END -->

Note: This command is unaware of workspaces.

### Description
Expand Down
13 changes: 11 additions & 2 deletions docs/content/commands/npm-bugs.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,21 @@ description: Report bugs for a package in a web browser

### Synopsis

<!-- AUTOGENERATED USAGE DESCRIPTIONS START -->
<!-- automatically generated, do not edit manually -->
<!-- see lib/commands/bugs.js -->

```bash
npm bugs [<pkgname> [<pkgname> ...]]
npm bugs [<pkgname>]

aliases: issues
alias: issues
```

<!-- automatically generated, do not edit manually -->
<!-- see lib/commands/bugs.js -->

<!-- AUTOGENERATED USAGE DESCRIPTIONS END -->

### Description

This command tries to guess at the likely location of a package's bug
Expand Down
24 changes: 16 additions & 8 deletions docs/content/commands/npm-cache.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,26 @@ description: Manipulates packages cache

### Synopsis

```bash
npm cache add <tarball file>...
npm cache add <folder>...
npm cache add <tarball url>...
npm cache add <name>@<version>...

npm cache clean
aliases: npm cache clear, npm cache rm
<!-- AUTOGENERATED USAGE DESCRIPTIONS START -->
<!-- automatically generated, do not edit manually -->
<!-- see lib/commands/cache.js -->

```bash
npm cache add <tarball file>
npm cache add <folder>
npm cache add <tarball url>
npm cache add <git url>
npm cache add <name>@<version>
npm cache clean [<key>]
npm cache ls [<name>@<version>]
npm cache verify
```

<!-- automatically generated, do not edit manually -->
<!-- see lib/commands/cache.js -->

<!-- AUTOGENERATED USAGE DESCRIPTIONS END -->

Note: This command is unaware of workspaces.

### Description
Expand Down
11 changes: 11 additions & 0 deletions docs/content/commands/npm-ci.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,21 @@ description: Install a project with a clean slate

### Synopsis

<!-- AUTOGENERATED USAGE DESCRIPTIONS START -->
<!-- automatically generated, do not edit manually -->
<!-- see lib/commands/ci.js -->

```bash
npm ci

aliases: clean-install, ic, install-clean, isntall-clean
```

<!-- automatically generated, do not edit manually -->
<!-- see lib/commands/ci.js -->

<!-- AUTOGENERATED USAGE DESCRIPTIONS END -->

### Description

This command is similar to [`npm install`](/commands/npm-install), except
Expand Down
11 changes: 10 additions & 1 deletion docs/content/commands/npm-completion.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,19 @@ description: Tab Completion for npm

### Synopsis

<!-- AUTOGENERATED USAGE DESCRIPTIONS START -->
<!-- automatically generated, do not edit manually -->
<!-- see lib/commands/completion.js -->

```bash
source <(npm completion)
npm completion
```

<!-- automatically generated, do not edit manually -->
<!-- see lib/commands/completion.js -->

<!-- AUTOGENERATED USAGE DESCRIPTIONS END -->

Note: This command is unaware of workspaces.

### Description
Expand Down
11 changes: 9 additions & 2 deletions docs/content/commands/npm-config.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,25 @@ description: Manage the npm configuration files

### Synopsis

<!-- AUTOGENERATED USAGE DESCRIPTIONS START -->
<!-- automatically generated, do not edit manually -->
<!-- see lib/commands/config.js -->

```bash
npm config set <key>=<value> [<key>=<value> ...]
npm config get [<key> [<key> ...]]
npm config delete <key> [<key> ...]
npm config list [--json]
npm config edit
npm set <key>=<value> [<key>=<value> ...]
npm get [<key> [<key> ...]]

alias: c
```
<!-- automatically generated, do not edit manually -->
<!-- see lib/commands/config.js -->
<!-- AUTOGENERATED USAGE DESCRIPTIONS END -->
Note: This command is unaware of workspaces.
### Description
Expand Down
30 changes: 28 additions & 2 deletions docs/content/commands/npm-dedupe.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,21 @@ description: Reduce duplication in the package tree

### Synopsis

<!-- AUTOGENERATED USAGE DESCRIPTIONS START -->
<!-- automatically generated, do not edit manually -->
<!-- see lib/commands/dedupe.js -->

```bash
npm dedupe
npm ddp

aliases: ddp
alias: ddp
```

<!-- automatically generated, do not edit manually -->
<!-- see lib/commands/dedupe.js -->

<!-- AUTOGENERATED USAGE DESCRIPTIONS END -->

### Description

Searches the local package tree and attempts to simplify the overall
Expand Down Expand Up @@ -145,6 +153,24 @@ When package package-locks are disabled, automatic pruning of extraneous
modules will also be disabled. To remove extraneous modules with
package-locks disabled use `npm prune`.
This configuration does not affect `npm ci`.
<!-- automatically generated, do not edit manually -->
<!-- see lib/utils/config/definitions.js -->
#### `save`
* Default: `true` unless when using `npm update` or `npm dedupe` where it
defaults to `false`
* Type: Boolean
Save installed packages to a `package.json` file as dependencies.
When used with the `npm rm` command, removes the dependency from
`package.json`.
Will also prevent writing to `package-lock.json` if set to `false`.
<!-- automatically generated, do not edit manually -->
<!-- see lib/utils/config/definitions.js -->
Expand Down
11 changes: 10 additions & 1 deletion docs/content/commands/npm-deprecate.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,19 @@ description: Deprecate a version of a package

### Synopsis

<!-- AUTOGENERATED USAGE DESCRIPTIONS START -->
<!-- automatically generated, do not edit manually -->
<!-- see lib/commands/deprecate.js -->

```bash
npm deprecate <pkg>[@<version range>] <message>
npm deprecate <pkg>[@<version>] <message>
```

<!-- automatically generated, do not edit manually -->
<!-- see lib/commands/deprecate.js -->

<!-- AUTOGENERATED USAGE DESCRIPTIONS END -->

Note: This command is unaware of workspaces.

### Description
Expand Down
13 changes: 9 additions & 4 deletions docs/content/commands/npm-diff.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,19 @@ description: The registry diff command

### Synopsis

<!-- AUTOGENERATED USAGE DESCRIPTIONS START -->
<!-- automatically generated, do not edit manually -->
<!-- see lib/commands/diff.js -->

```bash
npm diff [...<paths>]
npm diff --diff=<pkg-name> [...<paths>]
npm diff --diff=<version-a> [--diff=<version-b>] [...<paths>]
npm diff --diff=<spec-a> [--diff=<spec-b>] [...<paths>]
npm diff [--diff-ignore-all-space] [--diff-name-only] [...<paths>]
```

<!-- automatically generated, do not edit manually -->
<!-- see lib/commands/diff.js -->

<!-- AUTOGENERATED USAGE DESCRIPTIONS END -->

### Description

Similar to its `git diff` counterpart, this command will print diff patches
Expand Down
11 changes: 10 additions & 1 deletion docs/content/commands/npm-dist-tag.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,23 @@ description: Modify package distribution tags

### Synopsis

<!-- AUTOGENERATED USAGE DESCRIPTIONS START -->
<!-- automatically generated, do not edit manually -->
<!-- see lib/commands/dist-tag.js -->

```bash
npm dist-tag add <pkg>@<version> [<tag>]
npm dist-tag rm <pkg> <tag>
npm dist-tag ls [<pkg>]

aliases: dist-tags
alias: dist-tags
```

<!-- automatically generated, do not edit manually -->
<!-- see lib/commands/dist-tag.js -->

<!-- AUTOGENERATED USAGE DESCRIPTIONS END -->

### Description

Add, remove, and enumerate distribution tags on a package:
Expand Down
11 changes: 10 additions & 1 deletion docs/content/commands/npm-docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,21 @@ description: Open documentation for a package in a web browser

### Synopsis

<!-- AUTOGENERATED USAGE DESCRIPTIONS START -->
<!-- automatically generated, do not edit manually -->
<!-- see lib/commands/docs.js -->

```bash
npm docs [<pkgname> [<pkgname> ...]]

aliases: home
alias: home
```
<!-- automatically generated, do not edit manually -->
<!-- see lib/commands/docs.js -->
<!-- AUTOGENERATED USAGE DESCRIPTIONS END -->
### Description
This command tries to guess at the likely location of a package's
Expand Down
9 changes: 9 additions & 0 deletions docs/content/commands/npm-doctor.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,19 @@ description: Check your npm environment

### Synopsis

<!-- AUTOGENERATED USAGE DESCRIPTIONS START -->
<!-- automatically generated, do not edit manually -->
<!-- see lib/commands/doctor.js -->

```bash
npm doctor
```

<!-- automatically generated, do not edit manually -->
<!-- see lib/commands/doctor.js -->

<!-- AUTOGENERATED USAGE DESCRIPTIONS END -->

Note: This command is unaware of workspaces.

### Description
Expand Down
Loading

0 comments on commit 6b68c1a

Please sign in to comment.