@bill742/create-nextstarter 1.0.0 → 1.1.1

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/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # create-nextstarter
2
2
 
3
- Scaffold a new [NextStarter](https://github.com/bill742/nextstarter) project with a single command.
3
+ Scaffold a new Next.js project based on the [NextStarter](https://github.com/bill742/nextstarter) boilerplate with a single command.
4
4
 
5
5
  ## Usage
6
6
 
package/package.json CHANGED
@@ -12,5 +12,9 @@
12
12
  ],
13
13
  "license": "MIT",
14
14
  "name": "@bill742/create-nextstarter",
15
- "version": "1.0.0"
15
+ "repository": {
16
+ "type": "git",
17
+ "url": "https://github.com/bill742/create-nextstarter"
18
+ },
19
+ "version": "1.1.1"
16
20
  }
package/src/index.js CHANGED
@@ -84,15 +84,26 @@ async function createNextStarter(projectName) {
84
84
  }
85
85
  console.log(" \u2713 Cleaning up");
86
86
 
87
- // Step 3: Copy .env.example .env
87
+ // Step 3: Prompt for site name
88
+ const siteName = (await prompt("? Site name? (e.g. My App) ")).trim() || projectName;
89
+
90
+ // Step 4: Copy .env.example → .env and apply site name
88
91
  const envExample = path.join(targetDir, ".env.example");
89
92
  const envTarget = path.join(targetDir, ".env");
90
93
  if (fs.existsSync(envExample)) {
91
94
  fs.copyFileSync(envExample, envTarget);
92
95
  }
96
+ if (fs.existsSync(envTarget)) {
97
+ let envContent = fs.readFileSync(envTarget, "utf8");
98
+ envContent = envContent.replace(
99
+ /^(NEXT_PUBLIC_SITE_NAME=).*$/m,
100
+ `$1${siteName}`,
101
+ );
102
+ fs.writeFileSync(envTarget, envContent);
103
+ }
93
104
  console.log(" \u2713 Setting up .env");
94
105
 
95
- // Step 4: Rewrite package.json
106
+ // Step 5: Rewrite package.json
96
107
  const pkgPath = path.join(targetDir, "package.json");
97
108
  if (fs.existsSync(pkgPath)) {
98
109
  const pkg = JSON.parse(fs.readFileSync(pkgPath, "utf8"));
@@ -102,7 +113,7 @@ async function createNextStarter(projectName) {
102
113
  }
103
114
  console.log(" \u2713 Updating package.json");
104
115
 
105
- // Step 5: Prompt to install dependencies
116
+ // Step 6: Prompt to install dependencies
106
117
  const answer = await prompt("\n? Install dependencies now? (Y/n) ");
107
118
  const shouldInstall = answer.trim().toLowerCase() !== "n";
108
119
 
@@ -116,7 +127,7 @@ async function createNextStarter(projectName) {
116
127
  }
117
128
  }
118
129
 
119
- // Step 6: Print next steps
130
+ // Step 7: Print next steps
120
131
  console.log("\nDone! Your project is ready.\n");
121
132
  console.log(` cd ${projectName}`);
122
133
  if (!shouldInstall) {