@betterstart/cli 0.1.21 → 0.1.23
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 +48 -16
- 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
|
|
@@ -11671,6 +11671,8 @@ var CORE_DEPS = [
|
|
|
11671
11671
|
"input-otp",
|
|
11672
11672
|
"react-resizable-panels",
|
|
11673
11673
|
"recharts",
|
|
11674
|
+
"shadcn",
|
|
11675
|
+
"tw-animate-css",
|
|
11674
11676
|
"usehooks-ts",
|
|
11675
11677
|
"vaul"
|
|
11676
11678
|
];
|
|
@@ -13581,8 +13583,8 @@ var seedCommand = new Command2("seed").description("Create the initial admin use
|
|
|
13581
13583
|
fs31.mkdirSync(scriptsDir, { recursive: true });
|
|
13582
13584
|
}
|
|
13583
13585
|
fs31.writeFileSync(seedPath, buildSeedScript(), "utf-8");
|
|
13584
|
-
const
|
|
13585
|
-
|
|
13586
|
+
const spinner4 = clack.spinner();
|
|
13587
|
+
spinner4.start("Creating admin user...");
|
|
13586
13588
|
try {
|
|
13587
13589
|
const { execFileSync: execFileSync5 } = await import("child_process");
|
|
13588
13590
|
const tsxBin = path36.join(cwd, "node_modules", ".bin", "tsx");
|
|
@@ -13596,9 +13598,9 @@ var seedCommand = new Command2("seed").description("Create the initial admin use
|
|
|
13596
13598
|
SEED_NAME: name || "Admin"
|
|
13597
13599
|
}
|
|
13598
13600
|
});
|
|
13599
|
-
|
|
13601
|
+
spinner4.stop("Admin user created");
|
|
13600
13602
|
} catch (err) {
|
|
13601
|
-
|
|
13603
|
+
spinner4.stop("Failed to create admin user");
|
|
13602
13604
|
const errMsg = err instanceof Error ? err.message : String(err);
|
|
13603
13605
|
clack.log.error(errMsg);
|
|
13604
13606
|
clack.log.info("You can run the seed script manually:");
|
|
@@ -14300,33 +14302,63 @@ var removeCommand = new Command4("remove").alias("rm").description("Remove all g
|
|
|
14300
14302
|
console.log("");
|
|
14301
14303
|
});
|
|
14302
14304
|
|
|
14303
|
-
// src/commands/update-
|
|
14304
|
-
import fs34 from "fs";
|
|
14305
|
+
// src/commands/update-deps.ts
|
|
14305
14306
|
import path39 from "path";
|
|
14306
14307
|
import * as clack2 from "@clack/prompts";
|
|
14307
14308
|
import { Command as Command5 } from "commander";
|
|
14308
|
-
var
|
|
14309
|
+
var updateDepsCommand = new Command5("update-deps").description("Install or update all CMS dependencies").option("--cwd <path>", "Project root path").action(async (options) => {
|
|
14309
14310
|
const cwd = options.cwd ? path39.resolve(options.cwd) : process.cwd();
|
|
14310
|
-
clack2.intro("BetterStart Update
|
|
14311
|
+
clack2.intro("BetterStart Update Dependencies");
|
|
14312
|
+
const pm = detectPackageManager(cwd);
|
|
14313
|
+
clack2.log.info(`Package manager: ${pm}`);
|
|
14314
|
+
const config = await resolveConfig(cwd);
|
|
14315
|
+
const includeEmail = config.features?.email ?? true;
|
|
14316
|
+
const s = clack2.spinner();
|
|
14317
|
+
s.start("Installing dependencies...");
|
|
14318
|
+
const result = await installDependenciesAsync({
|
|
14319
|
+
cwd,
|
|
14320
|
+
pm,
|
|
14321
|
+
includeEmail,
|
|
14322
|
+
includeBiome: false
|
|
14323
|
+
});
|
|
14324
|
+
if (result.success) {
|
|
14325
|
+
s.stop(`Installed ${result.coreDeps.length} deps + ${result.devDeps.length} dev deps`);
|
|
14326
|
+
} else {
|
|
14327
|
+
s.stop("Dependency install failed");
|
|
14328
|
+
clack2.log.error(result.error ?? "Unknown error");
|
|
14329
|
+
process.exit(1);
|
|
14330
|
+
}
|
|
14331
|
+
clack2.outro("Dependencies updated");
|
|
14332
|
+
});
|
|
14333
|
+
|
|
14334
|
+
// src/commands/update-styles.ts
|
|
14335
|
+
import fs34 from "fs";
|
|
14336
|
+
import path40 from "path";
|
|
14337
|
+
import * as clack3 from "@clack/prompts";
|
|
14338
|
+
import { Command as Command6 } from "commander";
|
|
14339
|
+
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) => {
|
|
14340
|
+
const cwd = options.cwd ? path40.resolve(options.cwd) : process.cwd();
|
|
14341
|
+
clack3.intro("BetterStart Update Styles");
|
|
14311
14342
|
const config = await resolveConfig(cwd);
|
|
14312
14343
|
const cmsDir = config.paths?.cms ?? "./cms";
|
|
14313
|
-
const targetPath =
|
|
14344
|
+
const targetPath = path40.join(cwd, cmsDir, "cms-globals.css");
|
|
14314
14345
|
if (!fs34.existsSync(targetPath)) {
|
|
14315
|
-
|
|
14346
|
+
clack3.cancel(`cms-globals.css not found at ${path40.relative(cwd, targetPath)}`);
|
|
14316
14347
|
process.exit(1);
|
|
14317
14348
|
}
|
|
14318
14349
|
fs34.writeFileSync(targetPath, cmsGlobalsCssTemplate(), "utf-8");
|
|
14319
|
-
|
|
14320
|
-
|
|
14350
|
+
clack3.log.success(`Updated ${path40.relative(cwd, targetPath)}`);
|
|
14351
|
+
clack3.outro("Styles updated");
|
|
14321
14352
|
});
|
|
14322
14353
|
|
|
14323
14354
|
// src/cli.ts
|
|
14324
|
-
var program = new
|
|
14355
|
+
var program = new Command7();
|
|
14325
14356
|
program.name("betterstart").description("Scaffold a full-featured CMS into any Next.js 16 application").version("0.1.0");
|
|
14326
14357
|
program.addCommand(initCommand);
|
|
14327
14358
|
program.addCommand(generateCommand);
|
|
14328
14359
|
program.addCommand(removeCommand);
|
|
14329
14360
|
program.addCommand(seedCommand);
|
|
14361
|
+
program.addCommand(updateDepsCommand);
|
|
14330
14362
|
program.addCommand(updateStylesCommand);
|
|
14331
14363
|
program.parse();
|
|
14332
14364
|
//# sourceMappingURL=cli.js.map
|