create-express-kickstart 1.0.0 ā 1.0.2
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/bin/cli.js +10 -5
- package/package.json +3 -4
package/bin/cli.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
1
|
+
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
import fs from 'fs';
|
|
4
4
|
import path from 'path';
|
|
@@ -21,11 +21,11 @@ async function init() {
|
|
|
21
21
|
|
|
22
22
|
let projectName = projectNameArg;
|
|
23
23
|
if (!projectName) {
|
|
24
|
-
projectName = await question('\nš Project
|
|
24
|
+
projectName = await question('\nš Project Directory Name (e.g. my-awesome-api): ');
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
if (!projectName) {
|
|
28
|
-
console.error('\nā Error: Project
|
|
28
|
+
console.error('\nā Error: Project Directory Name is required.');
|
|
29
29
|
process.exit(1);
|
|
30
30
|
}
|
|
31
31
|
|
|
@@ -33,10 +33,15 @@ async function init() {
|
|
|
33
33
|
const projectPath = path.join(currentPath, projectName);
|
|
34
34
|
|
|
35
35
|
if (fs.existsSync(projectPath)) {
|
|
36
|
-
console.error(`\nā Error: Folder ${projectName} already exists. Please choose a different name.\n`);
|
|
36
|
+
console.error(`\nā Error: Folder ${projectName} already exists. Please choose a different directory name.\n`);
|
|
37
37
|
process.exit(1);
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
+
let packageJsonName = await question(`š package.json name (${projectName}): `);
|
|
41
|
+
if (!packageJsonName.trim()) {
|
|
42
|
+
packageJsonName = projectName; // Fallback to directory name
|
|
43
|
+
}
|
|
44
|
+
|
|
40
45
|
const description = await question('š Project description: ');
|
|
41
46
|
const author = await question('š Author name: ');
|
|
42
47
|
|
|
@@ -102,7 +107,7 @@ async function init() {
|
|
|
102
107
|
// 3. Create package.json
|
|
103
108
|
console.log(`š¦ Setting up package.json...`);
|
|
104
109
|
const packageJsonTemplate = {
|
|
105
|
-
name:
|
|
110
|
+
name: packageJsonName.trim(),
|
|
106
111
|
version: "1.0.0",
|
|
107
112
|
description: description || "A production-ready Node.js Express API",
|
|
108
113
|
main: "src/server.js",
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-express-kickstart",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "Production-ready CLI starter for Express APIs",
|
|
5
5
|
"main": "bin/cli.js",
|
|
6
6
|
"bin": {
|
|
7
|
-
"create-express-kickstart": "
|
|
7
|
+
"create-express-kickstart": "bin/cli.js"
|
|
8
8
|
},
|
|
9
9
|
"scripts": {
|
|
10
10
|
"test": "echo \"Error: no test specified\" && exit 1"
|
|
@@ -21,6 +21,5 @@
|
|
|
21
21
|
"author": "Your Name",
|
|
22
22
|
"license": "ISC",
|
|
23
23
|
"type": "module",
|
|
24
|
-
"dependencies": {
|
|
25
|
-
}
|
|
24
|
+
"dependencies": {}
|
|
26
25
|
}
|