@kuldi/create-nestjs 1.1.4 → 1.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/cli.js +21 -19
package/package.json
CHANGED
package/src/cli.js
CHANGED
|
@@ -19,33 +19,19 @@ async function run() {
|
|
|
19
19
|
|
|
20
20
|
const argProjectName = process.argv[2];
|
|
21
21
|
|
|
22
|
-
// 1. Tanya
|
|
23
|
-
const
|
|
22
|
+
// 1. Tanya Project Name
|
|
23
|
+
const { projectName } = await inquirer.prompt([
|
|
24
24
|
{
|
|
25
25
|
type: 'input',
|
|
26
26
|
name: 'projectName',
|
|
27
27
|
message: 'Project Name (or . for current directory):',
|
|
28
|
-
default: argProjectName || 'my-nestjs-app',
|
|
29
|
-
|
|
30
|
-
},
|
|
31
|
-
{
|
|
32
|
-
type: 'input',
|
|
33
|
-
name: 'database',
|
|
34
|
-
message: 'PostgreSQL Database Name:',
|
|
35
|
-
default: 'kulidigital_db',
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
type: 'confirm',
|
|
39
|
-
name: 'skipInstall',
|
|
40
|
-
message: 'Skip package installation (npm install)?',
|
|
41
|
-
default: false,
|
|
42
|
-
},
|
|
28
|
+
default: argProjectName === '.' ? '.' : (argProjectName || 'my-nestjs-app'),
|
|
29
|
+
}
|
|
43
30
|
]);
|
|
44
31
|
|
|
45
|
-
const projectName = argProjectName || answers.projectName;
|
|
46
32
|
const projectPath = projectName === '.' ? currentPath : path.join(currentPath, projectName);
|
|
47
33
|
|
|
48
|
-
//
|
|
34
|
+
// 2. Cek apakah folder kosong (Overwrite Check)
|
|
49
35
|
if (fs.existsSync(projectPath)) {
|
|
50
36
|
const files = fs.readdirSync(projectPath).filter(f => !f.startsWith('.git'));
|
|
51
37
|
if (files.length > 0) {
|
|
@@ -65,6 +51,22 @@ async function run() {
|
|
|
65
51
|
}
|
|
66
52
|
}
|
|
67
53
|
|
|
54
|
+
// 3. Tanya Database & Setup
|
|
55
|
+
const answers = await inquirer.prompt([
|
|
56
|
+
{
|
|
57
|
+
type: 'input',
|
|
58
|
+
name: 'database',
|
|
59
|
+
message: 'PostgreSQL Database Name:',
|
|
60
|
+
default: projectName === '.' || !projectName ? 'kulidigital_db' : `${projectName}_db`,
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
type: 'confirm',
|
|
64
|
+
name: 'skipInstall',
|
|
65
|
+
message: 'Skip package installation (npm install)?',
|
|
66
|
+
default: false,
|
|
67
|
+
},
|
|
68
|
+
]);
|
|
69
|
+
|
|
68
70
|
// 2. Salin Template
|
|
69
71
|
const copySpinner = ora('Generating project structure...').start();
|
|
70
72
|
try {
|