-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinit.js
More file actions
42 lines (40 loc) · 1.36 KB
/
init.js
File metadata and controls
42 lines (40 loc) · 1.36 KB
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
import { select, Separator } from "@inquirer/prompts";
import chalk from "chalk";
import expressInit from "./unopinionated/expressInit.js";
import fastifyInit from "./unopinionated/fastifyInit.js";
import nestInit from "./opinionated/nestInit.js";
import adonisInit from "./opinionated/adonisInit.js";
export default async function backEndInit() {
console.log(chalk.red("You selected Backend!"));
const answerBackend = await select({
message: "Which backend framework would you like to use?",
default: "express",
loop: false,
choices: [
new Separator("Unopinionated Frameworks"),
{ value: "express", name: "Express.js" },
{ value: "fastify", name: "Fastify" },
new Separator("Opinionated Frameworks"),
{ value: "nest", name: "NestJS" },
{ value: "adonis", name: "AdonisJS" },
],
});
switch (answerBackend) {
case "express":
console.log(chalk.white("Initializing Express.js project..."));
await expressInit();
break;
case "fastify":
console.log(chalk.gray("Initializing Fastify project..."));
await fastifyInit();
break;
case "nest":
console.log(chalk.red("Initializing NestJS project..."));
await nestInit();
break;
case "adonis":
console.log(chalk.hex("#5A45FF")("Initializing AdonisJS project..."));
await adonisInit();
break;
}
}