Skip to content

Commit 72e6d6f

Browse files
committed
fix: generate workspace support for docs pages
1 parent 450e50f commit 72e6d6f

28 files changed

+69
-58
lines changed

docs/lib/content/commands/npm-adduser.md

-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ description: Add a registry user account
88

99
<!-- AUTOGENERATED USAGE DESCRIPTIONS -->
1010

11-
Note: This command is unaware of workspaces.
12-
1311
### Description
1412

1513
Create a new user in the specified registry, and save the credentials to

docs/lib/content/commands/npm-cache.md

-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ description: Manipulates packages cache
88

99
<!-- AUTOGENERATED USAGE DESCRIPTIONS -->
1010

11-
Note: This command is unaware of workspaces.
12-
1311
### Description
1412

1513
Used to add, list, or clean the npm cache folder.

docs/lib/content/commands/npm-completion.md

-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ description: Tab Completion for npm
88

99
<!-- AUTOGENERATED USAGE DESCRIPTIONS -->
1010

11-
Note: This command is unaware of workspaces.
12-
1311
### Description
1412

1513
Enables tab-completion in all npm commands.

docs/lib/content/commands/npm-config.md

-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ description: Manage the npm configuration files
88

99
<!-- AUTOGENERATED USAGE DESCRIPTIONS -->
1010

11-
Note: This command is unaware of workspaces.
12-
1311
### Description
1412

1513
npm gets its config settings from the command line, environment

docs/lib/content/commands/npm-deprecate.md

-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ description: Deprecate a version of a package
88

99
<!-- AUTOGENERATED USAGE DESCRIPTIONS -->
1010

11-
Note: This command is unaware of workspaces.
12-
1311
### Description
1412

1513
This command will update the npm registry entry for a package, providing a

docs/lib/content/commands/npm-doctor.md

-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ description: Check your npm environment
88

99
<!-- AUTOGENERATED USAGE DESCRIPTIONS -->
1010

11-
Note: This command is unaware of workspaces.
12-
1311
### Description
1412

1513
`npm doctor` runs a set of checks to ensure that your npm installation has

docs/lib/content/commands/npm-edit.md

-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ description: Edit an installed package
88

99
<!-- AUTOGENERATED USAGE DESCRIPTIONS -->
1010

11-
Note: This command is unaware of workspaces.
12-
1311
### Description
1412

1513
Selects a dependency in the current project and opens the package folder in

docs/lib/content/commands/npm-explore.md

-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ description: Browse an installed package
88

99
<!-- AUTOGENERATED USAGE DESCRIPTIONS -->
1010

11-
Note: This command is unaware of workspaces.
12-
1311
### Description
1412

1513
Spawn a subshell in the directory of the installed package specified.

docs/lib/content/commands/npm-help-search.md

-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ description: Search npm help documentation
88

99
<!-- AUTOGENERATED USAGE DESCRIPTIONS -->
1010

11-
Note: This command is unaware of workspaces.
12-
1311
### Description
1412

1513
This command will search the npm markdown documentation files for the terms

docs/lib/content/commands/npm-help.md

-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ description: Get help on npm
88

99
<!-- AUTOGENERATED USAGE DESCRIPTIONS -->
1010

11-
Note: This command is unaware of workspaces.
12-
1311
### Description
1412

1513
If supplied a topic, then show the appropriate documentation page.

docs/lib/content/commands/npm-hook.md

-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ description: Manage registry hooks
88

99
<!-- AUTOGENERATED USAGE DESCRIPTIONS -->
1010

11-
Note: This command is unaware of workspaces.
12-
1311
### Description
1412

