UNPKG

813 BPlain TextView Raw
1#!/usr/bin/env node
2'use strict'
3
4const program = require('commander')
5const logger = require('../util/logger')
6const npm = require('../util/npm')
7
8program
9 .option('-r --registry [registry-url]', '指定镜像, 默认选用 taobao 镜像')
10 .option('-t --template', '安装脚手架')
11 .option('-c --cmd', '安装指令')
12 .parse(process.argv)
13
14let name = program.args
15
16if (!name) {
17 logger.fatal('请指定插件名称')
18}
19
20if (program.template) {
21 logger.log(`安装脚手架: ${name}`)
22 name = name.map(item => `slush-xdc-${item}`)
23} else if(program.cmd) {
24 logger.log(`安装指令: ${name}`)
25 name = name.map(item => `xdc-${item}-command`)
26} else {
27 logger.log(`安装插件: ${name}`)
28 name = name.map(item => `xdc-${item}`)
29}
30
31npm.install(name, program.registry)
32logger.success('安装成功')