UNPKG

@mypaas/hcm-cli

Version:

Vant Cli 是一个 Vue 组件库构建工具,通过 Vant Cli 可以快速搭建一套功能完备的 Vue 组件库。

43 lines (42 loc) 1.29 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.installDependencies = exports.hasYarn = void 0; const execa_1 = __importDefault(require("execa")); const logger_1 = require("./logger"); const child_process_1 = require("child_process"); let hasYarnCache; function hasYarn() { if (hasYarnCache === undefined) { try { child_process_1.execSync('yarn --version', { stdio: 'ignore' }); hasYarnCache = true; } catch (e) { hasYarnCache = false; } } return hasYarnCache; } exports.hasYarn = hasYarn; async function installDependencies(registry) { logger_1.consola.info('Install Dependencies\n'); try { const manager = hasYarn() ? 'yarn' : 'npm'; const params = ['install', '--prod=false']; if (registry) { params.push(`--registry=${registry}`); } await execa_1.default(manager, params, { stdio: 'inherit', }); console.log(''); } catch (err) { console.log(err); throw err; } } exports.installDependencies = installDependencies;