create-zalo-mini-app
Version:
Create zalo mini app project
37 lines (34 loc) • 913 B
JavaScript
/* eslint no-param-reassign: ["off"] */
const inquirer = require('inquirer');
const questions = [
{
type: 'list',
name: 'initInCurrentDir',
message: 'Are you sure you want to initialize project in current folder?',
choices: [
{ name: 'Yes, initialize project in this folder', value: true },
{
name: 'No, i want to change folder to initialize project',
value: false,
},
],
},
{
type: 'input',
when: (opts) => !opts.initInCurrentDir,
name: 'projectName',
message: 'Project name:',
default: 'my-app',
validate(input) {
return new Promise((resolve, reject) => {
if (!input) reject(new Error('Project name is required'));
else resolve(true);
});
},
},
];
module.exports = function getOptions() {
return inquirer.prompt(questions).then((options) => {
return Promise.resolve(options);
});
};