betterstart-cli 0.0.80 → 0.0.82
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/dist/cli.js +17 -14
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -22587,8 +22587,8 @@ async function promptPresets(cwd, options = {}) {
|
|
|
22587
22587
|
import * as p13 from "@clack/prompts";
|
|
22588
22588
|
async function promptProject(defaultName) {
|
|
22589
22589
|
const projectName = await p13.text({
|
|
22590
|
-
message: "
|
|
22591
|
-
placeholder: defaultName ?? "(
|
|
22590
|
+
message: "What is your project named?",
|
|
22591
|
+
placeholder: defaultName ?? "(Press Enter to use default)",
|
|
22592
22592
|
defaultValue: defaultName ?? ".",
|
|
22593
22593
|
validate: (value) => {
|
|
22594
22594
|
if (!value?.trim()) return void 0;
|
|
@@ -27064,6 +27064,15 @@ async function runInitCommand(name, options) {
|
|
|
27064
27064
|
process.exit(1);
|
|
27065
27065
|
}
|
|
27066
27066
|
}
|
|
27067
|
+
let projectPrompt;
|
|
27068
|
+
if (!detectProject(cwd, namespace).isExisting) {
|
|
27069
|
+
try {
|
|
27070
|
+
projectPrompt = options.yes ? resolveNonInteractiveProject(name) : await promptProject(name);
|
|
27071
|
+
} catch (error) {
|
|
27072
|
+
p22.log.error(error instanceof Error ? error.message : String(error));
|
|
27073
|
+
process.exit(1);
|
|
27074
|
+
}
|
|
27075
|
+
}
|
|
27067
27076
|
if (!options.yes && !options.namespace) {
|
|
27068
27077
|
const defaultDashboardPath = resolveAdminNamespace(DEFAULT_ADMIN_NAMESPACE).routePath;
|
|
27069
27078
|
const namespaceInput = await p22.text({
|
|
@@ -27133,13 +27142,7 @@ async function runInitCommand(name, options) {
|
|
|
27133
27142
|
}
|
|
27134
27143
|
}
|
|
27135
27144
|
} else {
|
|
27136
|
-
|
|
27137
|
-
try {
|
|
27138
|
-
projectPrompt = options.yes ? resolveNonInteractiveProject(name) : await promptProject(name);
|
|
27139
|
-
} catch (error) {
|
|
27140
|
-
p22.log.error(error instanceof Error ? error.message : String(error));
|
|
27141
|
-
process.exit(1);
|
|
27142
|
-
}
|
|
27145
|
+
const freshProject = projectPrompt;
|
|
27143
27146
|
srcDir = false;
|
|
27144
27147
|
if (!options.yes) {
|
|
27145
27148
|
const pmChoice = await p22.select({
|
|
@@ -27156,12 +27159,12 @@ async function runInitCommand(name, options) {
|
|
|
27156
27159
|
}
|
|
27157
27160
|
pm = pmChoice;
|
|
27158
27161
|
}
|
|
27159
|
-
const displayName =
|
|
27162
|
+
const displayName = freshProject.projectName === "." ? path52.basename(cwd) : freshProject.projectName;
|
|
27160
27163
|
projectName = displayName;
|
|
27161
27164
|
const { bin, prefix } = createNextAppCommand();
|
|
27162
27165
|
const cnaArgs = [
|
|
27163
27166
|
...prefix,
|
|
27164
|
-
|
|
27167
|
+
freshProject.projectName,
|
|
27165
27168
|
"--yes",
|
|
27166
27169
|
"--typescript",
|
|
27167
27170
|
"--tailwind",
|
|
@@ -27189,12 +27192,12 @@ async function runInitCommand(name, options) {
|
|
|
27189
27192
|
p22.log.error(createNextAppResult.error);
|
|
27190
27193
|
p22.log.info(
|
|
27191
27194
|
`You can create the project manually:
|
|
27192
|
-
${pc9.cyan(`npx create-next-app@latest ${
|
|
27195
|
+
${pc9.cyan(`npx create-next-app@latest ${freshProject.projectName} --typescript --tailwind --app`)}
|
|
27193
27196
|
Then run ${pc9.cyan("betterstart init")} inside it.`
|
|
27194
27197
|
);
|
|
27195
27198
|
process.exit(1);
|
|
27196
27199
|
}
|
|
27197
|
-
cwd = path52.resolve(cwd,
|
|
27200
|
+
cwd = path52.resolve(cwd, freshProject.projectName);
|
|
27198
27201
|
const hasPackageJson = fs41.existsSync(path52.join(cwd, "package.json"));
|
|
27199
27202
|
const hasNextConfig = ["next.config.ts", "next.config.js", "next.config.mjs"].some(
|
|
27200
27203
|
(f) => fs41.existsSync(path52.join(cwd, f))
|
|
@@ -27204,7 +27207,7 @@ async function runInitCommand(name, options) {
|
|
|
27204
27207
|
p22.log.error(
|
|
27205
27208
|
"create-next-app completed but the project was not created. This can happen with nested npx calls."
|
|
27206
27209
|
);
|
|
27207
|
-
const manualCmd = `npx create-next-app@latest ${
|
|
27210
|
+
const manualCmd = `npx create-next-app@latest ${freshProject.projectName} --typescript --tailwind --app`;
|
|
27208
27211
|
p22.log.info(
|
|
27209
27212
|
`Create the project manually:
|
|
27210
27213
|
${pc9.cyan(manualCmd)}
|