1513
Allows you to manage [npm

docs/lib/content/commands/npm-login.md

-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ description: Login to a registry user account
88

99
<!-- AUTOGENERATED USAGE DESCRIPTIONS -->
1010

11-
Note: This command is unaware of workspaces.
12-
1311
### Description
1412

1513
Verify a user in the specified registry, and save the credentials to the

docs/lib/content/commands/npm-logout.md

-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ description: Log out of the registry
88

99
<!-- AUTOGENERATED USAGE DESCRIPTIONS -->
1010

11-
Note: This command is unaware of workspaces.
12-
1311
### Description
1412

1513
When logged into a registry that supports token-based authentication, tell

docs/lib/content/commands/npm-org.md

-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ description: Manage orgs
88

99
<!-- AUTOGENERATED USAGE DESCRIPTIONS -->
1010

11-
Note: This command is unaware of workspaces.
12-
1311
### Example
1412

1513
Add a new developer to an org:

docs/lib/content/commands/npm-owner.md

-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ description: Manage package owners
88

99
<!-- AUTOGENERATED USAGE DESCRIPTIONS -->
1010

11-
Note: This command is unaware of workspaces.
12-
1311
### Description
1412

1513
Manage ownership of published packages.

docs/lib/content/commands/npm-ping.md

-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ description: Ping npm registry
88

99
<!-- AUTOGENERATED USAGE DESCRIPTIONS -->
1010

11-
Note: This command is unaware of workspaces.
12-
1311
### Description
1412

1513
Ping the configured or given npm registry and verify authentication.

docs/lib/content/commands/npm-prefix.md

-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ description: Display prefix
88

99
<!-- AUTOGENERATED USAGE DESCRIPTIONS -->
1010

11-
Note: This command is unaware of workspaces.
12-
1311
### Description
1412

1513
Print the local prefix to standard output. This is the closest parent directory

docs/lib/content/commands/npm-profile.md

-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ description: Change settings on your registry profile
88

99
<!-- AUTOGENERATED USAGE DESCRIPTIONS -->
1010

11-
Note: This command is unaware of workspaces.
12-
1311
### Description
1412

1513
Change your profile information on the registry. Note that this command

docs/lib/content/commands/npm-search.md

-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ description: Search for packages
88

99
<!-- AUTOGENERATED USAGE DESCRIPTIONS -->
1010

11-
Note: This command is unaware of workspaces.
12-
1311
### Description
1412

1513
Search the registry for packages matching the search terms. `npm search`

docs/lib/content/commands/npm-shrinkwrap.md

-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ description: Lock down dependency versions for publication
88

99
<!-- AUTOGENERATED USAGE DESCRIPTIONS -->
1010

11-
Note: This command is unaware of workspaces.
12-
1311
### Description
1412

1513
This command repurposes `package-lock.json` into a publishable

docs/lib/content/commands/npm-star.md

-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ description: Mark your favorite packages
88

99
<!-- AUTOGENERATED USAGE DESCRIPTIONS -->
1010

11-
Note: This command is unaware of workspaces.
12-
1311
### Description
1412

1513
"Starring" a package means that you have some interest in it. It's

docs/lib/content/commands/npm-stars.md

-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ description: View packages marked as favorites
88

99
<!-- AUTOGENERATED USAGE DESCRIPTIONS -->
1010

11-
Note: This command is unaware of workspaces.
12-
1311
### Description
1412

1513
If you have starred a lot of neat things and want to find them again

docs/lib/content/commands/npm-team.md

-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ description: Manage organization teams and team memberships
88

99
<!-- AUTOGENERATED USAGE DESCRIPTIONS -->
1010

11-
Note: This command is unaware of workspaces.
12-
1311
### Description
1412

1513
Used to manage teams in organizations, and change team memberships. Does not

docs/lib/content/commands/npm-token.md

-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ description: Manage your authentication tokens
88

99
<!-- AUTOGENERATED USAGE DESCRIPTIONS -->
1010

11-
Note: This command is unaware of workspaces.
12-
1311
### Description
1412

1513
This lets you list, create and revoke authentication tokens.

docs/lib/content/commands/npm-unstar.md

-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ description: Remove an item from your favorite packages
88

99
<!-- AUTOGENERATED USAGE DESCRIPTIONS -->
1010

11-
Note: This command is unaware of workspaces.
12-
1311
### Description
1412

1513
"Unstarring" a package is the opposite of [`npm star`](/commands/npm-star),

docs/lib/content/commands/npm-whoami.md

-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ description: Display npm username
88

99
<!-- AUTOGENERATED USAGE DESCRIPTIONS -->
1010

11-
Note: This command is unaware of workspaces.
12-
1311
### Description
1412

1513
Display the npm username of the currently logged-in user.

docs/lib/index.js

+9-6
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,12 @@ const getCommandByDoc = (docFile, docExt) => {
4040
// `npx` is not technically a command in and of itself,
4141
// so it just needs the usage of npm exex
4242
const srcName = name === 'npx' ? 'exec' : name
43-
const { params, usage = [''] } = require(`../../lib/commands/${srcName}`)
43+
const { params, usage = [''], workspaces } = require(`../../lib/commands/${srcName}`)
4444
const usagePrefix = name === 'npx' ? 'npx' : `npm ${name}`
4545

4646
return {
4747
name,
48+
workspaces,
4849
params: name === 'npx' ? null : params,
4950
usage: usage.map(u => `${usagePrefix} ${u}`.trim()).join('\n'),
5051
}
@@ -54,7 +55,7 @@ const replaceVersion = (src) => src.replace(/@VERSION@/g, version)
5455

5556
const replaceUsage = (src, { path }) => {
5657
const replacer = assertPlaceholder(src, path, TAGS.USAGE)
57-
const { usage, name } = getCommandByDoc(path, DOC_EXT)
58+
const { usage, name, workspaces } = getCommandByDoc(path, DOC_EXT)
5859

5960
const synopsis = ['```bash', usage]
6061

@@ -66,15 +67,17 @@ const replaceUsage = (src, { path }) => {
6667
}, [])
6768

6869
if (cmdAliases.length === 1) {
69-
synopsis.push('')
70-
synopsis.push(`alias: ${cmdAliases[0]}`)
70+
synopsis.push('', `alias: ${cmdAliases[0]}`)
7171
} else if (cmdAliases.length > 1) {
72-
synopsis.push('')
73-
synopsis.push(`aliases: ${cmdAliases.join(', ')}`)
72+
synopsis.push('', `aliases: ${cmdAliases.join(', ')}`)
7473
}
7574

7675
synopsis.push('```')
7776

77+
if (!workspaces) {
78+
synopsis.push('', 'Note: This command is unaware of workspaces.')
79+
}
80+
7881
return src.replace(replacer, synopsis.join('\n'))
7982
}
8083

0 commit comments

Comments
 (0)