@betterstart/cli 0.1.16 → 0.1.18
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 +43 -10
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -4672,7 +4672,12 @@ export const ${toCamelCase5(junctionName)} = pgTable(
|
|
|
4672
4672
|
}
|
|
4673
4673
|
function mergeImports(content, requiredImports, needsSql) {
|
|
4674
4674
|
const pgCoreMatch = content.match(/import\s+\{([^}]+)\}\s+from\s+['"]drizzle-orm\/pg-core['"]/);
|
|
4675
|
-
const
|
|
4675
|
+
const drizzleOrmMatch = content.match(/import\s*\{([^}]*)\}\s*from\s*['"]drizzle-orm['"]/);
|
|
4676
|
+
const existingDrizzleOrmImports = /* @__PURE__ */ new Set();
|
|
4677
|
+
if (drizzleOrmMatch) {
|
|
4678
|
+
drizzleOrmMatch[1].split(",").map((i) => i.trim()).filter(Boolean).forEach((i) => existingDrizzleOrmImports.add(i));
|
|
4679
|
+
}
|
|
4680
|
+
const hasSqlImport = existingDrizzleOrmImports.has("sql");
|
|
4676
4681
|
const existing = /* @__PURE__ */ new Set();
|
|
4677
4682
|
if (pgCoreMatch) {
|
|
4678
4683
|
pgCoreMatch[1].split(",").map((i) => i.trim()).filter(Boolean).forEach((i) => {
|
|
@@ -4687,9 +4692,9 @@ function mergeImports(content, requiredImports, needsSql) {
|
|
|
4687
4692
|
let updated = content;
|
|
4688
4693
|
if (pgCoreMatch) {
|
|
4689
4694
|
updated = updated.replace(/import\s+\{[^}]+\}\s+from\s+['"]drizzle-orm\/pg-core['"]/, newImport);
|
|
4690
|
-
} else if (
|
|
4695
|
+
} else if (drizzleOrmMatch) {
|
|
4691
4696
|
updated = updated.replace(
|
|
4692
|
-
/import\s
|
|
4697
|
+
/import\s*\{[^}]*\}\s*from\s*['"]drizzle-orm['"]/,
|
|
4693
4698
|
(match) => `${match}
|
|
4694
4699
|
${newImport}`
|
|
4695
4700
|
);
|
|
@@ -4698,8 +4703,17 @@ ${newImport}`
|
|
|
4698
4703
|
${updated}`;
|
|
4699
4704
|
}
|
|
4700
4705
|
if (needsSql && !hasSqlImport) {
|
|
4701
|
-
|
|
4706
|
+
if (drizzleOrmMatch) {
|
|
4707
|
+
existingDrizzleOrmImports.add("sql");
|
|
4708
|
+
const sortedOrm = Array.from(existingDrizzleOrmImports).sort();
|
|
4709
|
+
updated = updated.replace(
|
|
4710
|
+
/import\s*\{[^}]*\}\s*from\s*['"]drizzle-orm['"]/,
|
|
4711
|
+
`import { ${sortedOrm.join(", ")} } from 'drizzle-orm'`
|
|
4712
|
+
);
|
|
4713
|
+
} else {
|
|
4714
|
+
updated = `import { sql } from 'drizzle-orm'
|
|
4702
4715
|
${updated}`;
|
|
4716
|
+
}
|
|
4703
4717
|
}
|
|
4704
4718
|
return updated;
|
|
4705
4719
|
}
|
|
@@ -11663,7 +11677,7 @@ var CORE_DEPS = [
|
|
|
11663
11677
|
"vaul"
|
|
11664
11678
|
];
|
|
11665
11679
|
var EMAIL_DEPS = ["resend", "@react-email/components"];
|
|
11666
|
-
var DEV_DEPS = ["drizzle-kit", "sass", "@types/katex", "@types/markdown-it"];
|
|
11680
|
+
var DEV_DEPS = ["drizzle-kit", "tsx", "sass", "@types/katex", "@types/markdown-it"];
|
|
11667
11681
|
var BIOME_DEV_DEPS = ["@biomejs/biome"];
|
|
11668
11682
|
function buildAddArgs(pm, deps, dev) {
|
|
11669
11683
|
const devFlag = dev ? pm === "yarn" ? "--dev" : "-D" : "";
|
|
@@ -13437,8 +13451,24 @@ function buildSeedScript() {
|
|
|
13437
13451
|
* AUTO-GENERATED \u2014 safe to delete after running
|
|
13438
13452
|
*/
|
|
13439
13453
|
|
|
13440
|
-
import {
|
|
13441
|
-
|
|
13454
|
+
import { readFileSync } from 'node:fs'
|
|
13455
|
+
import { resolve } from 'node:path'
|
|
13456
|
+
|
|
13457
|
+
// Load .env.local (inline \u2014 avoids @next/env dependency)
|
|
13458
|
+
for (const envFile of ['.env.local', '.env']) {
|
|
13459
|
+
try {
|
|
13460
|
+
const content = readFileSync(resolve(process.cwd(), envFile), 'utf-8')
|
|
13461
|
+
for (const line of content.split('\\n')) {
|
|
13462
|
+
const trimmed = line.trim()
|
|
13463
|
+
if (!trimmed || trimmed.startsWith('#')) continue
|
|
13464
|
+
const eqIdx = trimmed.indexOf('=')
|
|
13465
|
+
if (eqIdx === -1) continue
|
|
13466
|
+
const key = trimmed.slice(0, eqIdx).trim()
|
|
13467
|
+
const val = trimmed.slice(eqIdx + 1).trim().replace(/^['"]|['"]$/g, '')
|
|
13468
|
+
if (!process.env[key]) process.env[key] = val
|
|
13469
|
+
}
|
|
13470
|
+
} catch {}
|
|
13471
|
+
}
|
|
13442
13472
|
|
|
13443
13473
|
import { neon } from '@neondatabase/serverless'
|
|
13444
13474
|
import { drizzle } from 'drizzle-orm/neon-http'
|
|
@@ -13557,7 +13587,8 @@ var seedCommand = new Command2("seed").description("Create the initial admin use
|
|
|
13557
13587
|
spinner3.start("Creating admin user...");
|
|
13558
13588
|
try {
|
|
13559
13589
|
const { execFileSync: execFileSync5 } = await import("child_process");
|
|
13560
|
-
|
|
13590
|
+
const tsxBin = path36.join(cwd, "node_modules", ".bin", "tsx");
|
|
13591
|
+
execFileSync5(tsxBin, [seedPath], {
|
|
13561
13592
|
cwd,
|
|
13562
13593
|
stdio: "pipe",
|
|
13563
13594
|
env: {
|
|
@@ -13992,7 +14023,8 @@ async function runSeed(cwd, cmsDir, email, password3) {
|
|
|
13992
14023
|
}
|
|
13993
14024
|
fs32.writeFileSync(seedPath, buildSeedScript(), "utf-8");
|
|
13994
14025
|
try {
|
|
13995
|
-
|
|
14026
|
+
const tsxBin = path37.join(cwd, "node_modules", ".bin", "tsx");
|
|
14027
|
+
execFileSync4(tsxBin, [seedPath], {
|
|
13996
14028
|
cwd,
|
|
13997
14029
|
stdio: "pipe",
|
|
13998
14030
|
timeout: 3e4,
|
|
@@ -14014,7 +14046,8 @@ async function runSeed(cwd, cmsDir, email, password3) {
|
|
|
14014
14046
|
}
|
|
14015
14047
|
function runDrizzlePush(cwd) {
|
|
14016
14048
|
return new Promise((resolve) => {
|
|
14017
|
-
const
|
|
14049
|
+
const drizzleBin = path37.join(cwd, "node_modules", ".bin", "drizzle-kit");
|
|
14050
|
+
const child = spawn2(drizzleBin, ["push", "--force"], {
|
|
14018
14051
|
cwd,
|
|
14019
14052
|
stdio: "pipe",
|
|
14020
14053
|
env: { ...process.env }
|