@@ -49,12 +49,8 @@ class Diff extends BaseCommand {
49
49
50
50
async exec ( args ) {
51
51
const specs = this . npm . config . get ( 'diff' ) . filter ( d => d )
52
- if ( specs . length > 2 ) {
53
- throw new TypeError (
54
- 'Can\'t use more than two --diff arguments.\n\n' +
55
- `Usage:\n${ this . usage } `
56
- )
57
- }
52
+ if ( specs . length > 2 )
53
+ throw this . usageError ( `Can't use more than two --diff arguments.` )
58
54
59
55
// execWorkspaces may have set this already
60
56
if ( ! this . prefix )
@@ -101,7 +97,7 @@ class Diff extends BaseCommand {
101
97
}
102
98
103
99
if ( ! name )
104
- throw this . usageError ( 'Needs multiple arguments to compare or run from a project dir.\n ' )
100
+ throw this . usageError ( 'Needs multiple arguments to compare or run from a project dir.' )
105
101
106
102
return name
107
103
}
@@ -133,7 +129,7 @@ class Diff extends BaseCommand {
133
129
noPackageJson = true
134
130
}
135
131
136
- const missingPackageJson = this . usageError ( 'Needs multiple arguments to compare or run from a project dir.\n ' )
132
+ const missingPackageJson = this . usageError ( 'Needs multiple arguments to compare or run from a project dir.' )
137
133
138
134
// using a valid semver range, that means it should just diff
139
135
// the cwd against a published version to the registry using the
@@ -222,7 +218,7 @@ class Diff extends BaseCommand {
222
218
`file:${ this . prefix } ` ,
223
219
]
224
220
} else
225
- throw this . usageError ( `Spec type ${ spec . type } not supported.\n ` )
221
+ throw this . usageError ( `Spec type ${ spec . type } not supported.` )
226
222
}
227
223
228
224
async convertVersionsToSpecs ( [ a , b ] ) {
@@ -239,7 +235,7 @@ class Diff extends BaseCommand {
239
235
}
240
236
241
237
if ( ! pkgName )
242
- throw this . usageError ( 'Needs to be run from a project dir in order to diff two versions.\n ' )
238
+ throw this . usageError ( 'Needs to be run from a project dir in order to diff two versions.' )
243
239
244
240
return [ `${ pkgName } @${ a } ` , `${ pkgName } @${ b } ` ]
245
241
}
0 commit comments