diff --git a/docs/lib/content/commands/npm-adduser.md b/docs/lib/content/commands/npm-adduser.md index fa957cba47d02..061c020ecb28b 100644 --- a/docs/lib/content/commands/npm-adduser.md +++ b/docs/lib/content/commands/npm-adduser.md @@ -8,8 +8,6 @@ description: Add a registry user account -Note: This command is unaware of workspaces. - ### Description Create a new user in the specified registry, and save the credentials to diff --git a/docs/lib/content/commands/npm-cache.md b/docs/lib/content/commands/npm-cache.md index 2aedc546b64a7..20836b512a12f 100644 --- a/docs/lib/content/commands/npm-cache.md +++ b/docs/lib/content/commands/npm-cache.md @@ -8,8 +8,6 @@ description: Manipulates packages cache -Note: This command is unaware of workspaces. - ### Description Used to add, list, or clean the npm cache folder. diff --git a/docs/lib/content/commands/npm-completion.md b/docs/lib/content/commands/npm-completion.md index 3a5bae3bc9a3a..dcc25997fa585 100644 --- a/docs/lib/content/commands/npm-completion.md +++ b/docs/lib/content/commands/npm-completion.md @@ -8,8 +8,6 @@ description: Tab Completion for npm -Note: This command is unaware of workspaces. - ### Description Enables tab-completion in all npm commands. diff --git a/docs/lib/content/commands/npm-config.md b/docs/lib/content/commands/npm-config.md index 5267d49960fe7..1874aee418d00 100644 --- a/docs/lib/content/commands/npm-config.md +++ b/docs/lib/content/commands/npm-config.md @@ -8,8 +8,6 @@ description: Manage the npm configuration files -Note: This command is unaware of workspaces. - ### Description npm gets its config settings from the command line, environment diff --git a/docs/lib/content/commands/npm-deprecate.md b/docs/lib/content/commands/npm-deprecate.md index 3cf02acb7f05a..dbe785f05588c 100644 --- a/docs/lib/content/commands/npm-deprecate.md +++ b/docs/lib/content/commands/npm-deprecate.md @@ -8,8 +8,6 @@ description: Deprecate a version of a package -Note: This command is unaware of workspaces. - ### Description This command will update the npm registry entry for a package, providing a diff --git a/docs/lib/content/commands/npm-doctor.md b/docs/lib/content/commands/npm-doctor.md index 5682f20b4cb5b..a015521fc1b3e 100644 --- a/docs/lib/content/commands/npm-doctor.md +++ b/docs/lib/content/commands/npm-doctor.md @@ -8,8 +8,6 @@ description: Check your npm environment -Note: This command is unaware of workspaces. - ### Description `npm doctor` runs a set of checks to ensure that your npm installation has diff --git a/docs/lib/content/commands/npm-edit.md b/docs/lib/content/commands/npm-edit.md index 6de2b6e8542e1..e00c4a345dc17 100644 --- a/docs/lib/content/commands/npm-edit.md +++ b/docs/lib/content/commands/npm-edit.md @@ -8,8 +8,6 @@ description: Edit an installed package -Note: This command is unaware of workspaces. - ### Description Selects a dependency in the current project and opens the package folder in diff --git a/docs/lib/content/commands/npm-explore.md b/docs/lib/content/commands/npm-explore.md index 7557d9ae74adb..c277e4bec7bd6 100644 --- a/docs/lib/content/commands/npm-explore.md +++ b/docs/lib/content/commands/npm-explore.md @@ -8,8 +8,6 @@ description: Browse an installed package -Note: This command is unaware of workspaces. - ### Description Spawn a subshell in the directory of the installed package specified. diff --git a/docs/lib/content/commands/npm-help-search.md b/docs/lib/content/commands/npm-help-search.md index fb37036364f49..e419f03fdd438 100644 --- a/docs/lib/content/commands/npm-help-search.md +++ b/docs/lib/content/commands/npm-help-search.md @@ -8,8 +8,6 @@ description: Search npm help documentation -Note: This command is unaware of workspaces. - ### Description This command will search the npm markdown documentation files for the terms diff --git a/docs/lib/content/commands/npm-help.md b/docs/lib/content/commands/npm-help.md index 717092cb92788..cefb917991113 100644 --- a/docs/lib/content/commands/npm-help.md +++ b/docs/lib/content/commands/npm-help.md @@ -8,8 +8,6 @@ description: Get help on npm -Note: This command is unaware of workspaces. - ### Description If supplied a topic, then show the appropriate documentation page. diff --git a/docs/lib/content/commands/npm-hook.md b/docs/lib/content/commands/npm-hook.md index 75e7fcc44dbcd..c1394e1baad80 100644 --- a/docs/lib/content/commands/npm-hook.md +++ b/docs/lib/content/commands/npm-hook.md @@ -8,8 +8,6 @@ description: Manage registry hooks -Note: This command is unaware of workspaces. - ### Description Allows you to manage [npm diff --git a/docs/lib/content/commands/npm-login.md b/docs/lib/content/commands/npm-login.md index f1dd29dfbe1c5..a3f416e5042e9 100644 --- a/docs/lib/content/commands/npm-login.md +++ b/docs/lib/content/commands/npm-login.md @@ -8,8 +8,6 @@ description: Login to a registry user account -Note: This command is unaware of workspaces. - ### Description Verify a user in the specified registry, and save the credentials to the diff --git a/docs/lib/content/commands/npm-logout.md b/docs/lib/content/commands/npm-logout.md index df58af14289af..61f0219a19e11 100644 --- a/docs/lib/content/commands/npm-logout.md +++ b/docs/lib/content/commands/npm-logout.md @@ -8,8 +8,6 @@ description: Log out of the registry -Note: This command is unaware of workspaces. - ### Description When logged into a registry that supports token-based authentication, tell diff --git a/docs/lib/content/commands/npm-org.md b/docs/lib/content/commands/npm-org.md index ca4d887de3cbd..cc12bf9573a84 100644 --- a/docs/lib/content/commands/npm-org.md +++ b/docs/lib/content/commands/npm-org.md @@ -8,8 +8,6 @@ description: Manage orgs -Note: This command is unaware of workspaces. - ### Example Add a new developer to an org: diff --git a/docs/lib/content/commands/npm-owner.md b/docs/lib/content/commands/npm-owner.md index c35b369ab2da3..a4c5762358111 100644 --- a/docs/lib/content/commands/npm-owner.md +++ b/docs/lib/content/commands/npm-owner.md @@ -8,8 +8,6 @@ description: Manage package owners -Note: This command is unaware of workspaces. - ### Description Manage ownership of published packages. diff --git a/docs/lib/content/commands/npm-ping.md b/docs/lib/content/commands/npm-ping.md index 2bf16b2bc8114..76de695cfde3e 100644 --- a/docs/lib/content/commands/npm-ping.md +++ b/docs/lib/content/commands/npm-ping.md @@ -8,8 +8,6 @@ description: Ping npm registry -Note: This command is unaware of workspaces. - ### Description Ping the configured or given npm registry and verify authentication. diff --git a/docs/lib/content/commands/npm-prefix.md b/docs/lib/content/commands/npm-prefix.md index 3da516f52a0dc..6268e253552bf 100644 --- a/docs/lib/content/commands/npm-prefix.md +++ b/docs/lib/content/commands/npm-prefix.md @@ -8,8 +8,6 @@ description: Display prefix -Note: This command is unaware of workspaces. - ### Description Print the local prefix to standard output. This is the closest parent directory diff --git a/docs/lib/content/commands/npm-profile.md b/docs/lib/content/commands/npm-profile.md index 36eb3fb5f0ff9..0c93cef0d60da 100644 --- a/docs/lib/content/commands/npm-profile.md +++ b/docs/lib/content/commands/npm-profile.md @@ -8,8 +8,6 @@ description: Change settings on your registry profile -Note: This command is unaware of workspaces. - ### Description Change your profile information on the registry. Note that this command diff --git a/docs/lib/content/commands/npm-search.md b/docs/lib/content/commands/npm-search.md index 7cf2cf4ae2554..52b66e93a6a0e 100644 --- a/docs/lib/content/commands/npm-search.md +++ b/docs/lib/content/commands/npm-search.md @@ -8,8 +8,6 @@ description: Search for packages -Note: This command is unaware of workspaces. - ### Description Search the registry for packages matching the search terms. `npm search` diff --git a/docs/lib/content/commands/npm-shrinkwrap.md b/docs/lib/content/commands/npm-shrinkwrap.md index 0a4f22074e54e..8717a63f3fb16 100644 --- a/docs/lib/content/commands/npm-shrinkwrap.md +++ b/docs/lib/content/commands/npm-shrinkwrap.md @@ -8,8 +8,6 @@ description: Lock down dependency versions for publication -Note: This command is unaware of workspaces. - ### Description This command repurposes `package-lock.json` into a publishable diff --git a/docs/lib/content/commands/npm-star.md b/docs/lib/content/commands/npm-star.md index 1e7bbce212a02..01d3a49d7e91f 100644 --- a/docs/lib/content/commands/npm-star.md +++ b/docs/lib/content/commands/npm-star.md @@ -8,8 +8,6 @@ description: Mark your favorite packages -Note: This command is unaware of workspaces. - ### Description "Starring" a package means that you have some interest in it. It's diff --git a/docs/lib/content/commands/npm-stars.md b/docs/lib/content/commands/npm-stars.md index c1d33596bf318..68f50815186b1 100644 --- a/docs/lib/content/commands/npm-stars.md +++ b/docs/lib/content/commands/npm-stars.md @@ -8,8 +8,6 @@ description: View packages marked as favorites -Note: This command is unaware of workspaces. - ### Description If you have starred a lot of neat things and want to find them again diff --git a/docs/lib/content/commands/npm-team.md b/docs/lib/content/commands/npm-team.md index f82e8cf30142c..2672b466f75a1 100644 --- a/docs/lib/content/commands/npm-team.md +++ b/docs/lib/content/commands/npm-team.md @@ -8,8 +8,6 @@ description: Manage organization teams and team memberships -Note: This command is unaware of workspaces. - ### Description Used to manage teams in organizations, and change team memberships. Does not diff --git a/docs/lib/content/commands/npm-token.md b/docs/lib/content/commands/npm-token.md index 85b60105d7cc4..81624ba6952f8 100644 --- a/docs/lib/content/commands/npm-token.md +++ b/docs/lib/content/commands/npm-token.md @@ -8,8 +8,6 @@ description: Manage your authentication tokens -Note: This command is unaware of workspaces. - ### Description This lets you list, create and revoke authentication tokens. diff --git a/docs/lib/content/commands/npm-unstar.md b/docs/lib/content/commands/npm-unstar.md index 8891ece5a8892..aedeb92a6d71e 100644 --- a/docs/lib/content/commands/npm-unstar.md +++ b/docs/lib/content/commands/npm-unstar.md @@ -8,8 +8,6 @@ description: Remove an item from your favorite packages -Note: This command is unaware of workspaces. - ### Description "Unstarring" a package is the opposite of [`npm star`](/commands/npm-star), diff --git a/docs/lib/content/commands/npm-whoami.md b/docs/lib/content/commands/npm-whoami.md index 5dfae1781428b..99c787d62ef76 100644 --- a/docs/lib/content/commands/npm-whoami.md +++ b/docs/lib/content/commands/npm-whoami.md @@ -8,8 +8,6 @@ description: Display npm username -Note: This command is unaware of workspaces. - ### Description Display the npm username of the currently logged-in user. diff --git a/docs/lib/index.js b/docs/lib/index.js index 74aa03222f374..deb715b38107a 100644 --- a/docs/lib/index.js +++ b/docs/lib/index.js @@ -40,11 +40,12 @@ const getCommandByDoc = (docFile, docExt) => { // `npx` is not technically a command in and of itself, // so it just needs the usage of npm exex const srcName = name === 'npx' ? 'exec' : name - const { params, usage = [''] } = require(`../../lib/commands/${srcName}`) + const { params, usage = [''], workspaces } = require(`../../lib/commands/${srcName}`) const usagePrefix = name === 'npx' ? 'npx' : `npm ${name}` return { name, + workspaces, params: name === 'npx' ? null : params, usage: usage.map(u => `${usagePrefix} ${u}`.trim()).join('\n'), } @@ -54,7 +55,7 @@ const replaceVersion = (src) => src.replace(/@VERSION@/g, version) const replaceUsage = (src, { path }) => { const replacer = assertPlaceholder(src, path, TAGS.USAGE) - const { usage, name } = getCommandByDoc(path, DOC_EXT) + const { usage, name, workspaces } = getCommandByDoc(path, DOC_EXT) const synopsis = ['```bash', usage] @@ -66,15 +67,17 @@ const replaceUsage = (src, { path }) => { }, []) if (cmdAliases.length === 1) { - synopsis.push('') - synopsis.push(`alias: ${cmdAliases[0]}`) + synopsis.push('', `alias: ${cmdAliases[0]}`) } else if (cmdAliases.length > 1) { - synopsis.push('') - synopsis.push(`aliases: ${cmdAliases.join(', ')}`) + synopsis.push('', `aliases: ${cmdAliases.join(', ')}`) } synopsis.push('```') + if (!workspaces) { + synopsis.push('', 'Note: This command is unaware of workspaces.') + } + return src.replace(replacer, synopsis.join('\n')) } diff --git a/tap-snapshots/test/lib/docs.js.test.cjs b/tap-snapshots/test/lib/docs.js.test.cjs index d65e3d0745217..08d908688fdd7 100644 --- a/tap-snapshots/test/lib/docs.js.test.cjs +++ b/tap-snapshots/test/lib/docs.js.test.cjs @@ -2491,6 +2491,8 @@ npm access grant [] npm access revoke [] \`\`\` +Note: This command is unaware of workspaces. + #### \`json\` #### \`otp\` #### \`registry\` @@ -2515,6 +2517,8 @@ npm adduser alias: add-user \`\`\` +Note: This command is unaware of workspaces. + #### \`registry\` #### \`scope\` #### \`auth-type\` @@ -2603,6 +2607,8 @@ npm cache ls [@] npm cache verify \`\`\` +Note: This command is unaware of workspaces. + #### \`cache\` ` @@ -2665,6 +2671,8 @@ Run "npm help completion" for more info npm completion \`\`\` +Note: This command is unaware of workspaces. + NO PARAMS ` @@ -2698,6 +2706,8 @@ npm config fix alias: c \`\`\` +Note: This command is unaware of workspaces. + #### \`json\` #### \`global\` #### \`editor\` @@ -2761,6 +2771,8 @@ Run "npm help deprecate" for more info npm deprecate \`\`\` +Note: This command is unaware of workspaces. + #### \`registry\` #### \`otp\` ` @@ -2872,6 +2884,8 @@ Run "npm help doctor" for more info npm doctor [ping] [registry] [versions] [environment] [permissions] [cache] \`\`\` +Note: This command is unaware of workspaces. + #### \`registry\` ` @@ -2890,6 +2904,8 @@ Run "npm help edit" for more info npm edit [/...] \`\`\` +Note: This command is unaware of workspaces. + #### \`editor\` ` @@ -2965,6 +2981,8 @@ Run "npm help explore" for more info npm explore [ -- ] \`\`\` +Note: This command is unaware of workspaces. + #### \`shell\` ` @@ -3040,6 +3058,8 @@ Run "npm help get" for more info npm get [ ...] (See \`npm config\`) \`\`\` +Note: This command is unaware of workspaces. + NO PARAMS ` @@ -3062,6 +3082,8 @@ npm help [] alias: hlep \`\`\` +Note: This command is unaware of workspaces. + #### \`viewer\` ` @@ -3080,6 +3102,8 @@ Run "npm help help-search" for more info npm help-search \`\`\` +Note: This command is unaware of workspaces. + #### \`long\` ` @@ -3104,6 +3128,8 @@ npm hook rm npm hook update \`\`\` +Note: This command is unaware of workspaces. + #### \`registry\` #### \`otp\` ` @@ -3380,6 +3406,8 @@ Run "npm help login" for more info npm login \`\`\` +Note: This command is unaware of workspaces. + #### \`registry\` #### \`scope\` #### \`auth-type\` @@ -3400,6 +3428,8 @@ Run "npm help logout" for more info npm logout \`\`\` +Note: This command is unaware of workspaces. + #### \`registry\` #### \`scope\` ` @@ -3448,6 +3478,8 @@ exports[`test/lib/docs.js TAP usage npm > must match snapshot 1`] = ` npm \`\`\` +Note: This command is unaware of workspaces. + NO PARAMS ` @@ -3485,6 +3517,8 @@ npm org ls orgname [] alias: ogr \`\`\` +Note: This command is unaware of workspaces. + #### \`registry\` #### \`otp\` #### \`json\` @@ -3586,6 +3620,8 @@ Run "npm help ping" for more info npm ping \`\`\` +Note: This command is unaware of workspaces. + #### \`registry\` ` @@ -3635,6 +3671,8 @@ Run "npm help prefix" for more info npm prefix [-g] \`\`\` +Note: This command is unaware of workspaces. + #### \`global\` ` @@ -3659,6 +3697,8 @@ npm profile get [] npm profile set \`\`\` +Note: This command is unaware of workspaces. + #### \`registry\` #### \`json\` #### \`parseable\` @@ -3832,6 +3872,8 @@ Run "npm help root" for more info npm root \`\`\` +Note: This command is unaware of workspaces. + #### \`global\` ` @@ -3886,6 +3928,8 @@ npm search [search terms ...] aliases: find, s, se \`\`\` +Note: This command is unaware of workspaces. + #### \`long\` #### \`json\` #### \`color\` @@ -3911,6 +3955,8 @@ Run "npm help set" for more info npm set = [= ...] (See \`npm config\`) \`\`\` +Note: This command is unaware of workspaces. + NO PARAMS ` @@ -3926,6 +3972,8 @@ Run "npm help shrinkwrap" for more info npm shrinkwrap \`\`\` +Note: This command is unaware of workspaces. + NO PARAMS ` @@ -3944,6 +3992,8 @@ Run "npm help star" for more info npm star [...] \`\`\` +Note: This command is unaware of workspaces. + #### \`registry\` #### \`unicode\` #### \`otp\` @@ -3964,6 +4014,8 @@ Run "npm help stars" for more info npm stars [] \`\`\` +Note: This command is unaware of workspaces. + #### \`registry\` ` @@ -4028,6 +4080,8 @@ npm team rm [--otp ] npm team ls | \`\`\` +Note: This command is unaware of workspaces. + #### \`registry\` #### \`otp\` #### \`parseable\` @@ -4077,6 +4131,8 @@ npm token revoke npm token create [--read-only] [--cidr=list] \`\`\` +Note: This command is unaware of workspaces. + #### \`read-only\` #### \`cidr\` #### \`registry\` @@ -4149,6 +4205,8 @@ Run "npm help unstar" for more info npm unstar [...] \`\`\` +Note: This command is unaware of workspaces. + #### \`registry\` #### \`unicode\` #### \`otp\` @@ -4274,5 +4332,7 @@ Run "npm help whoami" for more info npm whoami \`\`\` +Note: This command is unaware of workspaces. + #### \`registry\` `