yst-react-cli
Version:
49 lines (43 loc) • 1.42 kB
JavaScript
;
// 存放变量
var _require = require('../package.json'),
version = _require.version;
// 下载模版临时存储位置,win的process.platform获取的是‘win32’,mac是‘darwin’
var temporaryDownloadDirectory = process.env[process.platform === 'darwin' ? 'HOME/' : 'USERPROFILE\\'] + '.template';
// commander命令
var mapActions = {
create: {
alias: 'c',
description: 'create a project',
examples: ['yst-react-cli create <project-name>']
},
config: {
alias: 'cfg',
description: 'config project variables',
examples: ['yst-react-cli config set <k><v>', 'yst-react-cli config get <k>']
},
'*': {
alias: '',
description: 'command not found',
examples: []
}
};
// 用户选择
var userInquirer = [{
name: 'template',
type: 'list',
message: 'Please select a template',
choices: ['template-pc', 'template-admin', 'template-wap']
}, {
name: 'description',
message: 'Please enter the project description'
}, {
name: 'author',
message: 'Please enter the project author'
}, {
name: 'packageType',
type: 'list',
message: 'Please select the package management tool',
choices: ['npm', 'cnpm', 'yarn']
}];
module.exports = { version: version, temporaryDownloadDirectory: temporaryDownloadDirectory, mapActions: mapActions, userInquirer: userInquirer };