(newCommandOptions = {})
| 22 | } |
| 23 | |
| 24 | async getQuestions(newCommandOptions = {}) { |
| 25 | const { isLangCode } = require('is-language-code'); |
| 26 | |
| 27 | return [ |
| 28 | { |
| 29 | name: 'blueprint', |
| 30 | type: 'select', |
| 31 | message: 'Is this an app or an addon?', |
| 32 | choices: [ |
| 33 | { |
| 34 | name: 'App', |
| 35 | value: 'app', |
| 36 | }, |
| 37 | { |
| 38 | name: 'Addon', |
| 39 | value: 'addon', |
| 40 | }, |
| 41 | ], |
| 42 | }, |
| 43 | { |
| 44 | name: 'name', |
| 45 | type: 'input', |
| 46 | message: ({ blueprint }) => `Please provide the name of your ${blueprint}:`, |
| 47 | when: !newCommandOptions.name, |
| 48 | validate: (name) => { |
| 49 | if (name) { |
| 50 | if (isValidProjectName(name)) { |
| 51 | return true; |
| 52 | } |
| 53 | |
| 54 | return `We currently do not support \`${name}\` as a name.`; |
| 55 | } |
| 56 | |
| 57 | return 'Please provide a name.'; |
| 58 | }, |
| 59 | }, |
| 60 | { |
| 61 | name: 'langSelection', |
| 62 | type: 'select', |
| 63 | message: ({ blueprint }) => `Please provide the spoken/content language of your ${blueprint}:`, |
| 64 | when: !newCommandOptions.lang, |
| 65 | choices: await this.getLangChoices(), |
| 66 | }, |
| 67 | { |
| 68 | name: 'langDifferent', |
| 69 | type: 'input', |
| 70 | message: 'Please provide the different language:', |
| 71 | when: ({ langSelection } = {}) => !newCommandOptions.lang && !langSelection, |
| 72 | validate: (lang) => { |
| 73 | if (isLangCode(lang).res) { |
| 74 | return true; |
| 75 | } |
| 76 | |
| 77 | return 'Please provide a valid locale code.'; |
| 78 | }, |
| 79 | }, |
| 80 | { |
| 81 | name: 'packageManager', |
no test coverage detected