@kuldi/create-nestjs 1.1.3 → 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 (4) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +1 -1
  3. package/package.json +1 -1
  4. package/src/cli.js +31 -18
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Kuli Digital
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -23,7 +23,7 @@ npm create @kuldi/nestjs@latest my-app
23
23
  Or, to create the project in your **current directory**:
24
24
 
25
25
  ```bash
26
- npm create @kuldi/nestjs@latest .
26
+ npm create @kuldi/nestjs .
27
27
  ```
28
28
 
29
29
  ### Note on Global Installations (Optional)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kuldi/create-nestjs",
3
- "version": "1.1.3",
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,20 +19,45 @@ 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
- },
28
+ default: argProjectName === '.' ? '.' : (argProjectName || 'my-nestjs-app'),
29
+ }
30
+ ]);
31
+
32
+ const projectPath = projectName === '.' ? currentPath : path.join(currentPath, projectName);
33
+
34
+ // 2. Cek apakah folder kosong (Overwrite Check)
35
+ if (fs.existsSync(projectPath)) {
36
+ const files = fs.readdirSync(projectPath).filter(f => !f.startsWith('.git'));
37
+ if (files.length > 0) {
38
+ const { overwrite } = await inquirer.prompt([
39
+ {
40
+ type: 'confirm',
41
+ name: 'overwrite',
42
+ message: 'Directory is not empty. Do you want to continue? (This will overwrite existing files)',
43
+ default: false,
44
+ }
45
+ ]);
46
+
47
+ if (!overwrite) {
48
+ console.log(chalk.yellow('\n⚠️ Setup cancelled.\n'));
49
+ process.exit(0);
50
+ }
51
+ }
52
+ }
53
+
54
+ // 3. Tanya Database & Setup
55
+ const answers = await inquirer.prompt([
31
56
  {
32
57
  type: 'input',
33
58
  name: 'database',
34
59
  message: 'PostgreSQL Database Name:',
35
- default: 'kulidigital_db',
60
+ default: projectName === '.' || !projectName ? 'kulidigital_db' : `${projectName}_db`,
36
61
  },
37
62
  {
38
63
  type: 'confirm',
@@ -42,18 +67,6 @@ async function run() {
42
67
  },
43
68
  ]);
44
69
 
45
- const projectName = argProjectName || answers.projectName;
46
- const projectPath = projectName === '.' ? currentPath : path.join(currentPath, projectName);
47
-
48
- // Mengecek apakah target directory kosong
49
- if (projectName === '.') {
50
- const files = fs.readdirSync(currentPath).filter(f => !f.startsWith('.git'));
51
- if (files.length > 0) {
52
- console.log(chalk.red('\n❌ Current directory is not empty! Please run in an empty directory.\n'));
53
- process.exit(1);
54
- }
55
- }
56
-
57
70
  // 2. Salin Template
58
71
  const copySpinner = ora('Generating project structure...').start();
59
72
  try {