File tree 2 files changed +5
-5
lines changed 2 files changed +5
-5
lines changed Original file line number Diff line number Diff line change 5
5
6
6
const { chalk, semver } = require ( '@vue/cli-shared-utils' )
7
7
const requiredVersion = require ( '../package.json' ) . engines . node
8
- const didYouMean = require ( 'didyoumean' )
9
-
10
- // Setting edit distance to 60% of the input string's length
11
- didYouMean . threshold = 0.6
8
+ const leven = require ( 'leven' )
12
9
13
10
function checkNodeVersion ( wanted , id ) {
14
11
if ( ! semver . satisfies ( process . version , wanted ) ) {
@@ -261,7 +258,9 @@ if (!process.argv.slice(2).length) {
261
258
function suggestCommands ( unknownCommand ) {
262
259
const availableCommands = program . commands . map ( cmd => cmd . _name )
263
260
264
- const suggestion = didYouMean ( unknownCommand , availableCommands )
261
+ const suggestion = availableCommands . find ( cmd => {
262
+ return leven ( cmd , unknownCommand ) < 3
263
+ } )
265
264
if ( suggestion ) {
266
265
console . log ( ` ` + chalk . red ( `Did you mean ${ chalk . yellow ( suggestion ) } ?` ) )
267
266
}
Original file line number Diff line number Diff line change 45
45
"javascript-stringify" : " ^1.6.0" ,
46
46
"js-yaml" : " ^3.13.1" ,
47
47
"jscodeshift" : " ^0.7.0" ,
48
+ "leven" : " ^3.1.0" ,
48
49
"lodash.clonedeep" : " ^4.5.0" ,
49
50
"lru-cache" : " ^5.1.1" ,
50
51
"minimist" : " ^1.2.0" ,
You can’t perform that action at this time.
0 commit comments