feat(cli): install dependencies before build

This commit is contained in:
陈嘉涵
2019-12-19 10:31:17 +08:00
parent 387575edf5
commit 83ba5e47bf
6 changed files with 239 additions and 143 deletions
+16
View File
@@ -1,5 +1,6 @@
import decamelize from 'decamelize';
import { join } from 'path';
import { execSync } from 'child_process';
import {
lstatSync,
existsSync,
@@ -128,4 +129,19 @@ export function smartOutputFile(filePath: string, content: string) {
outputFileSync(filePath, content);
}
let hasYarnCache: boolean;
export function hasYarn() {
if (hasYarnCache === undefined) {
try {
execSync('yarn --version', { stdio: 'ignore' });
hasYarnCache = true;
} catch (e) {
hasYarnCache = false;
}
}
return hasYarnCache;
}
export { decamelize, getVantConfig };