| 50 | } |
| 51 | |
| 52 | private async getProjectName() { |
| 53 | if (this.options.dir) { |
| 54 | return path.basename(this.options.dir); |
| 55 | } |
| 56 | const defaultValue = last(split(this.template, '/')); |
| 57 | if (this.options.y) { |
| 58 | return defaultValue; |
| 59 | } |
| 60 | const answers = await inquirer.prompt([ |
| 61 | { |
| 62 | type: 'input', |
| 63 | name: 'projectName', |
| 64 | message: 'Please input your project name (init dir)', |
| 65 | default: defaultValue, |
| 66 | validate: (input: string) => { |
| 67 | if (!input) { |
| 68 | return 'Project name is required'; |
| 69 | } |
| 70 | return true; |
| 71 | }, |
| 72 | }, |
| 73 | ]); |
| 74 | return trim(answers.projectName); |
| 75 | } |
| 76 | |
| 77 | private async getInitAliMenu() { |
| 78 | const aliMenu = axios.get('https://images.devsapp.cn/bin/s/ali-template.json'); |