Skip to content

Commit 72e6d6f

Browse files
committedJan 1, 2023
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

‎tap-snapshots/test/lib/docs.js.test.cjs

+60
Original file line numberDiff line numberDiff line change
@@ -2491,6 +2491,8 @@ npm access grant <read-only|read-write> <scope:team> [<package>]
24912491
npm access revoke <scope:team> [<package>]
24922492
\`\`\`
24932493
2494+
Note: This command is unaware of workspaces.
2495+
24942496
#### \`json\`
24952497
#### \`otp\`
24962498
#### \`registry\`
@@ -2515,6 +2517,8 @@ npm adduser
25152517
alias: add-user
25162518
\`\`\`
25172519
2520+
Note: This command is unaware of workspaces.
2521+
25182522
#### \`registry\`
25192523
#### \`scope\`
25202524
#### \`auth-type\`
@@ -2603,6 +2607,8 @@ npm cache ls [<name>@<version>]
26032607
npm cache verify
26042608
\`\`\`
26052609
2610+
Note: This command is unaware of workspaces.
2611+
26062612
#### \`cache\`
26072613
`
26082614

@@ -2665,6 +2671,8 @@ Run "npm help completion" for more info
26652671
npm completion
26662672
\`\`\`
26672673
2674+
Note: This command is unaware of workspaces.
2675+
26682676
NO PARAMS
26692677
`
26702678

@@ -2698,6 +2706,8 @@ npm config fix
26982706
alias: c
26992707
\`\`\`
27002708
2709+
Note: This command is unaware of workspaces.
2710+
27012711
#### \`json\`
27022712
#### \`global\`
27032713
#### \`editor\`
@@ -2761,6 +2771,8 @@ Run "npm help deprecate" for more info
27612771
npm deprecate <package-spec> <message>
27622772
\`\`\`
27632773
2774+
Note: This command is unaware of workspaces.
2775+
27642776
#### \`registry\`
27652777
#### \`otp\`
27662778
`
@@ -2872,6 +2884,8 @@ Run "npm help doctor" for more info
28722884
npm doctor [ping] [registry] [versions] [environment] [permissions] [cache]
28732885
\`\`\`
28742886
2887+
Note: This command is unaware of workspaces.
2888+
28752889
#### \`registry\`
28762890
`
28772891

@@ -2890,6 +2904,8 @@ Run "npm help edit" for more info
28902904
npm edit <pkg>[/<subpkg>...]
28912905
\`\`\`
28922906
2907+
Note: This command is unaware of workspaces.
2908+
28932909
#### \`editor\`
28942910
`
28952911

@@ -2965,6 +2981,8 @@ Run "npm help explore" for more info
29652981
npm explore <pkg> [ -- <command>]
29662982
\`\`\`
29672983
2984+
Note: This command is unaware of workspaces.
2985+
29682986
#### \`shell\`
29692987
`
29702988

