@@ -40,11 +40,12 @@ const getCommandByDoc = (docFile, docExt) => {
40
40
// `npx` is not technically a command in and of itself,
41
41
// so it just needs the usage of npm exex
42
42
const srcName = name === 'npx' ? 'exec' : name
43
- const { params, usage = [ '' ] } = require ( `../../lib/commands/${ srcName } ` )
43
+ const { params, usage = [ '' ] , workspaces } = require ( `../../lib/commands/${ srcName } ` )
44
44
const usagePrefix = name === 'npx' ? 'npx' : `npm ${ name } `
45
45
46
46
return {
47
47
name,
48
+ workspaces,
48
49
params : name === 'npx' ? null : params ,
49
50
usage : usage . map ( u => `${ usagePrefix } ${ u } ` . trim ( ) ) . join ( '\n' ) ,
50
51
}
@@ -54,7 +55,7 @@ const replaceVersion = (src) => src.replace(/@VERSION@/g, version)
54
55
55
56
const replaceUsage = ( src , { path } ) => {
56
57
const replacer = assertPlaceholder ( src , path , TAGS . USAGE )
57
- const { usage, name } = getCommandByDoc ( path , DOC_EXT )
58
+ const { usage, name, workspaces } = getCommandByDoc ( path , DOC_EXT )
58
59
59
60
const synopsis = [ '```bash' , usage ]
60
61
@@ -66,15 +67,17 @@ const replaceUsage = (src, { path }) => {
66
67
} , [ ] )
67
68
68
69
if ( cmdAliases . length === 1 ) {
69
- synopsis . push ( '' )
70
- synopsis . push ( `alias: ${ cmdAliases [ 0 ] } ` )
70
+ synopsis . push ( '' , `alias: ${ cmdAliases [ 0 ] } ` )
71
71
} else if ( cmdAliases . length > 1 ) {
72
- synopsis . push ( '' )
73
- synopsis . push ( `aliases: ${ cmdAliases . join ( ', ' ) } ` )
72
+ synopsis . push ( '' , `aliases: ${ cmdAliases . join ( ', ' ) } ` )
74
73
}
75
74
76
75
synopsis . push ( '```' )
77
76
77
+ if ( ! workspaces ) {
78
+ synopsis . push ( '' , 'Note: This command is unaware of workspaces.' )
79
+ }
80
+
78
81
return src . replace ( replacer , synopsis . join ( '\n' ) )
79
82
}
80
83
0 commit comments