@betterstart/cli 0.1.7 → 0.1.9

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 CHANGED
@@ -7978,6 +7978,7 @@ async function promptProject(defaultName) {
7978
7978
  defaultValue: defaultName ?? "my-app",
7979
7979
  validate: (value) => {
7980
7980
  if (!value.trim()) return "Project name is required";
7981
+ if (value.trim() === ".") return void 0;
7981
7982
  if (!/^[a-z0-9_-]+$/i.test(value.trim())) {
7982
7983
  return "Project name can only contain letters, numbers, hyphens, and underscores";
7983
7984
  }
@@ -13580,10 +13581,10 @@ var initCommand = new Command3("init").description("Scaffold CMS into a new or e
13580
13581
  let cwd = process.cwd();
13581
13582
  let project = detectProject(cwd);
13582
13583
  let pm = detectPackageManager(cwd);
13583
- p4.log.info(`Package manager: ${pc2.cyan(pm)}`);
13584
13584
  let srcDir;
13585
13585
  if (project.isExisting) {
13586
13586
  p4.log.info(`Existing Next.js project detected`);
13587
+ p4.log.info(`Package manager: ${pc2.cyan(pm)}`);
13587
13588
  srcDir = project.hasSrcDir;
13588
13589
  if (!project.hasTypeScript) {
13589
13590
  p4.log.error("TypeScript is required. Please add a tsconfig.json first.");
@@ -13609,8 +13610,25 @@ var initCommand = new Command3("init").description("Scaffold CMS into a new or e
13609
13610
  p4.log.info("No Next.js project found \u2014 fresh project mode");
13610
13611
  const projectPrompt = await promptProject(name);
13611
13612
  srcDir = projectPrompt.useSrcDir;
13613
+ if (!options.yes) {
13614
+ const pmChoice = await p4.select({
13615
+ message: "Which package manager do you want to use?",
13616
+ options: [
13617
+ { value: "pnpm", label: "pnpm", hint: "recommended" },
13618
+ { value: "npm", label: "npm" },
13619
+ { value: "yarn", label: "yarn" },
13620
+ { value: "bun", label: "bun" }
13621
+ ]
13622
+ });
13623
+ if (p4.isCancel(pmChoice)) {
13624
+ p4.cancel("Setup cancelled.");
13625
+ process.exit(0);
13626
+ }
13627
+ pm = pmChoice;
13628
+ }
13612
13629
  const cnaSpinner = p4.spinner();
13613
- cnaSpinner.start(`Creating Next.js app: ${projectPrompt.projectName}...`);
13630
+ const displayName = projectPrompt.projectName === "." ? path37.basename(cwd) : projectPrompt.projectName;
13631
+ cnaSpinner.start(`Creating Next.js app: ${displayName}...`);
13614
13632
  try {
13615
13633
  const cnaArgs = [
13616
13634
  "create-next-app@latest",
@@ -13620,7 +13638,8 @@ var initCommand = new Command3("init").description("Scaffold CMS into a new or e
13620
13638
  "--app",
13621
13639
  "--no-git",
13622
13640
  "--no-import-alias",
13623
- "--turbopack"
13641
+ "--turbopack",
13642
+ `--use-${pm}`
13624
13643
  ];
13625
13644
  if (srcDir) cnaArgs.push("--src-dir");
13626
13645
  else cnaArgs.push("--no-src-dir");
@@ -13629,7 +13648,7 @@ var initCommand = new Command3("init").description("Scaffold CMS into a new or e
13629
13648
  stdio: "pipe",
13630
13649
  timeout: 12e4
13631
13650
  });
13632
- cnaSpinner.stop(`Created ${projectPrompt.projectName}`);
13651
+ cnaSpinner.stop(`Created ${displayName}`);
13633
13652
  } catch (err) {
13634
13653
  cnaSpinner.stop("Failed to create Next.js app");
13635
13654
  p4.log.error(err instanceof Error ? err.message : "create-next-app failed");
@@ -13642,7 +13661,6 @@ var initCommand = new Command3("init").description("Scaffold CMS into a new or e
13642
13661
  }
13643
13662
  cwd = path37.resolve(cwd, projectPrompt.projectName);
13644
13663
  project = detectProject(cwd);
13645
- pm = detectPackageManager(cwd);
13646
13664
  }
13647
13665
  const features = options.yes ? { includeEmail: true, preset: options.preset } : await promptFeatures(options.preset);
13648
13666
  let databaseUrl;