@@ -3040,6 +3058,8 @@ Run "npm help get" for more info
30403058
npm get [<key> ...] (See \`npm config\`)
30413059
\`\`\`
30423060
3061+
Note: This command is unaware of workspaces.
3062+
30433063
NO PARAMS
30443064
`
30453065

@@ -3062,6 +3082,8 @@ npm help <term> [<terms..>]
30623082
alias: hlep
30633083
\`\`\`
30643084
3085+
Note: This command is unaware of workspaces.
3086+
30653087
#### \`viewer\`
30663088
`
30673089

@@ -3080,6 +3102,8 @@ Run "npm help help-search" for more info
30803102
npm help-search <text>
30813103
\`\`\`
30823104
3105+
Note: This command is unaware of workspaces.
3106+
30833107
#### \`long\`
30843108
`
30853109

@@ -3104,6 +3128,8 @@ npm hook rm <id>
31043128
npm hook update <id> <url> <secret>
31053129
\`\`\`
31063130
3131+
Note: This command is unaware of workspaces.
3132+
31073133
#### \`registry\`
31083134
#### \`otp\`
31093135
`
@@ -3380,6 +3406,8 @@ Run "npm help login" for more info
33803406
npm login
33813407
\`\`\`
33823408
3409+
Note: This command is unaware of workspaces.
3410+
33833411
#### \`registry\`
33843412
#### \`scope\`
33853413
#### \`auth-type\`
@@ -3400,6 +3428,8 @@ Run "npm help logout" for more info
34003428
npm logout
34013429
\`\`\`
34023430
3431+
Note: This command is unaware of workspaces.
3432+
34033433
#### \`registry\`
34043434
#### \`scope\`
34053435
`
@@ -3448,6 +3478,8 @@ exports[`test/lib/docs.js TAP usage npm > must match snapshot 1`] = `
34483478
npm
34493479
\`\`\`
34503480
3481+
Note: This command is unaware of workspaces.
3482+
34513483
NO PARAMS
34523484
`
34533485

@@ -3485,6 +3517,8 @@ npm org ls orgname [<username>]
34853517
alias: ogr
34863518
\`\`\`
34873519
3520+
Note: This command is unaware of workspaces.
3521+
34883522
#### \`registry\`
34893523
#### \`otp\`
34903524
#### \`json\`
@@ -3586,6 +3620,8 @@ Run "npm help ping" for more info
35863620
npm ping
35873621
\`\`\`
35883622
3623+
Note: This command is unaware of workspaces.
3624+
35893625
#### \`registry\`
35903626
`
35913627

@@ -3635,6 +3671,8 @@ Run "npm help prefix" for more info
36353671
npm prefix [-g]
36363672
\`\`\`
36373673
3674+
Note: This command is unaware of workspaces.
3675+
36383676
#### \`global\`
36393677
`
36403678

@@ -3659,6 +3697,8 @@ npm profile get [<key>]
36593697
npm profile set <key> <value>
36603698
\`\`\`
36613699
3700+
Note: This command is unaware of workspaces.
3701+
36623702
#### \`registry\`
36633703
#### \`json\`
36643704
#### \`parseable\`
@@ -3832,6 +3872,8 @@ Run "npm help root" for more info
38323872
npm root
38333873
\`\`\`
38343874
3875+
Note: This command is unaware of workspaces.
3876+
38353877
#### \`global\`
38363878
`
38373879

@@ -3886,6 +3928,8 @@ npm search [search terms ...]
38863928
aliases: find, s, se
38873929
\`\`\`
38883930
3931+
Note: This command is unaware of workspaces.
3932+
38893933
#### \`long\`
38903934
#### \`json\`
38913935
#### \`color\`
@@ -3911,6 +3955,8 @@ Run "npm help set" for more info
39113955
npm set <key>=<value> [<key>=<value> ...] (See \`npm config\`)
39123956
\`\`\`
39133957
3958+
Note: This command is unaware of workspaces.
3959+
39143960
NO PARAMS
39153961
`
39163962

@@ -3926,6 +3972,8 @@ Run "npm help shrinkwrap" for more info
39263972
npm shrinkwrap
39273973
\`\`\`
39283974
3975+
Note: This command is unaware of workspaces.
3976+
39293977
NO PARAMS
39303978
`
39313979

@@ -3944,6 +3992,8 @@ Run "npm help star" for more info
39443992
npm star [<package-spec>...]
39453993
\`\`\`
39463994
3995+
Note: This command is unaware of workspaces.
3996+
39473997
#### \`registry\`
39483998
#### \`unicode\`
39493999
#### \`otp\`
@@ -3964,6 +4014,8 @@ Run "npm help stars" for more info
39644014
npm stars [<user>]
39654015
\`\`\`
39664016
4017+
Note: This command is unaware of workspaces.
4018+
39674019
#### \`registry\`
39684020
`
39694021

@@ -4028,6 +4080,8 @@ npm team rm <scope:team> <user> [--otp <otpcode>]
40284080
npm team ls <scope>|<scope:team>
40294081
\`\`\`
40304082
4083+
Note: This command is unaware of workspaces.
4084+
40314085
#### \`registry\`
40324086
#### \`otp\`
40334087
#### \`parseable\`
@@ -4077,6 +4131,8 @@ npm token revoke <id|token>
40774131
npm token create [--read-only] [--cidr=list]
40784132
\`\`\`
40794133
4134+
Note: This command is unaware of workspaces.
4135+
40804136
#### \`read-only\`
40814137
#### \`cidr\`
40824138
#### \`registry\`
@@ -4149,6 +4205,8 @@ Run "npm help unstar" for more info
41494205
npm unstar [<package-spec>...]
41504206
\`\`\`
41514207
4208+
Note: This command is unaware of workspaces.
4209+
41524210
#### \`registry\`
41534211
#### \`unicode\`
41544212
#### \`otp\`
@@ -4274,5 +4332,7 @@ Run "npm help whoami" for more info
42744332
npm whoami
42754333
\`\`\`
42764334
4335+
Note: This command is unaware of workspaces.
4336+
42774337
#### \`registry\`
42784338
`

0 commit comments

Comments
 (0)
Please sign in to comment.