|
|
@ -18,8 +18,7 @@ module.exports = function(projectName, templateType) { |
|
|
|
// 创建文件目录
|
|
|
|
const dir = `${projectName}`; |
|
|
|
await fs.ensureDir(dir).then(res => { |
|
|
|
console.log('创建成功'); |
|
|
|
console.log(res); |
|
|
|
// console.log('创建成功');
|
|
|
|
}).catch(err => { |
|
|
|
console.log('创建失败'); |
|
|
|
}); |
|
|
@ -28,17 +27,26 @@ module.exports = function(projectName, templateType) { |
|
|
|
switch (parseInt(templateType)) { |
|
|
|
case 1: |
|
|
|
fs.copy(path.join(__dirname, '../../templates/platform'), projectName) |
|
|
|
.then(() => console.log('success!')) |
|
|
|
.then(() => { |
|
|
|
console.log('\n创建成功!\n') |
|
|
|
console.log(`\n cd ${projectName} 进行使用 \n`); |
|
|
|
}) |
|
|
|
.catch(err => console.error(err)); |
|
|
|
break; |
|
|
|
case 2: |
|
|
|
fs.copy(path.join(__dirname, '../../templates/application'), projectName) |
|
|
|
.then(() => console.log('success!')) |
|
|
|
.then(() => { |
|
|
|
console.log('\n创建成功!\n') |
|
|
|
console.log(`\n cd ${projectName} 进行使用 \n`); |
|
|
|
}) |
|
|
|
.catch(err => console.error(err)); |
|
|
|
break; |
|
|
|
case 3: |
|
|
|
fs.copy(path.join(__dirname, '../../templates/component'), projectName) |
|
|
|
.then(() => console.log('success!')) |
|
|
|
.then(() => { |
|
|
|
console.log('\n创建成功!\n') |
|
|
|
console.log(`\n cd ${projectName} 进行使用 \n`); |
|
|
|
}) |
|
|
|
.catch(err => console.error(err)); |
|
|
|
break; |
|
|
|
default: |
|
|
|