@betterstart/cli 0.1.18 → 0.1.19

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
@@ -7721,8 +7721,9 @@ function runPostGenerate(cwd, schemaName, options = {}) {
7721
7721
  console.log(ok ? " Database schema synced" : " Database push failed (run db:push manually)");
7722
7722
  } else {
7723
7723
  console.log("\n Running drizzle-kit push...");
7724
+ const drizzleBin = path21.join(cwd, "node_modules", ".bin", "drizzle-kit");
7724
7725
  try {
7725
- execFileSync2("npx", ["drizzle-kit", "push"], { cwd, stdio: "pipe" });
7726
+ execFileSync2(drizzleBin, ["push", "--force"], { cwd, stdio: "pipe" });
7726
7727
  result.dbPush = "success";
7727
7728
  console.log(" Database schema synced");
7728
7729
  } catch {
@@ -7739,8 +7740,9 @@ function runPostGenerate(cwd, schemaName, options = {}) {
7739
7740
  result.lintFix = ok ? "success" : "failed";
7740
7741
  console.log(ok ? " Code formatted" : " Lint fix had issues (run lint:fix manually)");
7741
7742
  } else {
7743
+ const biomeBin = path21.join(cwd, "node_modules", ".bin", "biome");
7742
7744
  try {
7743
- execFileSync2("npx", ["biome", "check", "--write", "."], { cwd, stdio: "pipe" });
7745
+ execFileSync2(biomeBin, ["check", "--write", "."], { cwd, stdio: "pipe" });
7744
7746
  result.lintFix = "success";
7745
7747
  console.log(" Code formatted with Biome");
7746
7748
  } catch {
@@ -11446,10 +11448,25 @@ export default db
11446
11448
 
11447
11449
  // src/init/templates/db/drizzle-config.ts
11448
11450
  function drizzleConfigTemplate() {
11449
- return `import { loadEnvConfig } from '@next/env'
11451
+ return `import { readFileSync } from 'node:fs'
11452
+ import { resolve } from 'node:path'
11450
11453
  import { defineConfig } from 'drizzle-kit'
11451
11454
 
11452
- loadEnvConfig(process.cwd())
11455
+ // Load .env.local (avoids @next/env dependency for drizzle-kit)
11456
+ for (const envFile of ['.env.local', '.env']) {
11457
+ try {
11458
+ const content = readFileSync(resolve(process.cwd(), envFile), 'utf-8')
11459
+ for (const line of content.split('\\n')) {
11460
+ const trimmed = line.trim()
11461
+ if (!trimmed || trimmed.startsWith('#')) continue
11462
+ const eqIdx = trimmed.indexOf('=')
11463
+ if (eqIdx === -1) continue
11464
+ const key = trimmed.slice(0, eqIdx).trim()
11465
+ const val = trimmed.slice(eqIdx + 1).trim().replace(/^['"]|['"]$/g, '')
11466
+ if (!process.env[key]) process.env[key] = val
11467
+ }
11468
+ } catch {}
11469
+ }
11453
11470
 
11454
11471
  export default defineConfig({
11455
11472
  out: './cms/db/migrations',