@betterstart/cli 0.1.22 → 0.1.24
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 +62 -22
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
} from "./chunk-SAPJG4NO.js";
|
|
5
5
|
|
|
6
6
|
// src/cli.ts
|
|
7
|
-
import { Command as
|
|
7
|
+
import { Command as Command7 } from "commander";
|
|
8
8
|
|
|
9
9
|
// src/commands/generate.ts
|
|
10
10
|
import path22 from "path";
|
|
@@ -2758,11 +2758,11 @@ function generateActions(schema, cwd, actionsDir, options = {}) {
|
|
|
2758
2758
|
const listFieldsWithRels = findListFieldsWithRelationships(dbFields);
|
|
2759
2759
|
const hasListRels = listFieldsWithRels.length > 0;
|
|
2760
2760
|
const allListRelQueries = [];
|
|
2761
|
-
for (const { field: listField, path:
|
|
2761
|
+
for (const { field: listField, path: path41 } of listFieldsWithRels) {
|
|
2762
2762
|
const rels = (listField.fields || []).filter((f) => f.type === "relationship" && f.relationship);
|
|
2763
2763
|
for (const relField of rels) {
|
|
2764
2764
|
allListRelQueries.push({
|
|
2765
|
-
fieldPath:
|
|
2765
|
+
fieldPath: path41.join("_"),
|
|
2766
2766
|
relField,
|
|
2767
2767
|
relTable: toCamelCase3(relField.relationship),
|
|
2768
2768
|
listFieldName: listField.name
|
|
@@ -4679,7 +4679,9 @@ function mergeImports(content, requiredImports, needsSql) {
|
|
|
4679
4679
|
const drizzleOrmMatch = content.match(/import\s*\{([^}]*)\}\s*from\s*['"]drizzle-orm['"]/);
|
|
4680
4680
|
const existingDrizzleOrmImports = /* @__PURE__ */ new Set();
|
|
4681
4681
|
if (drizzleOrmMatch) {
|
|
4682
|
-
drizzleOrmMatch[1].split(",").map((i) => i.trim()).filter(Boolean).forEach((i) =>
|
|
4682
|
+
drizzleOrmMatch[1].split(",").map((i) => i.trim()).filter(Boolean).forEach((i) => {
|
|
4683
|
+
existingDrizzleOrmImports.add(i);
|
|
4684
|
+
});
|
|
4683
4685
|
}
|
|
4684
4686
|
const hasSqlImport = existingDrizzleOrmImports.has("sql");
|
|
4685
4687
|
const existing = /* @__PURE__ */ new Set();
|
|
@@ -7016,11 +7018,13 @@ export default async function ${PageName}Page() {
|
|
|
7016
7018
|
const data = await get${Singular}()
|
|
7017
7019
|
|
|
7018
7020
|
return (
|
|
7019
|
-
<div className="flex flex-col">
|
|
7020
|
-
<
|
|
7021
|
-
|
|
7022
|
-
<${Singular}Form initialData={data} />
|
|
7021
|
+
<div className="flex flex-col w-full pb-20">
|
|
7022
|
+
<div className="flex items-center justify-between bg-card px-6 py-4 border-b">
|
|
7023
|
+
<PageHeader title="${schema.label}" description="Manage ${schema.label.toLowerCase()}" />
|
|
7023
7024
|
</div>
|
|
7025
|
+
<main className="container mx-auto max-w-5xl p-6">
|
|
7026
|
+
<${Singular}Form initialData={data} />
|
|
7027
|
+
</main>
|
|
7024
7028
|
</div>
|
|
7025
7029
|
)
|
|
7026
7030
|
}
|
|
@@ -11671,6 +11675,8 @@ var CORE_DEPS = [
|
|
|
11671
11675
|
"input-otp",
|
|
11672
11676
|
"react-resizable-panels",
|
|
11673
11677
|
"recharts",
|
|
11678
|
+
"shadcn",
|
|
11679
|
+
"tw-animate-css",
|
|
11674
11680
|
"usehooks-ts",
|
|
11675
11681
|
"vaul"
|
|
11676
11682
|
];
|
|
@@ -13581,8 +13587,8 @@ var seedCommand = new Command2("seed").description("Create the initial admin use
|
|
|
13581
13587
|
fs31.mkdirSync(scriptsDir, { recursive: true });
|
|
13582
13588
|
}
|
|
13583
13589
|
fs31.writeFileSync(seedPath, buildSeedScript(), "utf-8");
|
|
13584
|
-
const
|
|
13585
|
-
|
|
13590
|
+
const spinner4 = clack.spinner();
|
|
13591
|
+
spinner4.start("Creating admin user...");
|
|
13586
13592
|
try {
|
|
13587
13593
|
const { execFileSync: execFileSync5 } = await import("child_process");
|
|
13588
13594
|
const tsxBin = path36.join(cwd, "node_modules", ".bin", "tsx");
|
|
@@ -13596,9 +13602,9 @@ var seedCommand = new Command2("seed").description("Create the initial admin use
|
|
|
13596
13602
|
SEED_NAME: name || "Admin"
|
|
13597
13603
|
}
|
|
13598
13604
|
});
|
|
13599
|
-
|
|
13605
|
+
spinner4.stop("Admin user created");
|
|
13600
13606
|
} catch (err) {
|
|
13601
|
-
|
|
13607
|
+
spinner4.stop("Failed to create admin user");
|
|
13602
13608
|
const errMsg = err instanceof Error ? err.message : String(err);
|
|
13603
13609
|
clack.log.error(errMsg);
|
|
13604
13610
|
clack.log.info("You can run the seed script manually:");
|
|
@@ -13901,6 +13907,7 @@ var initCommand = new Command3("init").description("Scaffold CMS into a new or e
|
|
|
13901
13907
|
p4.log.info(`You can run it manually: ${pc2.cyan("npx betterstart seed")}`);
|
|
13902
13908
|
}
|
|
13903
13909
|
}
|
|
13910
|
+
s.start("Generating documentation...");
|
|
13904
13911
|
{
|
|
13905
13912
|
const entityNames = [];
|
|
13906
13913
|
const formNames = [];
|
|
@@ -13922,7 +13929,9 @@ var initCommand = new Command3("init").description("Scaffold CMS into a new or e
|
|
|
13922
13929
|
forms: formNames
|
|
13923
13930
|
});
|
|
13924
13931
|
}
|
|
13932
|
+
s.stop("Generated CMS.md");
|
|
13925
13933
|
if (isFreshProject) {
|
|
13934
|
+
s.start("Creating initial git commit...");
|
|
13926
13935
|
try {
|
|
13927
13936
|
execFileSync4("git", ["init"], { cwd, stdio: "pipe" });
|
|
13928
13937
|
execFileSync4("git", ["add", "."], { cwd, stdio: "pipe" });
|
|
@@ -13930,8 +13939,9 @@ var initCommand = new Command3("init").description("Scaffold CMS into a new or e
|
|
|
13930
13939
|
cwd,
|
|
13931
13940
|
stdio: "pipe"
|
|
13932
13941
|
});
|
|
13933
|
-
|
|
13942
|
+
s.stop("Created initial git commit");
|
|
13934
13943
|
} catch {
|
|
13944
|
+
s.stop("Git commit skipped");
|
|
13935
13945
|
}
|
|
13936
13946
|
}
|
|
13937
13947
|
const totalFiles = baseFiles.length + dbFiles.length + authFiles.length + compFiles.length + layoutFiles.length + apiFiles.length;
|
|
@@ -14300,33 +14310,63 @@ var removeCommand = new Command4("remove").alias("rm").description("Remove all g
|
|
|
14300
14310
|
console.log("");
|
|
14301
14311
|
});
|
|
14302
14312
|
|
|
14303
|
-
// src/commands/update-
|
|
14304
|
-
import fs34 from "fs";
|
|
14313
|
+
// src/commands/update-deps.ts
|
|
14305
14314
|
import path39 from "path";
|
|
14306
14315
|
import * as clack2 from "@clack/prompts";
|
|
14307
14316
|
import { Command as Command5 } from "commander";
|
|
14308
|
-
var
|
|
14317
|
+
var updateDepsCommand = new Command5("update-deps").description("Install or update all CMS dependencies").option("--cwd <path>", "Project root path").action(async (options) => {
|
|
14309
14318
|
const cwd = options.cwd ? path39.resolve(options.cwd) : process.cwd();
|
|
14310
|
-
clack2.intro("BetterStart Update
|
|
14319
|
+
clack2.intro("BetterStart Update Dependencies");
|
|
14320
|
+
const pm = detectPackageManager(cwd);
|
|
14321
|
+
clack2.log.info(`Package manager: ${pm}`);
|
|
14322
|
+
const config = await resolveConfig(cwd);
|
|
14323
|
+
const includeEmail = config.features?.email ?? true;
|
|
14324
|
+
const s = clack2.spinner();
|
|
14325
|
+
s.start("Installing dependencies...");
|
|
14326
|
+
const result = await installDependenciesAsync({
|
|
14327
|
+
cwd,
|
|
14328
|
+
pm,
|
|
14329
|
+
includeEmail,
|
|
14330
|
+
includeBiome: false
|
|
14331
|
+
});
|
|
14332
|
+
if (result.success) {
|
|
14333
|
+
s.stop(`Installed ${result.coreDeps.length} deps + ${result.devDeps.length} dev deps`);
|
|
14334
|
+
} else {
|
|
14335
|
+
s.stop("Dependency install failed");
|
|
14336
|
+
clack2.log.error(result.error ?? "Unknown error");
|
|
14337
|
+
process.exit(1);
|
|
14338
|
+
}
|
|
14339
|
+
clack2.outro("Dependencies updated");
|
|
14340
|
+
});
|
|
14341
|
+
|
|
14342
|
+
// src/commands/update-styles.ts
|
|
14343
|
+
import fs34 from "fs";
|
|
14344
|
+
import path40 from "path";
|
|
14345
|
+
import * as clack3 from "@clack/prompts";
|
|
14346
|
+
import { Command as Command6 } from "commander";
|
|
14347
|
+
var updateStylesCommand = new Command6("update-styles").description("Replace cms-globals.css with the latest version from the CLI").option("--cwd <path>", "Project root path").action(async (options) => {
|
|
14348
|
+
const cwd = options.cwd ? path40.resolve(options.cwd) : process.cwd();
|
|
14349
|
+
clack3.intro("BetterStart Update Styles");
|
|
14311
14350
|
const config = await resolveConfig(cwd);
|
|
14312
14351
|
const cmsDir = config.paths?.cms ?? "./cms";
|
|
14313
|
-
const targetPath =
|
|
14352
|
+
const targetPath = path40.join(cwd, cmsDir, "cms-globals.css");
|
|
14314
14353
|
if (!fs34.existsSync(targetPath)) {
|
|
14315
|
-
|
|
14354
|
+
clack3.cancel(`cms-globals.css not found at ${path40.relative(cwd, targetPath)}`);
|
|
14316
14355
|
process.exit(1);
|
|
14317
14356
|
}
|
|
14318
14357
|
fs34.writeFileSync(targetPath, cmsGlobalsCssTemplate(), "utf-8");
|
|
14319
|
-
|
|
14320
|
-
|
|
14358
|
+
clack3.log.success(`Updated ${path40.relative(cwd, targetPath)}`);
|
|
14359
|
+
clack3.outro("Styles updated");
|
|
14321
14360
|
});
|
|
14322
14361
|
|
|
14323
14362
|
// src/cli.ts
|
|
14324
|
-
var program = new
|
|
14363
|
+
var program = new Command7();
|
|
14325
14364
|
program.name("betterstart").description("Scaffold a full-featured CMS into any Next.js 16 application").version("0.1.0");
|
|
14326
14365
|
program.addCommand(initCommand);
|
|
14327
14366
|
program.addCommand(generateCommand);
|
|
14328
14367
|
program.addCommand(removeCommand);
|
|
14329
14368
|
program.addCommand(seedCommand);
|
|
14369
|
+
program.addCommand(updateDepsCommand);
|
|
14330
14370
|
program.addCommand(updateStylesCommand);
|
|
14331
14371
|
program.parse();
|
|
14332
14372
|
//# sourceMappingURL=cli.js.map
|