From 2b7ad935abdd2995c9293b1b6ce9bbbef6ab83f0 Mon Sep 17 00:00:00 2001 From: chenjiahan Date: Tue, 7 Sep 2021 15:23:51 +0800 Subject: [PATCH] fix(@vant/cli): failed to run lint command --- package.json | 2 +- packages/vant-cli/package.json | 2 +- packages/vant-cli/src/commands/lint.ts | 5 +++-- yarn.lock | 8 ++++---- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/package.json b/package.json index 5f970c65a..a0c9d5a0b 100644 --- a/package.json +++ b/package.json @@ -15,7 +15,7 @@ "*.{vue,css,less}": "stylelint --fix" }, "devDependencies": { - "@vant/cli": "^4.0.0-beta.3", + "@vant/cli": "^4.0.0-beta.4", "@vue/compiler-sfc": "3.2.8", "vue": "3.2.8" } diff --git a/packages/vant-cli/package.json b/packages/vant-cli/package.json index 36ce0c0a3..f26b5e0c6 100644 --- a/packages/vant-cli/package.json +++ b/packages/vant-cli/package.json @@ -1,6 +1,6 @@ { "name": "@vant/cli", - "version": "4.0.0-beta.4", + "version": "4.0.0-beta.5", "main": "lib/index.js", "typings": "lib/index.d.ts", "bin": { diff --git a/packages/vant-cli/src/commands/lint.ts b/packages/vant-cli/src/commands/lint.ts index 4c8acbdda..7f1092a70 100644 --- a/packages/vant-cli/src/commands/lint.ts +++ b/packages/vant-cli/src/commands/lint.ts @@ -1,5 +1,5 @@ import execa from 'execa'; -import { ora } from '../common/logger'; +import { consola, ora } from '../common/logger'; import { SCRIPT_EXTS } from '../common/constant'; type RunCommandMessages = { @@ -17,6 +17,7 @@ function runCommand( return new Promise((resolve) => { execa(cmd, options, { + preferLocal: true, env: { FORCE_COLOR: true }, }) .then(() => { @@ -25,7 +26,7 @@ function runCommand( }) .catch((err: any) => { spinner.fail(messages.failed); - console.log(err.stderr || err.stdout); + consola.error(err.stderr || err.stdout); resolve(false); }); }); diff --git a/yarn.lock b/yarn.lock index f93ffbb72..237c05ea0 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1728,10 +1728,10 @@ "@typescript-eslint/types" "4.31.0" eslint-visitor-keys "^2.0.0" -"@vant/cli@^4.0.0-beta.3": - version "4.0.0-beta.3" - resolved "https://registry.npmjs.org/@vant/cli/-/cli-4.0.0-beta.3.tgz#ab1cbd1b2c7007e45814a447bb6ec2ba1f2aff6f" - integrity sha512-Q1xGOjw6U3AI1c1P1XdEk6H6QuZpD7kYr7cPkrqXE/Ias8q34MDrhHxZSlPUxZFUrAwVHFKWmUk/gBNqaHxtDQ== +"@vant/cli@^4.0.0-beta.4": + version "4.0.0-beta.4" + resolved "https://registry.npmjs.org/@vant/cli/-/cli-4.0.0-beta.4.tgz#1e6b085674e8e849983a6a8dddf9c59d399b9f03" + integrity sha512-ortFKMTGDinKravnOjr0fO9MyhtJvXvj2fClBxA0vl+r84qfOma+xy3zmFdW/jFADzZoPVprwMibwyeLT0O5Hg== dependencies: "@babel/core" "^7.15.0" "@babel/preset-env" "^7.15.0"