-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
65 lines (50 loc) · 1.54 KB
/
index.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#!/usr/bin/env node
const terminal = require("inquirer");
const terminalQues = require("./src/terminalQuestions");
const { structuringFolders, npmInstall, yarnInstall, gitInitialize, addListen, openVsCode } = require("./src/structuring/basicStructuring");
const { copyingFiles, createPackageJson, copyingESLintFiles, copyingDotEnvFiles, addDB } = require("./src/structuring/jsStructuring");
const jsSpecificInstallation = async (answers) => {
const { name, eslint, dotenv, database } = answers;
await createPackageJson(answers);
await copyingFiles(name);
if (eslint) {
await copyingESLintFiles(name);
}
if (database !== "none") {
addDB(name, database);
addListen(name);
} else {
addListen(name);
}
if (dotenv) {
await copyingDotEnvFiles(name);
}
};
terminalQues().then(async (answers) => {
const { name, pkgManager, git, dotenv, database, linter, acceptance } = answers;
if (!acceptance) {
return;
}
await structuringFolders(name);
await jsSpecificInstallation(answers);
if (pkgManager === "NPM") {
await npmInstall(name);
} else {
await yarnInstall(name);
}
if (git) {
await gitInitialize(name);
}
console.log("✔ Finished Structuring! 🎉✨");
terminal.prompt([
{
name: "VsCode",
type: "confirm",
message: "Open project in VSCode?",
},
]).then(({ VsCode }) => {
if (VsCode) {
openVsCode(name);
}
});
});