@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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/cli.js +21 -19
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kuldi/create-nestjs",
3
- "version": "1.1.4",
3
+ "version": "1.1.5",
4
4
  "type": "module",
5
5
  "description": "Scaffolding tool for Kuli Digital NestJS Boilerplate",
6
6
  "main": "src/cli.js",
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-tanya
23
- const answers = await inquirer.prompt([
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
- when: !argProjectName,
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
- // Check if target directory is empty
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 {