@betterstart/cli 0.1.15 → 0.1.17

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
@@ -11663,7 +11663,7 @@ var CORE_DEPS = [
11663
11663
  "vaul"
11664
11664
  ];
11665
11665
  var EMAIL_DEPS = ["resend", "@react-email/components"];
11666
- var DEV_DEPS = ["drizzle-kit", "sass", "@types/katex", "@types/markdown-it"];
11666
+ var DEV_DEPS = ["drizzle-kit", "tsx", "sass", "@types/katex", "@types/markdown-it"];
11667
11667
  var BIOME_DEV_DEPS = ["@biomejs/biome"];
11668
11668
  function buildAddArgs(pm, deps, dev) {
11669
11669
  const devFlag = dev ? pm === "yarn" ? "--dev" : "-D" : "";
@@ -13437,8 +13437,24 @@ function buildSeedScript() {
13437
13437
  * AUTO-GENERATED \u2014 safe to delete after running
13438
13438
  */
13439
13439
 
13440
- import { loadEnvConfig } from '@next/env'
13441
- loadEnvConfig(process.cwd())
13440
+ import { readFileSync } from 'node:fs'
13441
+ import { resolve } from 'node:path'
13442
+
13443
+ // Load .env.local (inline \u2014 avoids @next/env dependency)
13444
+ for (const envFile of ['.env.local', '.env']) {
13445
+ try {
13446
+ const content = readFileSync(resolve(process.cwd(), envFile), 'utf-8')
13447
+ for (const line of content.split('\\n')) {
13448
+ const trimmed = line.trim()
13449
+ if (!trimmed || trimmed.startsWith('#')) continue
13450
+ const eqIdx = trimmed.indexOf('=')
13451
+ if (eqIdx === -1) continue
13452
+ const key = trimmed.slice(0, eqIdx).trim()
13453
+ const val = trimmed.slice(eqIdx + 1).trim().replace(/^['"]|['"]$/g, '')
13454
+ if (!process.env[key]) process.env[key] = val
13455
+ }
13456
+ } catch {}
13457
+ }
13442
13458
 
13443
13459
  import { neon } from '@neondatabase/serverless'
13444
13460
  import { drizzle } from 'drizzle-orm/neon-http'
@@ -13557,7 +13573,8 @@ var seedCommand = new Command2("seed").description("Create the initial admin use
13557
13573
  spinner3.start("Creating admin user...");
13558
13574
  try {
13559
13575
  const { execFileSync: execFileSync5 } = await import("child_process");
13560
- execFileSync5("npx", ["tsx", seedPath], {
13576
+ const tsxBin = path36.join(cwd, "node_modules", ".bin", "tsx");
13577
+ execFileSync5(tsxBin, [seedPath], {
13561
13578
  cwd,
13562
13579
  stdio: "pipe",
13563
13580
  env: {
@@ -13599,6 +13616,7 @@ var initCommand = new Command3("init").description("Scaffold CMS into a new or e
13599
13616
  let cwd = process.cwd();
13600
13617
  let project = detectProject(cwd);
13601
13618
  let pm = detectPackageManager(cwd);
13619
+ let isFreshProject = false;
13602
13620
  let srcDir;
13603
13621
  if (project.isExisting) {
13604
13622
  p4.log.info(`Existing Next.js project detected`);
@@ -13695,6 +13713,7 @@ var initCommand = new Command3("init").description("Scaffold CMS into a new or e
13695
13713
  }
13696
13714
  p4.log.success(`Created ${displayName} Next.js project`);
13697
13715
  project = detectProject(cwd);
13716
+ isFreshProject = true;
13698
13717
  }
13699
13718
  const features = options.yes ? { includeEmail: true, preset: options.preset } : await promptFeatures(options.preset);
13700
13719
  let databaseUrl;
@@ -13877,6 +13896,18 @@ var initCommand = new Command3("init").description("Scaffold CMS into a new or e
13877
13896
  forms: formNames
13878
13897
  });
13879
13898
  }
13899
+ if (isFreshProject) {
13900
+ try {
13901
+ execFileSync4("git", ["init"], { cwd, stdio: "pipe" });
13902
+ execFileSync4("git", ["add", "."], { cwd, stdio: "pipe" });
13903
+ execFileSync4("git", ["commit", "-m", "Initial commit from BetterStart"], {
13904
+ cwd,
13905
+ stdio: "pipe"
13906
+ });
13907
+ p4.log.success("Created initial git commit");
13908
+ } catch {
13909
+ }
13910
+ }
13880
13911
  const totalFiles = baseFiles.length + dbFiles.length + authFiles.length + compFiles.length + layoutFiles.length + apiFiles.length;
13881
13912
  const summaryLines = [
13882
13913
  `Preset: ${pc2.cyan(features.preset)}`,
@@ -13978,7 +14009,8 @@ async function runSeed(cwd, cmsDir, email, password3) {
13978
14009
  }
13979
14010
  fs32.writeFileSync(seedPath, buildSeedScript(), "utf-8");
13980
14011
  try {
13981
- execFileSync4("npx", ["tsx", seedPath], {
14012
+ const tsxBin = path37.join(cwd, "node_modules", ".bin", "tsx");
14013
+ execFileSync4(tsxBin, [seedPath], {
13982
14014
  cwd,
13983
14015
  stdio: "pipe",
13984
14016
  timeout: 3e4,
@@ -14000,7 +14032,8 @@ async function runSeed(cwd, cmsDir, email, password3) {
14000
14032
  }
14001
14033
  function runDrizzlePush(cwd) {
14002
14034
  return new Promise((resolve) => {
14003
- const child = spawn2("npx", ["drizzle-kit", "push", "--force"], {
14035
+ const drizzleBin = path37.join(cwd, "node_modules", ".bin", "drizzle-kit");
14036
+ const child = spawn2(drizzleBin, ["push", "--force"], {
14004
14037
  cwd,
14005
14038
  stdio: "pipe",
14006
14039
  env: { ...process.env }