Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 | import path from 'path'; import os from 'os'; function getPathQuestions(packageType) { return [ { type: 'input', name: 'name', message: `What is the name of your ${packageType}?`, validate: input => { if (!input) { return 'Please enter a name'; } return true; }, default: `my-${packageType}`, }, { type: 'input', name: 'baseDir', message: `What is the target path to create your ${packageType}?`, suffix: `\n(we recommend you do not use the OHIF ${packageType} folder (./${packageType}s) unless you are developing a core ${packageType})`, maxLength: 40, validate: input => { if (!input) { console.log('Please provide a valid target directory path'); return; } return true; }, filter: (input, answers) => { // Replace ~ with the user's home directory const expandedPath = input.replace(/^~(?=$|\/|\\)/, os.homedir()); // Resolve the path to an absolute path const resolvedPath = path.resolve(expandedPath, answers.name); return resolvedPath; }, }, { type: 'confirm', name: 'confirm', message: `Please confirm the above path for generating the ${packageType} folder:`, }, ]; } function getRepoQuestions(packageType) { return [ { type: 'confirm', name: 'gitRepository', message: 'Should it be a git repository?', default: false, }, { type: 'confirm', name: 'prettier', message: 'Should it follow same prettier rules as OHIF?', }, { type: 'input', name: 'version', message: `What is the version of your ${packageType}?`, default: '0.0.1', }, { type: 'input', name: 'description', message: `What is the description of your ${packageType}?`, default: '', }, { type: 'input', name: 'author', message: `Who is the author of your ${packageType}?`, default: '', }, { type: 'input', name: 'email', message: 'What is your email address?', default: '', }, { type: 'input', name: 'license', message: `What is the license of your ${packageType}?`, default: 'MIT', }, ]; } export { getPathQuestions, getRepoQuestions }; |