-
Notifications
You must be signed in to change notification settings - Fork 79
/
prompts.js
51 lines (44 loc) · 1.34 KB
/
prompts.js
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
module.exports = {
askForMainServerSideOpts
};
function askForMainServerSideOpts(meta) {
if (!meta && this.existingProject) return;
const applicationType = this.applicationType;
const PROMPT = [
{
type: 'input',
name: 'serverPort',
when: applicationType === 'monolith',
message: 'Which *Port* would you like to start your NestJS server?',
default: '8081'
},
{
type: 'list',
name: 'serverPackageManager',
when: applicationType === 'monolith',
message: 'Which *Package Manager* would you like for server?',
choices: [
{
value: 'npm',
name: 'Npm'
},
{
value: 'yarn',
name: 'Yarn'
}
],
default: 'npm'
}
];
if (applicationType !== 'monolith') {
this.log.error('For now only monolithic app type is allowed!');
process.exit(0);
}
if (meta) return PROMPT; // eslint-disable-line consistent-return
const done = this.async();
this.prompt(PROMPT).then(prompt => {
this.serverPort = prompt.serverPort;
this.serverPackageManager = prompt.serverPackageManager;
done();
});
}