Reorganize logic

This commit is contained in:
Mariusz Nowak 2019-06-25 14:56:19 +02:00
parent af3ac05342
commit 6df0f6872f
No known key found for this signature in database
GPG Key ID: B1FBDA8A182B03F2

View File

@ -34,16 +34,7 @@ module.exports = path => {
{ name: 'Other', value: 'other' },
],
})
.then(({ projectType }) => {
if (projectType === 'other') {
process.stdout.write(
'\nRun “serverless create --help” to view available templates and create a new project ' +
'from one of those templates.\n\n'
);
return null;
}
return projectType;
});
.then(({ projectType }) => projectType);
const projectNameInput = () =>
inquirer
@ -132,7 +123,13 @@ module.exports = path => {
if (!createWanted) return null;
return projectTypeChoice().then(projectType => {
if (!projectType) return null;
if (projectType === 'other') {
process.stdout.write(
'\nRun “serverless create --help” to view available templates and create a new project ' +
'from one of those templates.\n\n'
);
return null;
}
return projectNameInput()
.then(projectName => {
const projectDir = join(process.cwd(), projectName);