betterstart-cli 0.0.116 → 0.0.117
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/assets/adapters/next/templates/init/hooks/use-copy-to-clipboard.ts +1 -3
- package/dist/assets/adapters/next/templates/init/pages/container-layout.tsx +3 -0
- package/dist/assets/adapters/next/templates/init/pages/dashboard-page.tsx +78 -76
- package/dist/{chunk-SG4U6EQY.js → chunk-FGEVDA53.js} +3 -1
- package/dist/chunk-FGEVDA53.js.map +1 -0
- package/dist/cli.js +56 -38
- package/dist/cli.js.map +1 -1
- package/dist/{read-namespaced-template-D2CD4Q7U.js → read-namespaced-template-KUENIIDC.js} +2 -2
- package/package.json +1 -1
- package/dist/chunk-SG4U6EQY.js.map +0 -1
- /package/dist/{read-namespaced-template-D2CD4Q7U.js.map → read-namespaced-template-KUENIIDC.js.map} +0 -0
package/dist/cli.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
ACCEPT_TERMS_URL_PATTERN,
|
|
4
|
+
ADMIN_CONTAINER_ROUTE_GROUP,
|
|
4
5
|
BETTERSTART_ASSET_HOST,
|
|
5
6
|
BETTERSTART_DIR,
|
|
6
7
|
CLI_PACKAGE_NAME,
|
|
@@ -85,7 +86,7 @@ import {
|
|
|
85
86
|
trimDotSlash,
|
|
86
87
|
usesIdentifier,
|
|
87
88
|
validateAdminNamespace
|
|
88
|
-
} from "./chunk-
|
|
89
|
+
} from "./chunk-FGEVDA53.js";
|
|
89
90
|
|
|
90
91
|
// cli.ts
|
|
91
92
|
import * as p66 from "@clack/prompts";
|
|
@@ -263,6 +264,14 @@ function redirectStdoutToStderr() {
|
|
|
263
264
|
process.stdout.write = originalWrite;
|
|
264
265
|
};
|
|
265
266
|
}
|
|
267
|
+
function writeMachineJson(payload) {
|
|
268
|
+
process.stdout.write(`${JSON.stringify(payload, null, 2)}
|
|
269
|
+
`);
|
|
270
|
+
}
|
|
271
|
+
function writeDiagnostic(message) {
|
|
272
|
+
process.stderr.write(`${message}
|
|
273
|
+
`);
|
|
274
|
+
}
|
|
266
275
|
function renderTableRows(rows) {
|
|
267
276
|
const widths = [];
|
|
268
277
|
for (const row of rows) {
|
|
@@ -1933,6 +1942,7 @@ function resolveProjectPaths(config) {
|
|
|
1933
1942
|
const namespace = resolveAdminNamespace(config.frameworkConfig.next.namespace);
|
|
1934
1943
|
const adminDir = trimDotSlash(config.paths?.admin ?? "./admin");
|
|
1935
1944
|
const pagesDir = trimDotSlash(config.paths?.pages ?? "./src/app/(admin)/admin/(authenticated)");
|
|
1945
|
+
const containerDir = path6.posix.join(pagesDir, ADMIN_CONTAINER_ROUTE_GROUP);
|
|
1936
1946
|
const schemasDir = trimDotSlash(config.paths?.schemas ?? "./admin/schemas");
|
|
1937
1947
|
const adminDbDir = path6.posix.join(adminDir, "lib", "db");
|
|
1938
1948
|
const adminDbCoreDir = path6.posix.join(adminDbDir, "core");
|
|
@@ -1946,6 +1956,7 @@ function resolveProjectPaths(config) {
|
|
|
1946
1956
|
return {
|
|
1947
1957
|
adminDir,
|
|
1948
1958
|
pagesDir,
|
|
1959
|
+
containerDir,
|
|
1949
1960
|
schemasDir,
|
|
1950
1961
|
adminDbDir,
|
|
1951
1962
|
adminDbCoreDir,
|
|
@@ -9212,7 +9223,7 @@ function runFormPipeline(schema, cwd, config, options = {}) {
|
|
|
9212
9223
|
},
|
|
9213
9224
|
{
|
|
9214
9225
|
name: "Admin pages",
|
|
9215
|
-
run: () => generateFormAdminPages(schema, paths.
|
|
9226
|
+
run: () => generateFormAdminPages(schema, paths.containerDir, namespacedOptions).files
|
|
9216
9227
|
},
|
|
9217
9228
|
{
|
|
9218
9229
|
name: "Navigation",
|
|
@@ -21782,37 +21793,37 @@ function runEntityPipeline(schema, cwd, config, options = {}) {
|
|
|
21782
21793
|
},
|
|
21783
21794
|
{
|
|
21784
21795
|
name: "Column definitions",
|
|
21785
|
-
run: () => generateColumns2(normalizedSchema, paths.
|
|
21796
|
+
run: () => generateColumns2(normalizedSchema, paths.containerDir, namespacedOptions).files
|
|
21786
21797
|
},
|
|
21787
21798
|
{
|
|
21788
21799
|
name: "Table component",
|
|
21789
|
-
run: () => generateTable2(normalizedSchema, paths.
|
|
21800
|
+
run: () => generateTable2(normalizedSchema, paths.containerDir, namespacedOptions).files
|
|
21790
21801
|
},
|
|
21791
21802
|
{
|
|
21792
21803
|
name: "Page content",
|
|
21793
|
-
run: () => generatePageContent2(normalizedSchema, paths.
|
|
21804
|
+
run: () => generatePageContent2(normalizedSchema, paths.containerDir, namespacedOptions).files
|
|
21794
21805
|
},
|
|
21795
21806
|
{
|
|
21796
21807
|
name: "Page (server)",
|
|
21797
|
-
run: () => generatePage2(normalizedSchema, paths.
|
|
21808
|
+
run: () => generatePage2(normalizedSchema, paths.containerDir, namespacedOptions).files
|
|
21798
21809
|
}
|
|
21799
21810
|
];
|
|
21800
21811
|
if (normalizedSchema.actions?.create || normalizedSchema.actions?.edit) {
|
|
21801
21812
|
steps.push({
|
|
21802
21813
|
name: "Form",
|
|
21803
|
-
run: () => generateForm(normalizedSchema, paths.
|
|
21814
|
+
run: () => generateForm(normalizedSchema, paths.containerDir, namespacedOptions).files
|
|
21804
21815
|
});
|
|
21805
21816
|
}
|
|
21806
21817
|
if (normalizedSchema.actions?.create) {
|
|
21807
21818
|
steps.push({
|
|
21808
21819
|
name: "Create page",
|
|
21809
|
-
run: () => generateCreatePage(normalizedSchema, paths.
|
|
21820
|
+
run: () => generateCreatePage(normalizedSchema, paths.containerDir, namespacedOptions).files
|
|
21810
21821
|
});
|
|
21811
21822
|
}
|
|
21812
21823
|
if (normalizedSchema.actions?.edit) {
|
|
21813
21824
|
steps.push({
|
|
21814
21825
|
name: "Edit page",
|
|
21815
|
-
run: () => generateEditPage(normalizedSchema, paths.
|
|
21826
|
+
run: () => generateEditPage(normalizedSchema, paths.containerDir, namespacedOptions).files
|
|
21816
21827
|
});
|
|
21817
21828
|
}
|
|
21818
21829
|
steps.push({
|
|
@@ -23557,11 +23568,11 @@ function runSinglePipeline(schema, cwd, config, options = {}) {
|
|
|
23557
23568
|
},
|
|
23558
23569
|
{
|
|
23559
23570
|
name: "Form",
|
|
23560
|
-
run: () => generateSingleForm(normalizedSchema, paths.
|
|
23571
|
+
run: () => generateSingleForm(normalizedSchema, paths.containerDir, namespacedOptions).files
|
|
23561
23572
|
},
|
|
23562
23573
|
{
|
|
23563
23574
|
name: "Single page",
|
|
23564
|
-
run: () => generateSinglePage(normalizedSchema, paths.
|
|
23575
|
+
run: () => generateSinglePage(normalizedSchema, paths.containerDir, namespacedOptions).files
|
|
23565
23576
|
},
|
|
23566
23577
|
{
|
|
23567
23578
|
name: "Navigation",
|
|
@@ -24480,7 +24491,7 @@ async function maybeBuildRenamePlan(loaded, cwd, config, generatedFiles, options
|
|
|
24480
24491
|
plan.customCells.push(
|
|
24481
24492
|
buildCustomCellRenameSelection(
|
|
24482
24493
|
loaded.schema.name,
|
|
24483
|
-
paths.
|
|
24494
|
+
paths.containerDir,
|
|
24484
24495
|
candidate.before,
|
|
24485
24496
|
candidate.after
|
|
24486
24497
|
)
|
|
@@ -32231,7 +32242,9 @@ function scaffoldLayout({ cwd, config }) {
|
|
|
32231
32242
|
readTemplate("pages/reset-password-form.tsx")
|
|
32232
32243
|
);
|
|
32233
32244
|
write(path74.join(config.paths.pages, "page.tsx"), readTemplate("pages/dashboard-page.tsx"));
|
|
32234
|
-
const
|
|
32245
|
+
const containerDir = path74.join(config.paths.pages, ADMIN_CONTAINER_ROUTE_GROUP);
|
|
32246
|
+
write(path74.join(containerDir, "layout.tsx"), readTemplate("pages/container-layout.tsx"));
|
|
32247
|
+
const usersDir = path74.join(containerDir, "users");
|
|
32235
32248
|
write(path74.join(usersDir, "page.tsx"), readTemplate("pages/users/users-page.tsx"));
|
|
32236
32249
|
write(
|
|
32237
32250
|
path74.join(usersDir, "users-page-skeleton.tsx"),
|
|
@@ -32339,7 +32352,7 @@ function scaffoldLayout({ cwd, config }) {
|
|
|
32339
32352
|
path74.join(settingsWebhooksDir, "logs", "page.tsx"),
|
|
32340
32353
|
readTemplate("pages/settings/webhooks/webhooks-logs-page.tsx")
|
|
32341
32354
|
);
|
|
32342
|
-
const mediaDir = path74.join(
|
|
32355
|
+
const mediaDir = path74.join(containerDir, "media");
|
|
32343
32356
|
write(path74.join(mediaDir, "page.tsx"), readTemplate("pages/media/media-page.tsx"));
|
|
32344
32357
|
write(
|
|
32345
32358
|
path74.join(mediaDir, "media-page-skeleton.tsx"),
|
|
@@ -34634,7 +34647,7 @@ async function main() {
|
|
|
34634
34647
|
|
|
34635
34648
|
if (CHECK_ADMIN_ONLY) {
|
|
34636
34649
|
if (existingAdmin) {
|
|
34637
|
-
|
|
34650
|
+
process.stdout.write(\`EXISTING_ADMIN:\${JSON.stringify(existingAdmin)}\\n\`)
|
|
34638
34651
|
process.exit(3)
|
|
34639
34652
|
}
|
|
34640
34653
|
process.exit(0)
|
|
@@ -34645,7 +34658,7 @@ async function main() {
|
|
|
34645
34658
|
const NAME = process.env.SEED_NAME || 'Admin'
|
|
34646
34659
|
|
|
34647
34660
|
if (!EMAIL || !PASSWORD) {
|
|
34648
|
-
|
|
34661
|
+
process.stderr.write(' SEED_EMAIL and SEED_PASSWORD are required.\\n')
|
|
34649
34662
|
process.exit(1)
|
|
34650
34663
|
}
|
|
34651
34664
|
|
|
@@ -34660,15 +34673,15 @@ async function main() {
|
|
|
34660
34673
|
|
|
34661
34674
|
if (existingUser && !replaceTarget) {
|
|
34662
34675
|
// Exit code 2 signals "user exists" to the CLI
|
|
34663
|
-
|
|
34676
|
+
process.stdout.write(\`EXISTING_USER:\${existingUser.name}\\n\`)
|
|
34664
34677
|
process.exit(2)
|
|
34665
34678
|
}
|
|
34666
34679
|
|
|
34667
34680
|
if (replaceTarget) {
|
|
34668
|
-
|
|
34681
|
+
process.stdout.write(
|
|
34669
34682
|
OVERWRITE_MODE === 'admin'
|
|
34670
|
-
? '\\n Replacing existing admin user
|
|
34671
|
-
: '\\n Replacing existing account
|
|
34683
|
+
? '\\n Replacing existing admin user...\\n'
|
|
34684
|
+
: '\\n Replacing existing account...\\n'
|
|
34672
34685
|
)
|
|
34673
34686
|
await clearAuthorshipReferences(replaceTarget.id)
|
|
34674
34687
|
// Remove existing account + session rows first (foreign key refs)
|
|
@@ -34676,17 +34689,17 @@ async function main() {
|
|
|
34676
34689
|
await db.delete(schema.account).where(eq(schema.account.userId, replaceTarget.id))
|
|
34677
34690
|
await db.delete(schema.user).where(eq(schema.user.id, replaceTarget.id))
|
|
34678
34691
|
} else {
|
|
34679
|
-
|
|
34692
|
+
process.stdout.write('\\n Creating admin user...\\n')
|
|
34680
34693
|
}
|
|
34681
34694
|
|
|
34682
|
-
|
|
34695
|
+
process.stdout.write(\` Email: \${EMAIL}\\n\\n\`)
|
|
34683
34696
|
|
|
34684
34697
|
const result = await auth.api.signUpEmail({
|
|
34685
34698
|
body: { email: EMAIL, password: PASSWORD, name: NAME },
|
|
34686
34699
|
})
|
|
34687
34700
|
|
|
34688
34701
|
if (!result?.user) {
|
|
34689
|
-
|
|
34702
|
+
process.stderr.write(' Failed to create user.\\n')
|
|
34690
34703
|
process.exit(1)
|
|
34691
34704
|
}
|
|
34692
34705
|
|
|
@@ -34695,13 +34708,13 @@ async function main() {
|
|
|
34695
34708
|
.set({ role: 'admin' })
|
|
34696
34709
|
.where(eq(schema.user.id, result.user.id))
|
|
34697
34710
|
|
|
34698
|
-
|
|
34699
|
-
|
|
34711
|
+
process.stdout.write(\` Admin user \${replaceTarget ? 'replaced' : 'created'}: \${EMAIL}\\n\`)
|
|
34712
|
+
process.stdout.write(' Role: admin\\n\\n')
|
|
34700
34713
|
process.exit(0)
|
|
34701
34714
|
}
|
|
34702
34715
|
|
|
34703
34716
|
main().catch((err) => {
|
|
34704
|
-
|
|
34717
|
+
process.stderr.write(\` Seed failed: \${err.message || err}\\n\`)
|
|
34705
34718
|
process.exit(1)
|
|
34706
34719
|
})
|
|
34707
34720
|
`;
|
|
@@ -35223,7 +35236,7 @@ function writeInitJson(context, payload) {
|
|
|
35223
35236
|
context.restoreStdout?.();
|
|
35224
35237
|
context.restoreStdout = void 0;
|
|
35225
35238
|
context.written = true;
|
|
35226
|
-
|
|
35239
|
+
writeMachineJson(payload);
|
|
35227
35240
|
}
|
|
35228
35241
|
|
|
35229
35242
|
// adapters/next/commands/init/run-init-command-internal.ts
|
|
@@ -35763,7 +35776,7 @@ async function runInitCommandInternal(name, options, jsonContext) {
|
|
|
35763
35776
|
const drizzleConfigPath = path92.join(cwd, "drizzle.config.ts");
|
|
35764
35777
|
if (!dbFiles.includes("drizzle.config.ts") && fs79.existsSync(drizzleConfigPath)) {
|
|
35765
35778
|
if (forceMode) {
|
|
35766
|
-
const { readNamespacedTemplate } = await import("./read-namespaced-template-
|
|
35779
|
+
const { readNamespacedTemplate } = await import("./read-namespaced-template-KUENIIDC.js");
|
|
35767
35780
|
fs79.writeFileSync(
|
|
35768
35781
|
drizzleConfigPath,
|
|
35769
35782
|
readNamespacedTemplate("drizzle.config.ts", namespace),
|
|
@@ -35776,7 +35789,7 @@ async function runInitCommandInternal(name, options, jsonContext) {
|
|
|
35776
35789
|
initialValue: true
|
|
35777
35790
|
});
|
|
35778
35791
|
if (!p61.isCancel(overwrite) && overwrite) {
|
|
35779
|
-
const { readNamespacedTemplate } = await import("./read-namespaced-template-
|
|
35792
|
+
const { readNamespacedTemplate } = await import("./read-namespaced-template-KUENIIDC.js");
|
|
35780
35793
|
fs79.writeFileSync(
|
|
35781
35794
|
drizzleConfigPath,
|
|
35782
35795
|
readNamespacedTemplate("drizzle.config.ts", namespace),
|
|
@@ -36209,7 +36222,7 @@ async function runListIntegrationsCommand(options) {
|
|
|
36209
36222
|
try {
|
|
36210
36223
|
installed2 = new Set((await resolveConfig(cwd)).integrations.installed);
|
|
36211
36224
|
} catch (error) {
|
|
36212
|
-
|
|
36225
|
+
writeDiagnostic(
|
|
36213
36226
|
`Error loading config: ${error instanceof Error ? error.message : String(error)}`
|
|
36214
36227
|
);
|
|
36215
36228
|
process.exit(1);
|
|
@@ -36220,7 +36233,7 @@ async function runListIntegrationsCommand(options) {
|
|
|
36220
36233
|
kind: integration.kind,
|
|
36221
36234
|
description: integration.description
|
|
36222
36235
|
}));
|
|
36223
|
-
|
|
36236
|
+
writeMachineJson(items);
|
|
36224
36237
|
return;
|
|
36225
36238
|
}
|
|
36226
36239
|
const config = await resolveConfigOrExit(cwd);
|
|
@@ -36254,7 +36267,7 @@ async function runListPresetsCommand(options) {
|
|
|
36254
36267
|
try {
|
|
36255
36268
|
installed2 = new Set((await resolveConfig(cwd)).presets.installed);
|
|
36256
36269
|
} catch (error) {
|
|
36257
|
-
|
|
36270
|
+
writeDiagnostic(
|
|
36258
36271
|
`Error loading config: ${error instanceof Error ? error.message : String(error)}`
|
|
36259
36272
|
);
|
|
36260
36273
|
process.exit(1);
|
|
@@ -36265,7 +36278,7 @@ async function runListPresetsCommand(options) {
|
|
|
36265
36278
|
kind: preset.kind,
|
|
36266
36279
|
description: preset.description
|
|
36267
36280
|
}));
|
|
36268
|
-
|
|
36281
|
+
writeMachineJson(items);
|
|
36269
36282
|
return;
|
|
36270
36283
|
}
|
|
36271
36284
|
const config = await resolveConfigOrExit(cwd);
|
|
@@ -38001,6 +38014,11 @@ var TEMPLATE_REGISTRY = {
|
|
|
38001
38014
|
base: "cwd",
|
|
38002
38015
|
dependencies: ["auth-gate"]
|
|
38003
38016
|
},
|
|
38017
|
+
"container-layout": {
|
|
38018
|
+
relPath: "app/(admin)/admin/(authenticated)/(container)/layout.tsx",
|
|
38019
|
+
content: () => readTemplate("pages/container-layout.tsx"),
|
|
38020
|
+
base: "cwd"
|
|
38021
|
+
},
|
|
38004
38022
|
"auth-gate": {
|
|
38005
38023
|
relPath: "app/(admin)/admin/(authenticated)/auth-gate.tsx",
|
|
38006
38024
|
content: () => readTemplate("pages/auth-gate.tsx"),
|
|
@@ -39166,15 +39184,15 @@ async function runRemoveSchemaCommand(schemaName, options) {
|
|
|
39166
39184
|
if (removePath(cwd, `${paths.adminActionsDir}/${schemaName}`)) {
|
|
39167
39185
|
deletedPaths.push(`${paths.adminActionsDir}/${schemaName}`);
|
|
39168
39186
|
}
|
|
39169
|
-
if (removePath(cwd, `${paths.
|
|
39170
|
-
deletedPaths.push(`${paths.
|
|
39187
|
+
if (removePath(cwd, `${paths.containerDir}/forms/${kebabName}`)) {
|
|
39188
|
+
deletedPaths.push(`${paths.containerDir}/forms/${kebabName}`);
|
|
39171
39189
|
}
|
|
39172
39190
|
} else {
|
|
39173
39191
|
if (removePath(cwd, `${paths.adminActionsDir}/${schemaName}`)) {
|
|
39174
39192
|
deletedPaths.push(`${paths.adminActionsDir}/${schemaName}`);
|
|
39175
39193
|
}
|
|
39176
|
-
if (removePath(cwd, `${paths.
|
|
39177
|
-
deletedPaths.push(`${paths.
|
|
39194
|
+
if (removePath(cwd, `${paths.containerDir}/${schemaName}`)) {
|
|
39195
|
+
deletedPaths.push(`${paths.containerDir}/${schemaName}`);
|
|
39178
39196
|
}
|
|
39179
39197
|
}
|
|
39180
39198
|
cleanupSchemaEmptyDirs(cwd, deletedPaths, paths);
|
|
@@ -40471,7 +40489,7 @@ async function runUpdateCommand(components, options) {
|
|
|
40471
40489
|
...templateKeys.map((name) => ({ name, path: templatePath(name), kind: "template" })),
|
|
40472
40490
|
{ name: "tiptap", path: "components/custom/content-editor/tiptap-*/", kind: "special" }
|
|
40473
40491
|
];
|
|
40474
|
-
|
|
40492
|
+
writeMachineJson(items);
|
|
40475
40493
|
return;
|
|
40476
40494
|
}
|
|
40477
40495
|
const all = getAllComponentNames();
|