betterstart-cli 0.0.113 → 0.0.115
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/lib/db/core/schema.ts +3 -0
- package/dist/assets/adapters/next/templates/init/proxy.ts +21 -0
- package/dist/{chunk-PSDUGFMD.js → chunk-SG4U6EQY.js} +14 -1
- package/dist/chunk-SG4U6EQY.js.map +1 -0
- package/dist/cli.js +330 -295
- package/dist/cli.js.map +1 -1
- package/dist/{read-namespaced-template-TSATYQPP.js → read-namespaced-template-D2CD4Q7U.js} +2 -2
- package/package.json +2 -1
- package/dist/chunk-PSDUGFMD.js.map +0 -1
- /package/dist/{read-namespaced-template-TSATYQPP.js.map → read-namespaced-template-D2CD4Q7U.js.map} +0 -0
package/dist/cli.js
CHANGED
|
@@ -18,6 +18,8 @@ import {
|
|
|
18
18
|
LOCAL_PROTOCOL_PATTERN,
|
|
19
19
|
LOCKFILE_MAP,
|
|
20
20
|
MAIN_CSS_CANDIDATES,
|
|
21
|
+
PROXY_CONVENTION_FILE_NAMES,
|
|
22
|
+
PROXY_FILE_NAME,
|
|
21
23
|
R2_ENV_KEYS,
|
|
22
24
|
RAILWAY_BUCKET_ENV_KEYS,
|
|
23
25
|
REDACTED,
|
|
@@ -83,7 +85,7 @@ import {
|
|
|
83
85
|
trimDotSlash,
|
|
84
86
|
usesIdentifier,
|
|
85
87
|
validateAdminNamespace
|
|
86
|
-
} from "./chunk-
|
|
88
|
+
} from "./chunk-SG4U6EQY.js";
|
|
87
89
|
|
|
88
90
|
// cli.ts
|
|
89
91
|
import * as p66 from "@clack/prompts";
|
|
@@ -1227,31 +1229,31 @@ function collectInvalidSchemaFieldTypeErrors(fields, errors) {
|
|
|
1227
1229
|
}
|
|
1228
1230
|
|
|
1229
1231
|
// core-engine/schema/schema-reader/collect-slot-area-errors.ts
|
|
1230
|
-
function collectSlotAreaErrors(value,
|
|
1232
|
+
function collectSlotAreaErrors(value, path113, errors) {
|
|
1231
1233
|
if (!isRecord(value)) {
|
|
1232
|
-
errors.push(`${
|
|
1234
|
+
errors.push(`${path113} must be an object with a "fields" array.`);
|
|
1233
1235
|
return;
|
|
1234
1236
|
}
|
|
1235
1237
|
const fields = value.fields;
|
|
1236
1238
|
if (!Array.isArray(fields)) {
|
|
1237
|
-
errors.push(`${
|
|
1239
|
+
errors.push(`${path113}.fields must be an array.`);
|
|
1238
1240
|
return;
|
|
1239
1241
|
}
|
|
1240
1242
|
for (const field of fields) {
|
|
1241
|
-
walkSlot(field, `${
|
|
1243
|
+
walkSlot(field, `${path113}.fields.${field.name ?? "unnamed"}`, errors);
|
|
1242
1244
|
}
|
|
1243
1245
|
}
|
|
1244
1246
|
|
|
1245
1247
|
// core-engine/schema/schema-reader/collect-slot-layout-errors.ts
|
|
1246
|
-
function collectSlotLayoutErrors(value,
|
|
1248
|
+
function collectSlotLayoutErrors(value, path113, errors) {
|
|
1247
1249
|
if (!isRecord(value)) {
|
|
1248
|
-
errors.push(`${
|
|
1250
|
+
errors.push(`${path113} must be an object with "main" and/or "sidebar" field groups.`);
|
|
1249
1251
|
return;
|
|
1250
1252
|
}
|
|
1251
1253
|
const validKeys = /* @__PURE__ */ new Set(["main", "sidebar"]);
|
|
1252
1254
|
for (const key of Object.keys(value)) {
|
|
1253
1255
|
if (!validKeys.has(key)) {
|
|
1254
|
-
errors.push(`${
|
|
1256
|
+
errors.push(`${path113} has unsupported key "${key}". Expected "main" or "sidebar".`);
|
|
1255
1257
|
}
|
|
1256
1258
|
}
|
|
1257
1259
|
const areas = [
|
|
@@ -1262,10 +1264,10 @@ function collectSlotLayoutErrors(value, path112, errors) {
|
|
|
1262
1264
|
for (const [name, area] of areas) {
|
|
1263
1265
|
if (area === void 0) continue;
|
|
1264
1266
|
hasArea = true;
|
|
1265
|
-
collectSlotAreaErrors(area, `${
|
|
1267
|
+
collectSlotAreaErrors(area, `${path113}.${name}`, errors);
|
|
1266
1268
|
}
|
|
1267
1269
|
if (!hasArea) {
|
|
1268
|
-
errors.push(`${
|
|
1270
|
+
errors.push(`${path113} must define at least one of "main" or "sidebar".`);
|
|
1269
1271
|
}
|
|
1270
1272
|
}
|
|
1271
1273
|
|
|
@@ -3707,7 +3709,7 @@ function buildEditsForSourceFile(sourceFile, filePath, plan) {
|
|
|
3707
3709
|
}
|
|
3708
3710
|
|
|
3709
3711
|
// core-engine/snapshots/ast-substitution/collect-preview-changes.ts
|
|
3710
|
-
function collectPreviewChanges(
|
|
3712
|
+
function collectPreviewChanges(path113, beforeContent, afterContent) {
|
|
3711
3713
|
const beforeLines = beforeContent.split("\n");
|
|
3712
3714
|
const afterLines = afterContent.split("\n");
|
|
3713
3715
|
const maxLength = Math.max(beforeLines.length, afterLines.length);
|
|
@@ -3719,7 +3721,7 @@ function collectPreviewChanges(path112, beforeContent, afterContent) {
|
|
|
3719
3721
|
continue;
|
|
3720
3722
|
}
|
|
3721
3723
|
changes.push({
|
|
3722
|
-
path:
|
|
3724
|
+
path: path113,
|
|
3723
3725
|
line: index + 1,
|
|
3724
3726
|
before: before.trim(),
|
|
3725
3727
|
after: after.trim()
|
|
@@ -12350,9 +12352,9 @@ ${mappings}
|
|
|
12350
12352
|
}
|
|
12351
12353
|
|
|
12352
12354
|
// adapters/next/generators/actions/action-helpers/collect-read-select-fields.ts
|
|
12353
|
-
function collectReadSelectFields(fields,
|
|
12355
|
+
function collectReadSelectFields(fields, path113 = []) {
|
|
12354
12356
|
const matches = fields.flatMap((field) => {
|
|
12355
|
-
const currentPath = [...
|
|
12357
|
+
const currentPath = [...path113, field.name];
|
|
12356
12358
|
const matches2 = field.type === "select" ? [{ field, path: currentPath }] : [];
|
|
12357
12359
|
if (field.fields) {
|
|
12358
12360
|
matches2.push(...collectReadSelectFields(field.fields, currentPath));
|
|
@@ -17205,16 +17207,16 @@ function renderNestedFieldRenderer(request) {
|
|
|
17205
17207
|
}
|
|
17206
17208
|
|
|
17207
17209
|
// adapters/next/generators/form/field-jsx-nested/path-expression.ts
|
|
17208
|
-
function pathExpression(
|
|
17209
|
-
return `\`${
|
|
17210
|
+
function pathExpression(path113) {
|
|
17211
|
+
return `\`${path113.map((part) => typeof part === "string" ? part : `\${${part.expression}}`).join(".")}\``;
|
|
17210
17212
|
}
|
|
17211
17213
|
|
|
17212
17214
|
// adapters/next/generators/form/field-jsx-nested/path-name-prop.ts
|
|
17213
|
-
function pathNameProp(
|
|
17214
|
-
if (
|
|
17215
|
-
return `"${
|
|
17215
|
+
function pathNameProp(path113) {
|
|
17216
|
+
if (path113.every((part) => typeof part === "string")) {
|
|
17217
|
+
return `"${path113.map((part) => part).join(".")}"`;
|
|
17216
17218
|
}
|
|
17217
|
-
return `{${pathExpression(
|
|
17219
|
+
return `{${pathExpression(path113)}}`;
|
|
17218
17220
|
}
|
|
17219
17221
|
|
|
17220
17222
|
// adapters/next/templates/renderers/generators/form/field-jsx-nested/render-nested-object-list-field.ts
|
|
@@ -17272,17 +17274,17 @@ function renderNestedObjectListFieldRenderer(request) {
|
|
|
17272
17274
|
function requiredLeafPaths(fields, prefix = []) {
|
|
17273
17275
|
return fields.flatMap((field) => {
|
|
17274
17276
|
if (field.hidden) return [];
|
|
17275
|
-
const
|
|
17277
|
+
const path113 = [...prefix, field.name];
|
|
17276
17278
|
if ((field.type === "group" || field.type === "section") && field.fields?.length) {
|
|
17277
|
-
return requiredLeafPaths(field.fields,
|
|
17279
|
+
return requiredLeafPaths(field.fields, path113);
|
|
17278
17280
|
}
|
|
17279
|
-
if (field.required) return [
|
|
17281
|
+
if (field.required) return [path113.join(".")];
|
|
17280
17282
|
return [];
|
|
17281
17283
|
});
|
|
17282
17284
|
}
|
|
17283
17285
|
|
|
17284
17286
|
// adapters/next/generators/form/field-jsx-nested/render-nested-object-list-field.ts
|
|
17285
|
-
function renderNestedObjectListField(field, indent, label,
|
|
17287
|
+
function renderNestedObjectListField(field, indent, label, path113, depth) {
|
|
17286
17288
|
const singularLabel = singularize(label);
|
|
17287
17289
|
const itemIndexVar = `${safeIdentifier(field.name, "nestedList")}Index${depth}`;
|
|
17288
17290
|
const titlePath = findTitlePath(field.fields ?? []);
|
|
@@ -17292,7 +17294,7 @@ function renderNestedObjectListField(field, indent, label, path112, depth) {
|
|
|
17292
17294
|
props: {
|
|
17293
17295
|
indent,
|
|
17294
17296
|
itemIndexVar,
|
|
17295
|
-
pathString:
|
|
17297
|
+
pathString: path113.map((part) => typeof part === "string" ? part : `\${${part.expression}}`).join("."),
|
|
17296
17298
|
titlePathSuffix,
|
|
17297
17299
|
singularLabel
|
|
17298
17300
|
}
|
|
@@ -17301,7 +17303,7 @@ function renderNestedObjectListField(field, indent, label, path112, depth) {
|
|
|
17301
17303
|
(child) => renderNestedField(
|
|
17302
17304
|
child,
|
|
17303
17305
|
`${indent} `,
|
|
17304
|
-
[...
|
|
17306
|
+
[...path113, { expression: itemIndexVar }, child.name],
|
|
17305
17307
|
depth + 1
|
|
17306
17308
|
)
|
|
17307
17309
|
).filter(Boolean).join("\n");
|
|
@@ -17319,7 +17321,7 @@ ${indent} validatePaths={${JSON.stringify(validatePaths)}}` : "";
|
|
|
17319
17321
|
kind: "renderNestedObjectListFieldNestedObjectListFieldTemplate",
|
|
17320
17322
|
props: {
|
|
17321
17323
|
indent,
|
|
17322
|
-
pathExpression: pathExpression(
|
|
17324
|
+
pathExpression: pathExpression(path113),
|
|
17323
17325
|
stringify: JSON.stringify(label),
|
|
17324
17326
|
stringifySerializedValue: JSON.stringify(singularLabel),
|
|
17325
17327
|
defaultItem,
|
|
@@ -17358,10 +17360,10 @@ ${indent}/>`;
|
|
|
17358
17360
|
}
|
|
17359
17361
|
|
|
17360
17362
|
// adapters/next/generators/form/field-jsx-nested/render-text-input-field.ts
|
|
17361
|
-
function renderTextInputField(field, indent, label, nestedHint,
|
|
17363
|
+
function renderTextInputField(field, indent, label, nestedHint, path113) {
|
|
17362
17364
|
return renderTextInputFieldFormFieldTemplate({
|
|
17363
17365
|
indent,
|
|
17364
|
-
pathNameProp: pathNameProp(
|
|
17366
|
+
pathNameProp: pathNameProp(path113),
|
|
17365
17367
|
formItemProps: formItemProps(field),
|
|
17366
17368
|
labelWithDescription: labelWithDescription(
|
|
17367
17369
|
formLabel(field, label),
|
|
@@ -17373,11 +17375,11 @@ function renderTextInputField(field, indent, label, nestedHint, path112) {
|
|
|
17373
17375
|
}
|
|
17374
17376
|
|
|
17375
17377
|
// adapters/next/generators/form/field-jsx-nested/render-nested-field.ts
|
|
17376
|
-
function renderNestedField(field, indent,
|
|
17378
|
+
function renderNestedField(field, indent, path113, depth) {
|
|
17377
17379
|
const nestedLabel = field.label || field.name;
|
|
17378
17380
|
const nestedHint = field.hint ? `<FormDescription>${field.hint}</FormDescription>` : "";
|
|
17379
17381
|
if ((field.type === "group" || field.type === "section") && field.fields?.length) {
|
|
17380
|
-
const groupFields = field.fields.map((child) => renderNestedField(child, `${indent} `, [...
|
|
17382
|
+
const groupFields = field.fields.map((child) => renderNestedField(child, `${indent} `, [...path113, child.name], depth)).filter(Boolean).join("\n");
|
|
17381
17383
|
if (!groupFields) return "";
|
|
17382
17384
|
const heading = nestedLabel && nestedLabel !== field.name ? `${indent}<h3 className="text-base font-medium">${nestedLabel}</h3>
|
|
17383
17385
|
` : "";
|
|
@@ -17393,7 +17395,7 @@ function renderNestedField(field, indent, path112, depth) {
|
|
|
17393
17395
|
});
|
|
17394
17396
|
}
|
|
17395
17397
|
if (field.type === "list" && field.fields?.length) {
|
|
17396
|
-
return renderNestedObjectListField(field, indent, nestedLabel,
|
|
17398
|
+
return renderNestedObjectListField(field, indent, nestedLabel, path113, depth);
|
|
17397
17399
|
}
|
|
17398
17400
|
if (field.type === "list") {
|
|
17399
17401
|
const hideLabelProp = field.label ? "" : `
|
|
@@ -17404,7 +17406,7 @@ ${indent} description={${JSON.stringify(field.hint)}}` : "";
|
|
|
17404
17406
|
kind: "renderNestedFieldDynamicListFieldTemplate",
|
|
17405
17407
|
props: {
|
|
17406
17408
|
indent,
|
|
17407
|
-
pathExpression: pathExpression(
|
|
17409
|
+
pathExpression: pathExpression(path113),
|
|
17408
17410
|
nestedLabel,
|
|
17409
17411
|
hideLabelProp,
|
|
17410
17412
|
descriptionProp,
|
|
@@ -17418,7 +17420,7 @@ ${indent} maxItems={${field.maxItems}}` : ""
|
|
|
17418
17420
|
kind: "renderNestedFieldFormFieldTemplate",
|
|
17419
17421
|
props: {
|
|
17420
17422
|
indent,
|
|
17421
|
-
pathNameProp: pathNameProp(
|
|
17423
|
+
pathNameProp: pathNameProp(path113),
|
|
17422
17424
|
formItemProps: formItemProps(field, "flex flex-row items-start space-x-3 space-y-0"),
|
|
17423
17425
|
labelWithDescription: labelWithDescription(
|
|
17424
17426
|
`<FormLabel>${nestedLabel}</FormLabel>`,
|
|
@@ -17434,7 +17436,7 @@ ${indent} maxItems={${field.maxItems}}` : ""
|
|
|
17434
17436
|
kind: "renderNestedFieldFormFieldDetailsTemplate",
|
|
17435
17437
|
props: {
|
|
17436
17438
|
indent,
|
|
17437
|
-
pathNameProp: pathNameProp(
|
|
17439
|
+
pathNameProp: pathNameProp(path113),
|
|
17438
17440
|
formItemProps: formItemProps(field),
|
|
17439
17441
|
labelWithDescription: labelWithDescription(
|
|
17440
17442
|
formLabel(field, nestedLabel),
|
|
@@ -17450,7 +17452,7 @@ ${indent} maxItems={${field.maxItems}}` : ""
|
|
|
17450
17452
|
kind: "renderNestedFieldFormFieldDetailsBranchTemplate",
|
|
17451
17453
|
props: {
|
|
17452
17454
|
indent,
|
|
17453
|
-
pathNameProp: pathNameProp(
|
|
17455
|
+
pathNameProp: pathNameProp(path113),
|
|
17454
17456
|
formItemProps: formItemProps(field),
|
|
17455
17457
|
labelWithDescription: labelWithDescription(
|
|
17456
17458
|
formLabel(field, nestedLabel),
|
|
@@ -17468,7 +17470,7 @@ ${indent} maxItems={${field.maxItems}}` : ""
|
|
|
17468
17470
|
kind: "renderNestedFieldFormFieldDetailsBranchBodyTemplate",
|
|
17469
17471
|
props: {
|
|
17470
17472
|
indent,
|
|
17471
|
-
pathNameProp: pathNameProp(
|
|
17473
|
+
pathNameProp: pathNameProp(path113),
|
|
17472
17474
|
formItemProps: formItemProps(field),
|
|
17473
17475
|
labelWithDescription: labelWithDescription(
|
|
17474
17476
|
formLabel(field, nestedLabel),
|
|
@@ -17481,13 +17483,13 @@ ${indent} maxItems={${field.maxItems}}` : ""
|
|
|
17481
17483
|
}
|
|
17482
17484
|
});
|
|
17483
17485
|
}
|
|
17484
|
-
return renderTextInputField(field, indent, nestedLabel, nestedHint,
|
|
17486
|
+
return renderTextInputField(field, indent, nestedLabel, nestedHint, path113);
|
|
17485
17487
|
}
|
|
17486
17488
|
|
|
17487
17489
|
// adapters/next/generators/form/field-jsx-nested/validation-trigger-expression.ts
|
|
17488
17490
|
function validationTriggerExpression(basePath, requiredPaths) {
|
|
17489
17491
|
if (requiredPaths.length === 0) return `\`${basePath}.\${expandedIndex}\` as never`;
|
|
17490
|
-
const paths = requiredPaths.map((
|
|
17492
|
+
const paths = requiredPaths.map((path113) => `\`${basePath}.\${expandedIndex}.${path113}\``).join(", ");
|
|
17491
17493
|
return `[${paths}] as never`;
|
|
17492
17494
|
}
|
|
17493
17495
|
|
|
@@ -29263,8 +29265,8 @@ ${validationErrors.map((error) => ` - ${error}`).join("\n")}`
|
|
|
29263
29265
|
// adapters/next/commands/init/run-init-command-internal.ts
|
|
29264
29266
|
import * as p61 from "@clack/prompts";
|
|
29265
29267
|
import { execFileSync as execFileSync3 } from "child_process";
|
|
29266
|
-
import
|
|
29267
|
-
import
|
|
29268
|
+
import fs79 from "fs";
|
|
29269
|
+
import path92 from "path";
|
|
29268
29270
|
|
|
29269
29271
|
// adapters/next/config/detect/detect-project.ts
|
|
29270
29272
|
import fs52 from "fs";
|
|
@@ -33128,16 +33130,36 @@ function scaffoldOxfmt(cwd, linter, adminDir) {
|
|
|
33128
33130
|
return { installed: true, skippedReason: null };
|
|
33129
33131
|
}
|
|
33130
33132
|
|
|
33133
|
+
// adapters/next/init/scaffolders/proxy.ts
|
|
33134
|
+
import fs65 from "fs";
|
|
33135
|
+
import path78 from "path";
|
|
33136
|
+
function scaffoldProxy({ cwd, config }) {
|
|
33137
|
+
const conventionDir = config.srcDir ? "src" : "";
|
|
33138
|
+
for (const fileName of PROXY_CONVENTION_FILE_NAMES) {
|
|
33139
|
+
const relPath2 = path78.join(conventionDir, fileName);
|
|
33140
|
+
if (fs65.existsSync(path78.resolve(cwd, relPath2))) {
|
|
33141
|
+
return { status: "existing", path: relPath2 };
|
|
33142
|
+
}
|
|
33143
|
+
}
|
|
33144
|
+
const relPath = path78.join(conventionDir, PROXY_FILE_NAME);
|
|
33145
|
+
const content = applyAdminNamespaceToContent(
|
|
33146
|
+
readTemplate(PROXY_FILE_NAME),
|
|
33147
|
+
config.frameworkConfig.next.namespace
|
|
33148
|
+
);
|
|
33149
|
+
safeWriteFile(path78.resolve(cwd, relPath), content);
|
|
33150
|
+
return { status: "created", path: relPath };
|
|
33151
|
+
}
|
|
33152
|
+
|
|
33131
33153
|
// adapters/next/init/scaffolders/tailwind/scaffold-tailwind.ts
|
|
33132
|
-
import
|
|
33154
|
+
import fs67 from "fs";
|
|
33133
33155
|
|
|
33134
33156
|
// adapters/next/main-css.ts
|
|
33135
|
-
import
|
|
33136
|
-
import
|
|
33157
|
+
import fs66 from "fs";
|
|
33158
|
+
import path79 from "path";
|
|
33137
33159
|
function findMainCss(cwd) {
|
|
33138
33160
|
for (const candidate of MAIN_CSS_CANDIDATES) {
|
|
33139
|
-
const filePath =
|
|
33140
|
-
if (
|
|
33161
|
+
const filePath = path79.join(cwd, candidate);
|
|
33162
|
+
if (fs66.existsSync(filePath)) return filePath;
|
|
33141
33163
|
}
|
|
33142
33164
|
return void 0;
|
|
33143
33165
|
}
|
|
@@ -33221,7 +33243,7 @@ function scaffoldTailwind(cwd, hasSrcDir, namespace = "admin") {
|
|
|
33221
33243
|
if (!cssFile) {
|
|
33222
33244
|
return { file: null, appended: false };
|
|
33223
33245
|
}
|
|
33224
|
-
let content =
|
|
33246
|
+
let content = fs67.readFileSync(cssFile, "utf-8");
|
|
33225
33247
|
let changed = false;
|
|
33226
33248
|
const sourceLines = getSourceLines(namespace, hasSrcDir);
|
|
33227
33249
|
const missingLines = sourceLines.filter((sl) => !content.includes(sl));
|
|
@@ -33274,14 +33296,14 @@ ${renderAdminShadowInputUtility()}
|
|
|
33274
33296
|
changed = true;
|
|
33275
33297
|
}
|
|
33276
33298
|
if (changed) {
|
|
33277
|
-
|
|
33299
|
+
fs67.writeFileSync(cssFile, content, "utf-8");
|
|
33278
33300
|
}
|
|
33279
33301
|
return { file: cssFile, appended: changed };
|
|
33280
33302
|
}
|
|
33281
33303
|
|
|
33282
33304
|
// adapters/next/init/scaffolders/tsconfig/scaffold-tsconfig.ts
|
|
33283
|
-
import
|
|
33284
|
-
import
|
|
33305
|
+
import fs68 from "fs";
|
|
33306
|
+
import path80 from "path";
|
|
33285
33307
|
|
|
33286
33308
|
// adapters/next/init/scaffolders/tsconfig/create-admin-path-aliases.ts
|
|
33287
33309
|
function createAdminPathAliases(config) {
|
|
@@ -33305,14 +33327,14 @@ function createAdminPathAliases(config) {
|
|
|
33305
33327
|
|
|
33306
33328
|
// adapters/next/init/scaffolders/tsconfig/scaffold-tsconfig.ts
|
|
33307
33329
|
function scaffoldTsconfig(cwd, config) {
|
|
33308
|
-
const tsconfigPath =
|
|
33330
|
+
const tsconfigPath = path80.join(cwd, "tsconfig.json");
|
|
33309
33331
|
const added = [];
|
|
33310
33332
|
const skipped = [];
|
|
33311
|
-
if (!
|
|
33333
|
+
if (!fs68.existsSync(tsconfigPath)) {
|
|
33312
33334
|
skipped.push("tsconfig.json not found");
|
|
33313
33335
|
return { added, skipped };
|
|
33314
33336
|
}
|
|
33315
|
-
const raw =
|
|
33337
|
+
const raw = fs68.readFileSync(tsconfigPath, "utf-8");
|
|
33316
33338
|
const stripped = toStrictJson(raw);
|
|
33317
33339
|
let tsconfig;
|
|
33318
33340
|
try {
|
|
@@ -33351,7 +33373,7 @@ function scaffoldTsconfig(cwd, config) {
|
|
|
33351
33373
|
}
|
|
33352
33374
|
compilerOptions.paths = paths;
|
|
33353
33375
|
tsconfig.compilerOptions = compilerOptions;
|
|
33354
|
-
|
|
33376
|
+
fs68.writeFileSync(tsconfigPath, `${JSON.stringify(tsconfig, null, 2)}
|
|
33355
33377
|
`, "utf-8");
|
|
33356
33378
|
return { added, skipped };
|
|
33357
33379
|
}
|
|
@@ -33596,25 +33618,25 @@ async function ensureVercelAuth(runner, cwd, options) {
|
|
|
33596
33618
|
}
|
|
33597
33619
|
|
|
33598
33620
|
// adapters/next/init/vercel/env-guard.ts
|
|
33599
|
-
import
|
|
33600
|
-
import
|
|
33621
|
+
import fs69 from "fs";
|
|
33622
|
+
import path81 from "path";
|
|
33601
33623
|
function guardEnvLocal(cwd) {
|
|
33602
|
-
const envPath =
|
|
33624
|
+
const envPath = path81.join(cwd, ".env.local");
|
|
33603
33625
|
let original;
|
|
33604
33626
|
try {
|
|
33605
|
-
original =
|
|
33627
|
+
original = fs69.readFileSync(envPath, "utf-8");
|
|
33606
33628
|
} catch {
|
|
33607
33629
|
original = void 0;
|
|
33608
33630
|
}
|
|
33609
33631
|
return {
|
|
33610
33632
|
restore() {
|
|
33611
33633
|
try {
|
|
33612
|
-
const current =
|
|
33634
|
+
const current = fs69.existsSync(envPath) ? fs69.readFileSync(envPath, "utf-8") : void 0;
|
|
33613
33635
|
if (current === original) return;
|
|
33614
33636
|
if (original === void 0) {
|
|
33615
|
-
|
|
33637
|
+
fs69.rmSync(envPath, { force: true });
|
|
33616
33638
|
} else {
|
|
33617
|
-
|
|
33639
|
+
fs69.writeFileSync(envPath, original);
|
|
33618
33640
|
}
|
|
33619
33641
|
} catch {
|
|
33620
33642
|
}
|
|
@@ -33674,17 +33696,17 @@ function blobFailureMessage(reason) {
|
|
|
33674
33696
|
import pc9 from "picocolors";
|
|
33675
33697
|
|
|
33676
33698
|
// adapters/next/init/vercel/project/create-and-link-project.ts
|
|
33677
|
-
import
|
|
33678
|
-
import
|
|
33699
|
+
import fs71 from "fs";
|
|
33700
|
+
import path83 from "path";
|
|
33679
33701
|
|
|
33680
33702
|
// adapters/next/init/vercel/project/read-linked-project-json.ts
|
|
33681
|
-
import
|
|
33682
|
-
import
|
|
33703
|
+
import fs70 from "fs";
|
|
33704
|
+
import path82 from "path";
|
|
33683
33705
|
function readLinkedProjectJson(cwd) {
|
|
33684
33706
|
try {
|
|
33685
|
-
const projectJsonPath =
|
|
33686
|
-
if (!
|
|
33687
|
-
return JSON.parse(
|
|
33707
|
+
const projectJsonPath = path82.join(cwd, ".vercel", "project.json");
|
|
33708
|
+
if (!fs70.existsSync(projectJsonPath)) return void 0;
|
|
33709
|
+
return JSON.parse(fs70.readFileSync(projectJsonPath, "utf-8"));
|
|
33688
33710
|
} catch {
|
|
33689
33711
|
return void 0;
|
|
33690
33712
|
}
|
|
@@ -33755,7 +33777,7 @@ ${add.stderr}`)) continue;
|
|
|
33755
33777
|
break;
|
|
33756
33778
|
}
|
|
33757
33779
|
try {
|
|
33758
|
-
|
|
33780
|
+
fs71.rmSync(path83.join(cwd, ".vercel", "project.json"), { force: true });
|
|
33759
33781
|
} catch {
|
|
33760
33782
|
}
|
|
33761
33783
|
let link = await runVercel(
|
|
@@ -33872,12 +33894,12 @@ ${result.stderr}`
|
|
|
33872
33894
|
}
|
|
33873
33895
|
|
|
33874
33896
|
// adapters/next/init/vercel/env-pull.ts
|
|
33875
|
-
import
|
|
33897
|
+
import fs72 from "fs";
|
|
33876
33898
|
import os from "os";
|
|
33877
|
-
import
|
|
33899
|
+
import path84 from "path";
|
|
33878
33900
|
async function pullVercelEnvValue(runner, cwd, read, env, environment = "development") {
|
|
33879
|
-
const tmpDir =
|
|
33880
|
-
const tmpEnv =
|
|
33901
|
+
const tmpDir = fs72.mkdtempSync(path84.join(os.tmpdir(), "betterstart-vercel-"));
|
|
33902
|
+
const tmpEnv = path84.join(tmpDir, ".env.pull");
|
|
33881
33903
|
try {
|
|
33882
33904
|
const pull = await runVercel(
|
|
33883
33905
|
runner,
|
|
@@ -33888,7 +33910,7 @@ async function pullVercelEnvValue(runner, cwd, read, env, environment = "develop
|
|
|
33888
33910
|
return read(tmpEnv);
|
|
33889
33911
|
} finally {
|
|
33890
33912
|
try {
|
|
33891
|
-
|
|
33913
|
+
fs72.rmSync(tmpDir, { recursive: true, force: true });
|
|
33892
33914
|
} catch {
|
|
33893
33915
|
}
|
|
33894
33916
|
}
|
|
@@ -34103,14 +34125,14 @@ ${deploy.stderr}`, DETAIL_MAX_LINES)
|
|
|
34103
34125
|
}
|
|
34104
34126
|
|
|
34105
34127
|
// adapters/next/init/vercel/deploy/ensure-vercel-json-framework.ts
|
|
34106
|
-
import
|
|
34107
|
-
import
|
|
34128
|
+
import fs73 from "fs";
|
|
34129
|
+
import path85 from "path";
|
|
34108
34130
|
function ensureVercelJsonFramework(cwd) {
|
|
34109
|
-
const vercelJsonPath =
|
|
34110
|
-
if (
|
|
34131
|
+
const vercelJsonPath = path85.join(cwd, "vercel.json");
|
|
34132
|
+
if (fs73.existsSync(vercelJsonPath)) {
|
|
34111
34133
|
return "exists";
|
|
34112
34134
|
}
|
|
34113
|
-
|
|
34135
|
+
fs73.writeFileSync(
|
|
34114
34136
|
vercelJsonPath,
|
|
34115
34137
|
`${JSON.stringify({ $schema: "https://openapi.vercel.sh/vercel.json", framework: "nextjs" }, null, 2)}
|
|
34116
34138
|
`,
|
|
@@ -34120,9 +34142,9 @@ function ensureVercelJsonFramework(cwd) {
|
|
|
34120
34142
|
}
|
|
34121
34143
|
|
|
34122
34144
|
// adapters/next/init/vercel/deploy/collect-deploy-env-vars.ts
|
|
34123
|
-
import
|
|
34145
|
+
import path86 from "path";
|
|
34124
34146
|
function collectDeployEnvVars(cwd, existingProductionKeys) {
|
|
34125
|
-
const local = parseDotenvFile(
|
|
34147
|
+
const local = parseDotenvFile(path86.join(cwd, ".env.local"));
|
|
34126
34148
|
const vars = [];
|
|
34127
34149
|
for (const [key, value] of local) {
|
|
34128
34150
|
if (VERCEL_ENV_SYNC_SKIP_KEYS.has(key)) continue;
|
|
@@ -34520,8 +34542,8 @@ ${stderr}`;
|
|
|
34520
34542
|
|
|
34521
34543
|
// adapters/next/commands/init/run-seed-script.ts
|
|
34522
34544
|
import { spawn as spawn7 } from "child_process";
|
|
34523
|
-
import
|
|
34524
|
-
import
|
|
34545
|
+
import fs74 from "fs";
|
|
34546
|
+
import path87 from "path";
|
|
34525
34547
|
|
|
34526
34548
|
// adapters/next/templates/renderers/commands/seed/build-seed-script.ts
|
|
34527
34549
|
function renderBuildSeedScriptEnvFileTemplate({
|
|
@@ -34701,23 +34723,23 @@ function buildSeedScript(authBasePath = "/api/admin/auth") {
|
|
|
34701
34723
|
|
|
34702
34724
|
// adapters/next/commands/init/run-seed-script.ts
|
|
34703
34725
|
function runSeedScript(cwd, adminDir, authBasePath, envOverrides) {
|
|
34704
|
-
const scriptsDir =
|
|
34705
|
-
const seedPath =
|
|
34706
|
-
if (!
|
|
34707
|
-
|
|
34726
|
+
const scriptsDir = path87.join(cwd, adminDir, "scripts");
|
|
34727
|
+
const seedPath = path87.join(scriptsDir, "seed.ts");
|
|
34728
|
+
if (!fs74.existsSync(scriptsDir)) {
|
|
34729
|
+
fs74.mkdirSync(scriptsDir, { recursive: true });
|
|
34708
34730
|
}
|
|
34709
|
-
|
|
34731
|
+
fs74.writeFileSync(seedPath, buildSeedScript(authBasePath), "utf-8");
|
|
34710
34732
|
const cleanup = () => {
|
|
34711
34733
|
try {
|
|
34712
|
-
|
|
34713
|
-
if (
|
|
34714
|
-
|
|
34734
|
+
fs74.unlinkSync(seedPath);
|
|
34735
|
+
if (fs74.existsSync(scriptsDir) && fs74.readdirSync(scriptsDir).length === 0) {
|
|
34736
|
+
fs74.rmdirSync(scriptsDir);
|
|
34715
34737
|
}
|
|
34716
34738
|
} catch {
|
|
34717
34739
|
}
|
|
34718
34740
|
};
|
|
34719
34741
|
return new Promise((resolve) => {
|
|
34720
|
-
const tsxBin =
|
|
34742
|
+
const tsxBin = path87.join(cwd, "node_modules", ".bin", "tsx");
|
|
34721
34743
|
const child = spawn7(tsxBin, [seedPath], {
|
|
34722
34744
|
cwd,
|
|
34723
34745
|
stdio: "pipe",
|
|
@@ -34787,12 +34809,12 @@ function formatAdminIdentity(admin) {
|
|
|
34787
34809
|
}
|
|
34788
34810
|
|
|
34789
34811
|
// adapters/next/commands/init/has-db-url.ts
|
|
34790
|
-
import
|
|
34791
|
-
import
|
|
34812
|
+
import fs75 from "fs";
|
|
34813
|
+
import path88 from "path";
|
|
34792
34814
|
function hasDbUrl(cwd) {
|
|
34793
|
-
const envPath =
|
|
34794
|
-
if (!
|
|
34795
|
-
const content =
|
|
34815
|
+
const envPath = path88.join(cwd, ".env.local");
|
|
34816
|
+
if (!fs75.existsSync(envPath)) return false;
|
|
34817
|
+
const content = fs75.readFileSync(envPath, "utf-8");
|
|
34796
34818
|
for (const line of content.split("\n")) {
|
|
34797
34819
|
const trimmed = line.trim();
|
|
34798
34820
|
if (trimmed.startsWith("#") || !trimmed.includes("=")) continue;
|
|
@@ -34854,8 +34876,8 @@ function readExistingDbUrl(cwd) {
|
|
|
34854
34876
|
}
|
|
34855
34877
|
|
|
34856
34878
|
// adapters/next/commands/init/remove-existing-admin-paths.ts
|
|
34857
|
-
import
|
|
34858
|
-
import
|
|
34879
|
+
import fs76 from "fs";
|
|
34880
|
+
import path89 from "path";
|
|
34859
34881
|
|
|
34860
34882
|
// adapters/next/commands/init/normalize-namespace-for-removal.ts
|
|
34861
34883
|
function normalizeNamespaceForRemoval(value) {
|
|
@@ -34883,16 +34905,16 @@ function removeExistingAdminPaths(cwd, namespaces) {
|
|
|
34883
34905
|
const nukeFiles = [CONFIG_FILE_NAME, "ADMIN.md", "drizzle.config.ts"];
|
|
34884
34906
|
let removed = 0;
|
|
34885
34907
|
for (const dir of nukeDirs) {
|
|
34886
|
-
const fullPath =
|
|
34887
|
-
if (
|
|
34888
|
-
|
|
34908
|
+
const fullPath = path89.resolve(cwd, dir);
|
|
34909
|
+
if (fs76.existsSync(fullPath)) {
|
|
34910
|
+
fs76.rmSync(fullPath, { recursive: true, force: true });
|
|
34889
34911
|
removed++;
|
|
34890
34912
|
}
|
|
34891
34913
|
}
|
|
34892
34914
|
for (const file of nukeFiles) {
|
|
34893
|
-
const fullPath =
|
|
34894
|
-
if (
|
|
34895
|
-
|
|
34915
|
+
const fullPath = path89.resolve(cwd, file);
|
|
34916
|
+
if (fs76.existsSync(fullPath)) {
|
|
34917
|
+
fs76.unlinkSync(fullPath);
|
|
34896
34918
|
removed++;
|
|
34897
34919
|
}
|
|
34898
34920
|
}
|
|
@@ -34930,12 +34952,12 @@ function renderInitBanner() {
|
|
|
34930
34952
|
}
|
|
34931
34953
|
|
|
34932
34954
|
// adapters/next/commands/init/resolve-force-init-namespaces.ts
|
|
34933
|
-
import
|
|
34934
|
-
import
|
|
34955
|
+
import fs78 from "fs";
|
|
34956
|
+
import path91 from "path";
|
|
34935
34957
|
|
|
34936
34958
|
// adapters/next/commands/init/read-existing-config-namespace.ts
|
|
34937
|
-
import
|
|
34938
|
-
import
|
|
34959
|
+
import fs77 from "fs";
|
|
34960
|
+
import path90 from "path";
|
|
34939
34961
|
|
|
34940
34962
|
// adapters/next/commands/init/read-namespace-from-config-source.ts
|
|
34941
34963
|
function readNamespaceFromConfigSource(source) {
|
|
@@ -34945,11 +34967,11 @@ function readNamespaceFromConfigSource(source) {
|
|
|
34945
34967
|
|
|
34946
34968
|
// adapters/next/commands/init/read-existing-config-namespace.ts
|
|
34947
34969
|
async function readExistingConfigNamespace(cwd) {
|
|
34948
|
-
const configPath =
|
|
34949
|
-
if (!
|
|
34970
|
+
const configPath = path90.resolve(cwd, CONFIG_FILE_NAME);
|
|
34971
|
+
if (!fs77.existsSync(configPath)) {
|
|
34950
34972
|
return;
|
|
34951
34973
|
}
|
|
34952
|
-
const sourceNamespace = readNamespaceFromConfigSource(
|
|
34974
|
+
const sourceNamespace = readNamespaceFromConfigSource(fs77.readFileSync(configPath, "utf-8"));
|
|
34953
34975
|
if (sourceNamespace) {
|
|
34954
34976
|
return sourceNamespace;
|
|
34955
34977
|
}
|
|
@@ -34964,7 +34986,7 @@ async function readExistingConfigNamespace(cwd) {
|
|
|
34964
34986
|
// adapters/next/commands/init/resolve-force-init-namespaces.ts
|
|
34965
34987
|
async function resolveForceInitNamespaces(cwd, targetNamespace) {
|
|
34966
34988
|
const namespaces = /* @__PURE__ */ new Set([validateAdminNamespace(targetNamespace)]);
|
|
34967
|
-
const hasConfig =
|
|
34989
|
+
const hasConfig = fs78.existsSync(path91.resolve(cwd, CONFIG_FILE_NAME));
|
|
34968
34990
|
const existingNamespace = await readExistingConfigNamespace(cwd);
|
|
34969
34991
|
if (existingNamespace) {
|
|
34970
34992
|
namespaces.add(existingNamespace);
|
|
@@ -35255,7 +35277,7 @@ async function runInitCommandInternal(name, options, jsonContext) {
|
|
|
35255
35277
|
exitInit("validation", message, "INVALID_OPTIONS");
|
|
35256
35278
|
}
|
|
35257
35279
|
let cwd = process.cwd();
|
|
35258
|
-
let projectName =
|
|
35280
|
+
let projectName = path92.basename(cwd);
|
|
35259
35281
|
let forceMode = Boolean(options.force);
|
|
35260
35282
|
let namespace = DEFAULT_ADMIN_NAMESPACE;
|
|
35261
35283
|
if (options.namespace) {
|
|
@@ -35364,7 +35386,7 @@ async function runInitCommandInternal(name, options, jsonContext) {
|
|
|
35364
35386
|
}
|
|
35365
35387
|
pm = pmChoice;
|
|
35366
35388
|
}
|
|
35367
|
-
const displayName = freshProject.projectName === "." ?
|
|
35389
|
+
const displayName = freshProject.projectName === "." ? path92.basename(cwd) : freshProject.projectName;
|
|
35368
35390
|
projectName = displayName;
|
|
35369
35391
|
const { bin, prefix } = createNextAppCommand();
|
|
35370
35392
|
const cnaArgs = [
|
|
@@ -35402,10 +35424,10 @@ async function runInitCommandInternal(name, options, jsonContext) {
|
|
|
35402
35424
|
);
|
|
35403
35425
|
exitInit("project", createNextAppResult.error, "CREATE_NEXT_APP_FAILED");
|
|
35404
35426
|
}
|
|
35405
|
-
cwd =
|
|
35406
|
-
const hasPackageJson =
|
|
35427
|
+
cwd = path92.resolve(cwd, freshProject.projectName);
|
|
35428
|
+
const hasPackageJson = fs79.existsSync(path92.join(cwd, "package.json"));
|
|
35407
35429
|
const hasNextConfig = ["next.config.ts", "next.config.js", "next.config.mjs"].some(
|
|
35408
|
-
(f) =>
|
|
35430
|
+
(f) => fs79.existsSync(path92.join(cwd, f))
|
|
35409
35431
|
);
|
|
35410
35432
|
if (!hasPackageJson || !hasNextConfig) {
|
|
35411
35433
|
createNextAppSpinner.stop(`Failed to create Next.js app: ${displayName}`);
|
|
@@ -35730,6 +35752,8 @@ async function runInitCommandInternal(name, options, jsonContext) {
|
|
|
35730
35752
|
scaffoldLayout({ cwd, config });
|
|
35731
35753
|
s.message("API routes");
|
|
35732
35754
|
scaffoldApiRoutes({ cwd, config });
|
|
35755
|
+
s.message("Route protection");
|
|
35756
|
+
const proxyResult = scaffoldProxy({ cwd, config });
|
|
35733
35757
|
s.message("Linter");
|
|
35734
35758
|
if (project2.linter.type === "none") {
|
|
35735
35759
|
scaffoldOxfmt(cwd, project2.linter, config.paths.admin);
|
|
@@ -35740,11 +35764,16 @@ async function runInitCommandInternal(name, options, jsonContext) {
|
|
|
35740
35764
|
if (nextConfigResult.status === "unsupported") {
|
|
35741
35765
|
p61.log.warn("The Next.js config could not be updated automatically \u2014 review it manually.");
|
|
35742
35766
|
}
|
|
35743
|
-
|
|
35744
|
-
|
|
35767
|
+
if (proxyResult.status === "existing") {
|
|
35768
|
+
p61.log.warn(
|
|
35769
|
+
`Existing ${proxyResult.path} left in place \u2014 add the admin session-cookie redirect to it so logged-out visitors never render the admin routes.`
|
|
35770
|
+
);
|
|
35771
|
+
}
|
|
35772
|
+
const drizzleConfigPath = path92.join(cwd, "drizzle.config.ts");
|
|
35773
|
+
if (!dbFiles.includes("drizzle.config.ts") && fs79.existsSync(drizzleConfigPath)) {
|
|
35745
35774
|
if (forceMode) {
|
|
35746
|
-
const { readNamespacedTemplate } = await import("./read-namespaced-template-
|
|
35747
|
-
|
|
35775
|
+
const { readNamespacedTemplate } = await import("./read-namespaced-template-D2CD4Q7U.js");
|
|
35776
|
+
fs79.writeFileSync(
|
|
35748
35777
|
drizzleConfigPath,
|
|
35749
35778
|
readNamespacedTemplate("drizzle.config.ts", namespace),
|
|
35750
35779
|
"utf-8"
|
|
@@ -35756,8 +35785,8 @@ async function runInitCommandInternal(name, options, jsonContext) {
|
|
|
35756
35785
|
initialValue: true
|
|
35757
35786
|
});
|
|
35758
35787
|
if (!p61.isCancel(overwrite) && overwrite) {
|
|
35759
|
-
const { readNamespacedTemplate } = await import("./read-namespaced-template-
|
|
35760
|
-
|
|
35788
|
+
const { readNamespacedTemplate } = await import("./read-namespaced-template-D2CD4Q7U.js");
|
|
35789
|
+
fs79.writeFileSync(
|
|
35761
35790
|
drizzleConfigPath,
|
|
35762
35791
|
readNamespacedTemplate("drizzle.config.ts", namespace),
|
|
35763
35792
|
"utf-8"
|
|
@@ -36174,7 +36203,7 @@ async function runInitCommand(name, options) {
|
|
|
36174
36203
|
|
|
36175
36204
|
// adapters/next/commands/list-integrations.ts
|
|
36176
36205
|
import * as p62 from "@clack/prompts";
|
|
36177
|
-
import
|
|
36206
|
+
import path93 from "path";
|
|
36178
36207
|
|
|
36179
36208
|
// adapters/next/integration-runtime/list-available-integrations.ts
|
|
36180
36209
|
function listAvailableIntegrations() {
|
|
@@ -36183,7 +36212,7 @@ function listAvailableIntegrations() {
|
|
|
36183
36212
|
|
|
36184
36213
|
// adapters/next/commands/list-integrations.ts
|
|
36185
36214
|
async function runListIntegrationsCommand(options) {
|
|
36186
|
-
const cwd = options.cwd ?
|
|
36215
|
+
const cwd = options.cwd ? path93.resolve(options.cwd) : process.cwd();
|
|
36187
36216
|
if (options.json) {
|
|
36188
36217
|
let installed2;
|
|
36189
36218
|
try {
|
|
@@ -36219,7 +36248,7 @@ async function runListIntegrationsCommand(options) {
|
|
|
36219
36248
|
|
|
36220
36249
|
// adapters/next/commands/list-presets.ts
|
|
36221
36250
|
import * as p63 from "@clack/prompts";
|
|
36222
|
-
import
|
|
36251
|
+
import path94 from "path";
|
|
36223
36252
|
|
|
36224
36253
|
// adapters/next/preset-runtime/list-available-presets.ts
|
|
36225
36254
|
function listAvailablePresets() {
|
|
@@ -36228,7 +36257,7 @@ function listAvailablePresets() {
|
|
|
36228
36257
|
|
|
36229
36258
|
// adapters/next/commands/list-presets.ts
|
|
36230
36259
|
async function runListPresetsCommand(options) {
|
|
36231
|
-
const cwd = options.cwd ?
|
|
36260
|
+
const cwd = options.cwd ? path94.resolve(options.cwd) : process.cwd();
|
|
36232
36261
|
if (options.json) {
|
|
36233
36262
|
let installed2;
|
|
36234
36263
|
try {
|
|
@@ -36261,13 +36290,13 @@ async function runListPresetsCommand(options) {
|
|
|
36261
36290
|
}
|
|
36262
36291
|
|
|
36263
36292
|
// adapters/next/commands/update-component/get-static-asset-component-entries.ts
|
|
36264
|
-
import
|
|
36265
|
-
import
|
|
36293
|
+
import fs80 from "fs";
|
|
36294
|
+
import path95 from "path";
|
|
36266
36295
|
function getStaticAssetComponentEntries(assetDirectory) {
|
|
36267
36296
|
const assetDir = resolveCliAssetPath("shared-assets", "react-admin", assetDirectory);
|
|
36268
|
-
if (!
|
|
36297
|
+
if (!fs80.existsSync(assetDir)) return [];
|
|
36269
36298
|
const components = [];
|
|
36270
|
-
for (const entry of
|
|
36299
|
+
for (const entry of fs80.readdirSync(assetDir, { withFileTypes: true })) {
|
|
36271
36300
|
if (entry.isFile() && (entry.name.endsWith(".tsx") || entry.name.endsWith(".ts"))) {
|
|
36272
36301
|
components.push({
|
|
36273
36302
|
name: entry.name.replace(/\.(tsx|ts)$/, ""),
|
|
@@ -36279,12 +36308,12 @@ function getStaticAssetComponentEntries(assetDirectory) {
|
|
|
36279
36308
|
continue;
|
|
36280
36309
|
}
|
|
36281
36310
|
const indexFile = ["index.tsx", "index.ts"].find(
|
|
36282
|
-
(file) =>
|
|
36311
|
+
(file) => fs80.existsSync(path95.join(assetDir, entry.name, file))
|
|
36283
36312
|
);
|
|
36284
36313
|
if (indexFile) {
|
|
36285
36314
|
components.push({
|
|
36286
36315
|
name: entry.name,
|
|
36287
|
-
file:
|
|
36316
|
+
file: path95.join(entry.name, indexFile)
|
|
36288
36317
|
});
|
|
36289
36318
|
}
|
|
36290
36319
|
}
|
|
@@ -37987,6 +38016,12 @@ var TEMPLATE_REGISTRY = {
|
|
|
37987
38016
|
base: "cwd",
|
|
37988
38017
|
dependencies: ["admin-sidebar", "auth-session"]
|
|
37989
38018
|
},
|
|
38019
|
+
proxy: {
|
|
38020
|
+
relPath: ({ config }) => config.srcDir ? "src/proxy.ts" : "proxy.ts",
|
|
38021
|
+
displayPath: "proxy.ts",
|
|
38022
|
+
content: () => readTemplate("proxy.ts"),
|
|
38023
|
+
base: "cwd"
|
|
38024
|
+
},
|
|
37990
38025
|
"account-layout": {
|
|
37991
38026
|
relPath: "app/(admin)/admin/(account)/layout.tsx",
|
|
37992
38027
|
content: () => readTemplate("pages/account-layout.tsx"),
|
|
@@ -39032,28 +39067,28 @@ async function listInstallableChoices(cwd) {
|
|
|
39032
39067
|
}
|
|
39033
39068
|
|
|
39034
39069
|
// adapters/next/commands/menu-choices/list-schema-choices.ts
|
|
39035
|
-
import
|
|
39070
|
+
import path96 from "path";
|
|
39036
39071
|
async function listSchemaChoices(cwd) {
|
|
39037
39072
|
const config = await resolveConfigOrExit(cwd);
|
|
39038
39073
|
const paths = resolveProjectPaths(config);
|
|
39039
|
-
return listSchemaNames(
|
|
39074
|
+
return listSchemaNames(path96.join(cwd, ...paths.schemasDir.split("/")));
|
|
39040
39075
|
}
|
|
39041
39076
|
|
|
39042
39077
|
// adapters/next/commands/remove-schema/run-remove-schema-command.ts
|
|
39043
39078
|
import * as clack2 from "@clack/prompts";
|
|
39044
|
-
import
|
|
39079
|
+
import path97 from "path";
|
|
39045
39080
|
|
|
39046
39081
|
// core-engine/snapshots/store/delete-snapshot.ts
|
|
39047
|
-
import
|
|
39082
|
+
import fs81 from "fs";
|
|
39048
39083
|
function deleteSnapshot(cwd, scope) {
|
|
39049
|
-
|
|
39084
|
+
fs81.rmSync(scopeDir(cwd, scope), { recursive: true, force: true });
|
|
39050
39085
|
}
|
|
39051
39086
|
|
|
39052
39087
|
// core-engine/snapshots/store/write-tombstone.ts
|
|
39053
|
-
import
|
|
39088
|
+
import fs82 from "fs";
|
|
39054
39089
|
function writeTombstone(cwd, scope) {
|
|
39055
|
-
|
|
39056
|
-
|
|
39090
|
+
fs82.mkdirSync(removedDir(cwd), { recursive: true });
|
|
39091
|
+
fs82.writeFileSync(tombstonePath(cwd, scope), "", "utf-8");
|
|
39057
39092
|
}
|
|
39058
39093
|
|
|
39059
39094
|
// adapters/next/commands/remove-schema/cleanup-schema-empty-dirs.ts
|
|
@@ -39081,7 +39116,7 @@ function resolveSchemaOwnerForRemoval(cwd, schemaName) {
|
|
|
39081
39116
|
// adapters/next/commands/remove-schema/run-remove-schema-command.ts
|
|
39082
39117
|
async function runRemoveSchemaCommand(schemaName, options) {
|
|
39083
39118
|
const owner = resolveSchemaOwnerForRemoval(
|
|
39084
|
-
options.cwd ?
|
|
39119
|
+
options.cwd ? path97.resolve(options.cwd) : process.cwd(),
|
|
39085
39120
|
schemaName
|
|
39086
39121
|
);
|
|
39087
39122
|
if (owner === "core") {
|
|
@@ -39094,7 +39129,7 @@ async function runRemoveSchemaCommand(schemaName, options) {
|
|
|
39094
39129
|
clack2.log.error(`"${schemaName}" is owned by ${owner}. Remove the owning preset instead.`);
|
|
39095
39130
|
process.exit(1);
|
|
39096
39131
|
}
|
|
39097
|
-
const cwd = options.cwd ?
|
|
39132
|
+
const cwd = options.cwd ? path97.resolve(options.cwd) : process.cwd();
|
|
39098
39133
|
const config = await resolveConfigOrExit(cwd);
|
|
39099
39134
|
const paths = resolveProjectPaths(config);
|
|
39100
39135
|
const manifest = loadManifest(cwd, schemaName);
|
|
@@ -39130,7 +39165,7 @@ async function runRemoveSchemaCommand(schemaName, options) {
|
|
|
39130
39165
|
}
|
|
39131
39166
|
const loaded = (() => {
|
|
39132
39167
|
try {
|
|
39133
|
-
return loadSchema(
|
|
39168
|
+
return loadSchema(path97.join(cwd, ...paths.schemasDir.split("/")), schemaName);
|
|
39134
39169
|
} catch {
|
|
39135
39170
|
return null;
|
|
39136
39171
|
}
|
|
@@ -39175,7 +39210,7 @@ Schema JSON preserved.`
|
|
|
39175
39210
|
|
|
39176
39211
|
// adapters/next/commands/remove.ts
|
|
39177
39212
|
import * as p64 from "@clack/prompts";
|
|
39178
|
-
import
|
|
39213
|
+
import path101 from "path";
|
|
39179
39214
|
|
|
39180
39215
|
// adapters/next/init/scaffolders/dependencies/build-remove-args.ts
|
|
39181
39216
|
function buildRemoveArgs(pm, deps, dev) {
|
|
@@ -39219,11 +39254,11 @@ async function removeDependenciesAsync({
|
|
|
39219
39254
|
}
|
|
39220
39255
|
|
|
39221
39256
|
// adapters/next/integration-runtime/find-blocking-integration-dependencies.ts
|
|
39222
|
-
import
|
|
39257
|
+
import path99 from "path";
|
|
39223
39258
|
|
|
39224
39259
|
// adapters/next/integration-runtime/schema-manifest-contains-mailchimp-imports.ts
|
|
39225
|
-
import
|
|
39226
|
-
import
|
|
39260
|
+
import fs83 from "fs";
|
|
39261
|
+
import path98 from "path";
|
|
39227
39262
|
function schemaManifestContainsMailchimpImports(cwd, config, schemaName) {
|
|
39228
39263
|
const manifest = loadManifest(cwd, schemaName);
|
|
39229
39264
|
if (!manifest) {
|
|
@@ -39240,11 +39275,11 @@ function schemaManifestContainsMailchimpImports(cwd, config, schemaName) {
|
|
|
39240
39275
|
...manifest.skipped
|
|
39241
39276
|
]);
|
|
39242
39277
|
return liveManifestPaths.some((filePath) => {
|
|
39243
|
-
const fullPath =
|
|
39244
|
-
if (!
|
|
39278
|
+
const fullPath = path98.join(cwd, ...filePath.split("/"));
|
|
39279
|
+
if (!fs83.existsSync(fullPath) || !fs83.statSync(fullPath).isFile()) {
|
|
39245
39280
|
return false;
|
|
39246
39281
|
}
|
|
39247
|
-
const content =
|
|
39282
|
+
const content = fs83.readFileSync(fullPath, "utf-8");
|
|
39248
39283
|
return markers.some((marker) => content.includes(marker));
|
|
39249
39284
|
});
|
|
39250
39285
|
}
|
|
@@ -39253,7 +39288,7 @@ function schemaManifestContainsMailchimpImports(cwd, config, schemaName) {
|
|
|
39253
39288
|
function findBlockingIntegrationDependencies(cwd, config, integrationId) {
|
|
39254
39289
|
const blockers = [];
|
|
39255
39290
|
const paths = resolveProjectPaths(config);
|
|
39256
|
-
const schemasDir =
|
|
39291
|
+
const schemasDir = path99.join(cwd, ...paths.schemasDir.split("/"));
|
|
39257
39292
|
const ownership = loadSchemaOwnershipIndex(cwd);
|
|
39258
39293
|
for (const schemaName of listSchemaNames(schemasDir)) {
|
|
39259
39294
|
if (ownership.schemas[schemaName] !== "user") {
|
|
@@ -39276,12 +39311,12 @@ function findBlockingIntegrationDependencies(cwd, config, integrationId) {
|
|
|
39276
39311
|
}
|
|
39277
39312
|
|
|
39278
39313
|
// adapters/next/integration-runtime/remove-email-templates-dir-if-empty.ts
|
|
39279
|
-
import
|
|
39314
|
+
import fs84 from "fs";
|
|
39280
39315
|
function removeEmailTemplatesDirIfEmpty(cwd, config) {
|
|
39281
39316
|
const dir = getEmailTemplatesDir(cwd, config);
|
|
39282
|
-
if (!
|
|
39283
|
-
if (
|
|
39284
|
-
|
|
39317
|
+
if (!fs84.existsSync(dir)) return;
|
|
39318
|
+
if (fs84.readdirSync(dir).length === 0) {
|
|
39319
|
+
fs84.rmdirSync(dir);
|
|
39285
39320
|
}
|
|
39286
39321
|
}
|
|
39287
39322
|
|
|
@@ -39446,8 +39481,8 @@ function findBlockingSchemaDependencies(cwd, config, ownedSchemas) {
|
|
|
39446
39481
|
}
|
|
39447
39482
|
|
|
39448
39483
|
// adapters/next/preset-runtime/remove-preset-schemas.ts
|
|
39449
|
-
import
|
|
39450
|
-
import
|
|
39484
|
+
import fs85 from "fs";
|
|
39485
|
+
import path100 from "path";
|
|
39451
39486
|
|
|
39452
39487
|
// preset-engine/ownership/remove-schema-owner.ts
|
|
39453
39488
|
function removeSchemaOwner(cwd, schemaName) {
|
|
@@ -39488,8 +39523,8 @@ function removePresetSchemas(cwd, config, manifest) {
|
|
|
39488
39523
|
}
|
|
39489
39524
|
deleteSnapshot(cwd, schemaName);
|
|
39490
39525
|
}
|
|
39491
|
-
const schemaPath =
|
|
39492
|
-
const formsSchemaPath =
|
|
39526
|
+
const schemaPath = path100.posix.join(paths.schemasDir, `${schemaName}.json`);
|
|
39527
|
+
const formsSchemaPath = path100.posix.join(paths.schemasDir, "forms", `${schemaName}.json`);
|
|
39493
39528
|
if (removePath(cwd, schemaPath)) {
|
|
39494
39529
|
deletedPaths.push(schemaPath);
|
|
39495
39530
|
}
|
|
@@ -39497,7 +39532,7 @@ function removePresetSchemas(cwd, config, manifest) {
|
|
|
39497
39532
|
deletedPaths.push(formsSchemaPath);
|
|
39498
39533
|
}
|
|
39499
39534
|
if (hasTombstone(cwd, schemaName)) {
|
|
39500
|
-
|
|
39535
|
+
fs85.rmSync(betterstartDir(cwd, "snapshots", "_removed", schemaName), {
|
|
39501
39536
|
force: true
|
|
39502
39537
|
});
|
|
39503
39538
|
}
|
|
@@ -39621,7 +39656,7 @@ async function runRemoveCommand(items, options) {
|
|
|
39621
39656
|
);
|
|
39622
39657
|
process.exit(1);
|
|
39623
39658
|
}
|
|
39624
|
-
const cwd = options.cwd ?
|
|
39659
|
+
const cwd = options.cwd ? path101.resolve(options.cwd) : process.cwd();
|
|
39625
39660
|
const config = await resolveConfigOrExit(cwd);
|
|
39626
39661
|
const pm = detectPackageManager(cwd);
|
|
39627
39662
|
if (!options.force) {
|
|
@@ -39673,10 +39708,10 @@ async function runRemoveCommand(items, options) {
|
|
|
39673
39708
|
|
|
39674
39709
|
// adapters/next/commands/seed/run-seed-command.ts
|
|
39675
39710
|
import * as clack3 from "@clack/prompts";
|
|
39676
|
-
import
|
|
39677
|
-
import
|
|
39711
|
+
import fs86 from "fs";
|
|
39712
|
+
import path102 from "path";
|
|
39678
39713
|
async function runSeedCommand(options) {
|
|
39679
|
-
const cwd = options.cwd ?
|
|
39714
|
+
const cwd = options.cwd ? path102.resolve(options.cwd) : process.cwd();
|
|
39680
39715
|
clack3.intro("BetterStart Seed");
|
|
39681
39716
|
let config;
|
|
39682
39717
|
try {
|
|
@@ -39752,15 +39787,15 @@ async function runSeedCommand(options) {
|
|
|
39752
39787
|
}
|
|
39753
39788
|
name = nameInput;
|
|
39754
39789
|
}
|
|
39755
|
-
const scriptsDir =
|
|
39756
|
-
const seedPath =
|
|
39757
|
-
if (!
|
|
39758
|
-
|
|
39790
|
+
const scriptsDir = path102.join(cwd, adminDir, "scripts");
|
|
39791
|
+
const seedPath = path102.join(scriptsDir, "seed.ts");
|
|
39792
|
+
if (!fs86.existsSync(scriptsDir)) {
|
|
39793
|
+
fs86.mkdirSync(scriptsDir, { recursive: true });
|
|
39759
39794
|
}
|
|
39760
39795
|
const namespace = resolveAdminNamespace(config.frameworkConfig.next.namespace);
|
|
39761
|
-
|
|
39796
|
+
fs86.writeFileSync(seedPath, buildSeedScript(`${namespace.apiPath}/auth`), "utf-8");
|
|
39762
39797
|
const { execFile: execFile2 } = await import("child_process");
|
|
39763
|
-
const tsxBin =
|
|
39798
|
+
const tsxBin = path102.join(cwd, "node_modules", ".bin", "tsx");
|
|
39764
39799
|
const runSeed2 = (overwrite) => new Promise((resolve, reject) => {
|
|
39765
39800
|
execFile2(
|
|
39766
39801
|
tsxBin,
|
|
@@ -39798,7 +39833,7 @@ async function runSeedCommand(options) {
|
|
|
39798
39833
|
`An admin account (${existingName}) already exists for ${email}. Replacing it needs a terminal.`
|
|
39799
39834
|
);
|
|
39800
39835
|
try {
|
|
39801
|
-
|
|
39836
|
+
fs86.unlinkSync(seedPath);
|
|
39802
39837
|
} catch {
|
|
39803
39838
|
}
|
|
39804
39839
|
process.exit(1);
|
|
@@ -39809,7 +39844,7 @@ async function runSeedCommand(options) {
|
|
|
39809
39844
|
if (clack3.isCancel(overwrite) || !overwrite) {
|
|
39810
39845
|
clack3.cancel("Seed cancelled.");
|
|
39811
39846
|
try {
|
|
39812
|
-
|
|
39847
|
+
fs86.unlinkSync(seedPath);
|
|
39813
39848
|
} catch {
|
|
39814
39849
|
}
|
|
39815
39850
|
return;
|
|
@@ -39826,15 +39861,15 @@ async function runSeedCommand(options) {
|
|
|
39826
39861
|
clack3.log.error(errMsg);
|
|
39827
39862
|
clack3.log.info("You can run the seed script manually:");
|
|
39828
39863
|
clack3.log.info(
|
|
39829
|
-
` SEED_EMAIL="${email}" SEED_PASSWORD="..." npx tsx ${
|
|
39864
|
+
` SEED_EMAIL="${email}" SEED_PASSWORD="..." npx tsx ${path102.relative(cwd, seedPath)}`
|
|
39830
39865
|
);
|
|
39831
39866
|
clack3.outro("");
|
|
39832
39867
|
process.exit(1);
|
|
39833
39868
|
}
|
|
39834
39869
|
try {
|
|
39835
|
-
|
|
39836
|
-
if (
|
|
39837
|
-
|
|
39870
|
+
fs86.unlinkSync(seedPath);
|
|
39871
|
+
if (fs86.existsSync(scriptsDir) && fs86.readdirSync(scriptsDir).length === 0) {
|
|
39872
|
+
fs86.rmdirSync(scriptsDir);
|
|
39838
39873
|
}
|
|
39839
39874
|
} catch {
|
|
39840
39875
|
}
|
|
@@ -39843,18 +39878,18 @@ async function runSeedCommand(options) {
|
|
|
39843
39878
|
|
|
39844
39879
|
// adapters/next/commands/uninstall/run-uninstall-command.ts
|
|
39845
39880
|
import * as p65 from "@clack/prompts";
|
|
39846
|
-
import
|
|
39881
|
+
import path104 from "path";
|
|
39847
39882
|
import pc19 from "picocolors";
|
|
39848
39883
|
|
|
39849
39884
|
// adapters/next/commands/uninstall/build-uninstall-plan.ts
|
|
39850
|
-
import
|
|
39851
|
-
import
|
|
39885
|
+
import fs91 from "fs";
|
|
39886
|
+
import path103 from "path";
|
|
39852
39887
|
|
|
39853
39888
|
// adapters/next/commands/uninstall-cleaners/clean-css.ts
|
|
39854
|
-
import
|
|
39889
|
+
import fs87 from "fs";
|
|
39855
39890
|
function cleanCss(cssPath, namespace = "admin") {
|
|
39856
|
-
if (!
|
|
39857
|
-
const content =
|
|
39891
|
+
if (!fs87.existsSync(cssPath)) return [];
|
|
39892
|
+
const content = fs87.readFileSync(cssPath, "utf-8");
|
|
39858
39893
|
const lines = content.split("\n");
|
|
39859
39894
|
const sourcePattern = new RegExp(`^@source\\s+"[^"]*(?:admin|${namespace})[^"]*";\\s*$`);
|
|
39860
39895
|
const removed = [];
|
|
@@ -39868,15 +39903,15 @@ function cleanCss(cssPath, namespace = "admin") {
|
|
|
39868
39903
|
}
|
|
39869
39904
|
if (removed.length === 0) return [];
|
|
39870
39905
|
const cleaned = kept.join("\n").replace(/\n{3,}/g, "\n\n");
|
|
39871
|
-
|
|
39906
|
+
fs87.writeFileSync(cssPath, cleaned, "utf-8");
|
|
39872
39907
|
return removed;
|
|
39873
39908
|
}
|
|
39874
39909
|
|
|
39875
39910
|
// adapters/next/commands/uninstall-cleaners/clean-env-file.ts
|
|
39876
|
-
import
|
|
39911
|
+
import fs88 from "fs";
|
|
39877
39912
|
function cleanEnvFile(envPath) {
|
|
39878
|
-
if (!
|
|
39879
|
-
const content =
|
|
39913
|
+
if (!fs88.existsSync(envPath)) return [];
|
|
39914
|
+
const content = fs88.readFileSync(envPath, "utf-8");
|
|
39880
39915
|
const lines = content.split("\n");
|
|
39881
39916
|
const removed = [];
|
|
39882
39917
|
const kept = [];
|
|
@@ -39909,19 +39944,19 @@ function cleanEnvFile(envPath) {
|
|
|
39909
39944
|
if (removed.length === 0) return [];
|
|
39910
39945
|
const result = kept.join("\n").replace(/\n{3,}/g, "\n\n").trim();
|
|
39911
39946
|
if (result === "") {
|
|
39912
|
-
|
|
39947
|
+
fs88.unlinkSync(envPath);
|
|
39913
39948
|
} else {
|
|
39914
|
-
|
|
39949
|
+
fs88.writeFileSync(envPath, `${result}
|
|
39915
39950
|
`, "utf-8");
|
|
39916
39951
|
}
|
|
39917
39952
|
return removed;
|
|
39918
39953
|
}
|
|
39919
39954
|
|
|
39920
39955
|
// adapters/next/commands/uninstall-cleaners/clean-tsconfig.ts
|
|
39921
|
-
import
|
|
39956
|
+
import fs89 from "fs";
|
|
39922
39957
|
function cleanTsconfig(tsconfigPath, aliasRoot = "@admin") {
|
|
39923
|
-
if (!
|
|
39924
|
-
const raw =
|
|
39958
|
+
if (!fs89.existsSync(tsconfigPath)) return [];
|
|
39959
|
+
const raw = fs89.readFileSync(tsconfigPath, "utf-8");
|
|
39925
39960
|
const stripped = toStrictJson(raw);
|
|
39926
39961
|
let tsconfig;
|
|
39927
39962
|
try {
|
|
@@ -39945,17 +39980,17 @@ function cleanTsconfig(tsconfigPath, aliasRoot = "@admin") {
|
|
|
39945
39980
|
compilerOptions.paths = paths;
|
|
39946
39981
|
}
|
|
39947
39982
|
tsconfig.compilerOptions = compilerOptions;
|
|
39948
|
-
|
|
39983
|
+
fs89.writeFileSync(tsconfigPath, `${JSON.stringify(tsconfig, null, 2)}
|
|
39949
39984
|
`, "utf-8");
|
|
39950
39985
|
return removed;
|
|
39951
39986
|
}
|
|
39952
39987
|
|
|
39953
39988
|
// adapters/next/commands/uninstall/is-cli-created-oxc-config.ts
|
|
39954
|
-
import
|
|
39989
|
+
import fs90 from "fs";
|
|
39955
39990
|
function isCLICreatedOxcConfig(configPath) {
|
|
39956
|
-
if (!
|
|
39991
|
+
if (!fs90.existsSync(configPath)) return false;
|
|
39957
39992
|
try {
|
|
39958
|
-
const content = JSON.parse(
|
|
39993
|
+
const content = JSON.parse(fs90.readFileSync(configPath, "utf-8"));
|
|
39959
39994
|
return typeof content.$schema === "string" && content.$schema.includes("node_modules/ox") && Array.isArray(content.ignorePatterns) && content.ignorePatterns.includes("**/.betterstart/snapshots/**/files/**");
|
|
39960
39995
|
} catch {
|
|
39961
39996
|
return false;
|
|
@@ -39966,17 +40001,17 @@ function isCLICreatedOxcConfig(configPath) {
|
|
|
39966
40001
|
function buildUninstallPlan(cwd, namespaceValue) {
|
|
39967
40002
|
const steps = [];
|
|
39968
40003
|
const namespace = resolveAdminNamespace(namespaceValue);
|
|
39969
|
-
const hasSrc =
|
|
40004
|
+
const hasSrc = fs91.existsSync(path103.join(cwd, "src"));
|
|
39970
40005
|
const appBase = hasSrc ? "src/app" : "app";
|
|
39971
40006
|
const dirs = [];
|
|
39972
|
-
const adminDir =
|
|
39973
|
-
const legacyAdminDir =
|
|
39974
|
-
const adminRouteGroup =
|
|
39975
|
-
const legacyAdminRouteGroup =
|
|
39976
|
-
if (
|
|
39977
|
-
if (namespace.segment !== "admin" &&
|
|
39978
|
-
if (
|
|
39979
|
-
if (namespace.segment !== "admin" &&
|
|
40007
|
+
const adminDir = path103.join(cwd, namespace.segment);
|
|
40008
|
+
const legacyAdminDir = path103.join(cwd, "admin");
|
|
40009
|
+
const adminRouteGroup = path103.join(cwd, appBase, namespace.routeGroup);
|
|
40010
|
+
const legacyAdminRouteGroup = path103.join(cwd, appBase, "(admin)");
|
|
40011
|
+
if (fs91.existsSync(adminDir)) dirs.push(`${namespace.segment}/`);
|
|
40012
|
+
if (namespace.segment !== "admin" && fs91.existsSync(legacyAdminDir)) dirs.push("admin/");
|
|
40013
|
+
if (fs91.existsSync(adminRouteGroup)) dirs.push(`${appBase}/${namespace.routeGroup}/`);
|
|
40014
|
+
if (namespace.segment !== "admin" && fs91.existsSync(legacyAdminRouteGroup))
|
|
39980
40015
|
dirs.push(`${appBase}/(admin)/`);
|
|
39981
40016
|
if (dirs.length > 0) {
|
|
39982
40017
|
steps.push({
|
|
@@ -39985,14 +40020,14 @@ function buildUninstallPlan(cwd, namespaceValue) {
|
|
|
39985
40020
|
count: dirs.length,
|
|
39986
40021
|
unit: dirs.length === 1 ? "directory" : "directories",
|
|
39987
40022
|
execute() {
|
|
39988
|
-
if (
|
|
39989
|
-
if (
|
|
39990
|
-
|
|
39991
|
-
if (
|
|
39992
|
-
|
|
40023
|
+
if (fs91.existsSync(adminDir)) fs91.rmSync(adminDir, { recursive: true, force: true });
|
|
40024
|
+
if (fs91.existsSync(legacyAdminDir))
|
|
40025
|
+
fs91.rmSync(legacyAdminDir, { recursive: true, force: true });
|
|
40026
|
+
if (fs91.existsSync(adminRouteGroup)) {
|
|
40027
|
+
fs91.rmSync(adminRouteGroup, { recursive: true, force: true });
|
|
39993
40028
|
}
|
|
39994
|
-
if (
|
|
39995
|
-
|
|
40029
|
+
if (fs91.existsSync(legacyAdminRouteGroup)) {
|
|
40030
|
+
fs91.rmSync(legacyAdminRouteGroup, { recursive: true, force: true });
|
|
39996
40031
|
}
|
|
39997
40032
|
}
|
|
39998
40033
|
});
|
|
@@ -40000,18 +40035,18 @@ function buildUninstallPlan(cwd, namespaceValue) {
|
|
|
40000
40035
|
const configFiles = [];
|
|
40001
40036
|
const configPaths = [];
|
|
40002
40037
|
const candidates = [
|
|
40003
|
-
[CONFIG_FILE_NAME,
|
|
40004
|
-
["drizzle.config.ts",
|
|
40005
|
-
["ADMIN.md",
|
|
40038
|
+
[CONFIG_FILE_NAME, path103.join(cwd, CONFIG_FILE_NAME)],
|
|
40039
|
+
["drizzle.config.ts", path103.join(cwd, "drizzle.config.ts")],
|
|
40040
|
+
["ADMIN.md", path103.join(cwd, "ADMIN.md")]
|
|
40006
40041
|
];
|
|
40007
40042
|
for (const [label, fullPath] of candidates) {
|
|
40008
|
-
if (
|
|
40043
|
+
if (fs91.existsSync(fullPath)) {
|
|
40009
40044
|
configFiles.push(label);
|
|
40010
40045
|
configPaths.push(fullPath);
|
|
40011
40046
|
}
|
|
40012
40047
|
}
|
|
40013
40048
|
for (const fileName of [".oxfmtrc.json", ".oxlintrc.json"]) {
|
|
40014
|
-
const configPath =
|
|
40049
|
+
const configPath = path103.join(cwd, fileName);
|
|
40015
40050
|
if (isCLICreatedOxcConfig(configPath)) {
|
|
40016
40051
|
configFiles.push(`${fileName} (CLI-created)`);
|
|
40017
40052
|
configPaths.push(configPath);
|
|
@@ -40025,14 +40060,14 @@ function buildUninstallPlan(cwd, namespaceValue) {
|
|
|
40025
40060
|
unit: configFiles.length === 1 ? "file" : "files",
|
|
40026
40061
|
execute() {
|
|
40027
40062
|
for (const p67 of configPaths) {
|
|
40028
|
-
if (
|
|
40063
|
+
if (fs91.existsSync(p67)) fs91.unlinkSync(p67);
|
|
40029
40064
|
}
|
|
40030
40065
|
}
|
|
40031
40066
|
});
|
|
40032
40067
|
}
|
|
40033
|
-
const tsconfigPath =
|
|
40034
|
-
if (
|
|
40035
|
-
const content =
|
|
40068
|
+
const tsconfigPath = path103.join(cwd, "tsconfig.json");
|
|
40069
|
+
if (fs91.existsSync(tsconfigPath)) {
|
|
40070
|
+
const content = fs91.readFileSync(tsconfigPath, "utf-8");
|
|
40036
40071
|
const aliasMatches = [
|
|
40037
40072
|
...content.match(/"@admin\//g) ?? [],
|
|
40038
40073
|
...content.match(new RegExp(`"${namespace.alias}/`, "g")) ?? []
|
|
@@ -40052,12 +40087,12 @@ function buildUninstallPlan(cwd, namespaceValue) {
|
|
|
40052
40087
|
}
|
|
40053
40088
|
const cssFile = findMainCss(cwd);
|
|
40054
40089
|
if (cssFile) {
|
|
40055
|
-
const cssContent =
|
|
40090
|
+
const cssContent = fs91.readFileSync(cssFile, "utf-8");
|
|
40056
40091
|
const sourceLines = cssContent.split("\n").filter(
|
|
40057
40092
|
(l) => new RegExp(`^@source\\s+"[^"]*(?:admin|${namespace.segment})[^"]*";\\s*$`).test(l)
|
|
40058
40093
|
);
|
|
40059
40094
|
if (sourceLines.length > 0) {
|
|
40060
|
-
const relCss =
|
|
40095
|
+
const relCss = path103.relative(cwd, cssFile);
|
|
40061
40096
|
steps.push({
|
|
40062
40097
|
label: `CSS @source lines (${relCss})`,
|
|
40063
40098
|
items: [`@source lines in ${relCss}`],
|
|
@@ -40069,9 +40104,9 @@ function buildUninstallPlan(cwd, namespaceValue) {
|
|
|
40069
40104
|
});
|
|
40070
40105
|
}
|
|
40071
40106
|
}
|
|
40072
|
-
const envPath =
|
|
40073
|
-
if (
|
|
40074
|
-
const envContent =
|
|
40107
|
+
const envPath = path103.join(cwd, ".env.local");
|
|
40108
|
+
if (fs91.existsSync(envPath)) {
|
|
40109
|
+
const envContent = fs91.readFileSync(envPath, "utf-8");
|
|
40075
40110
|
const bsVars = envContent.split("\n").filter((l) => l.trim().match(/^BETTERSTART_\w+=/)).map((l) => l.split("=")[0]);
|
|
40076
40111
|
if (bsVars.length > 0) {
|
|
40077
40112
|
steps.push({
|
|
@@ -40090,7 +40125,7 @@ function buildUninstallPlan(cwd, namespaceValue) {
|
|
|
40090
40125
|
|
|
40091
40126
|
// adapters/next/commands/uninstall/run-uninstall-command.ts
|
|
40092
40127
|
async function runUninstallCommand(options) {
|
|
40093
|
-
const cwd = options.cwd ?
|
|
40128
|
+
const cwd = options.cwd ? path104.resolve(options.cwd) : process.cwd();
|
|
40094
40129
|
p65.intro(pc19.bgRed(pc19.white(" BetterStart Uninstall ")));
|
|
40095
40130
|
let namespace = DEFAULT_ADMIN_NAMESPACE;
|
|
40096
40131
|
try {
|
|
@@ -40134,8 +40169,8 @@ async function runUninstallCommand(options) {
|
|
|
40134
40169
|
|
|
40135
40170
|
// adapters/next/commands/update-component/run-update-command.ts
|
|
40136
40171
|
import * as clack8 from "@clack/prompts";
|
|
40137
|
-
import
|
|
40138
|
-
import
|
|
40172
|
+
import fs97 from "fs";
|
|
40173
|
+
import path110 from "path";
|
|
40139
40174
|
|
|
40140
40175
|
// adapters/next/integration-runtime/sync-installed-integration-manifests.ts
|
|
40141
40176
|
function syncInstalledIntegrationManifests(cwd, config) {
|
|
@@ -40165,63 +40200,63 @@ function applyNamespaceToTemplateEntry(entry, config, cwd) {
|
|
|
40165
40200
|
}
|
|
40166
40201
|
|
|
40167
40202
|
// adapters/next/commands/update-component/copy-namespaced-directory.ts
|
|
40168
|
-
import
|
|
40169
|
-
import
|
|
40203
|
+
import fs93 from "fs";
|
|
40204
|
+
import path105 from "path";
|
|
40170
40205
|
import fsExtra from "fs-extra";
|
|
40171
40206
|
|
|
40172
40207
|
// adapters/next/commands/update-component/write-namespaced-file.ts
|
|
40173
|
-
import
|
|
40208
|
+
import fs92 from "fs";
|
|
40174
40209
|
function writeNamespacedFile(srcPath, destPath, namespace) {
|
|
40175
|
-
|
|
40210
|
+
fs92.writeFileSync(
|
|
40176
40211
|
destPath,
|
|
40177
|
-
applyAdminNamespaceToContent(
|
|
40212
|
+
applyAdminNamespaceToContent(fs92.readFileSync(srcPath, "utf-8"), namespace),
|
|
40178
40213
|
"utf-8"
|
|
40179
40214
|
);
|
|
40180
40215
|
}
|
|
40181
40216
|
|
|
40182
40217
|
// adapters/next/commands/update-component/copy-namespaced-directory.ts
|
|
40183
40218
|
function copyNamespacedDirectory(srcDir, destDir, namespace) {
|
|
40184
|
-
const entries =
|
|
40219
|
+
const entries = fs93.readdirSync(srcDir, { withFileTypes: true });
|
|
40185
40220
|
for (const entry of entries) {
|
|
40186
40221
|
const namespacedName = applyAdminNamespaceToPath(entry.name, namespace);
|
|
40187
|
-
const srcPath =
|
|
40188
|
-
const destPath =
|
|
40222
|
+
const srcPath = path105.join(srcDir, entry.name);
|
|
40223
|
+
const destPath = path105.join(destDir, namespacedName);
|
|
40189
40224
|
if (entry.isDirectory()) {
|
|
40190
40225
|
fsExtra.ensureDirSync(destPath);
|
|
40191
40226
|
copyNamespacedDirectory(srcPath, destPath, namespace);
|
|
40192
40227
|
continue;
|
|
40193
40228
|
}
|
|
40194
|
-
fsExtra.ensureDirSync(
|
|
40229
|
+
fsExtra.ensureDirSync(path105.dirname(destPath));
|
|
40195
40230
|
writeNamespacedFile(srcPath, destPath, namespace);
|
|
40196
40231
|
}
|
|
40197
40232
|
}
|
|
40198
40233
|
|
|
40199
40234
|
// adapters/next/commands/update-component/find-static-asset-file.ts
|
|
40200
|
-
import
|
|
40201
|
-
import
|
|
40235
|
+
import fs94 from "fs";
|
|
40236
|
+
import path106 from "path";
|
|
40202
40237
|
function findStaticAssetFile(assetDir, componentName) {
|
|
40203
|
-
if (!
|
|
40238
|
+
if (!fs94.existsSync(assetDir)) return void 0;
|
|
40204
40239
|
const isNestedComponentName = /[\\/]/.test(componentName);
|
|
40205
|
-
const nestedComponentName = componentName.split(/[\\/]/).filter(Boolean).join(
|
|
40206
|
-
if (isNestedComponentName && nestedComponentName && !
|
|
40240
|
+
const nestedComponentName = componentName.split(/[\\/]/).filter(Boolean).join(path106.sep);
|
|
40241
|
+
if (isNestedComponentName && nestedComponentName && !path106.isAbsolute(componentName) && !nestedComponentName.split(path106.sep).includes("..")) {
|
|
40207
40242
|
for (const extension of [".tsx", ".ts"]) {
|
|
40208
40243
|
const relPath = `${nestedComponentName}${extension}`;
|
|
40209
|
-
const filePath =
|
|
40210
|
-
if (
|
|
40244
|
+
const filePath = path106.join(assetDir, relPath);
|
|
40245
|
+
if (fs94.existsSync(filePath) && fs94.statSync(filePath).isFile()) {
|
|
40211
40246
|
return relPath;
|
|
40212
40247
|
}
|
|
40213
40248
|
}
|
|
40214
40249
|
}
|
|
40215
|
-
if (!isNestedComponentName && !componentName.includes("..") && !
|
|
40250
|
+
if (!isNestedComponentName && !componentName.includes("..") && !path106.isAbsolute(componentName)) {
|
|
40216
40251
|
for (const extension of [".tsx", ".ts"]) {
|
|
40217
|
-
const relPath =
|
|
40218
|
-
const filePath =
|
|
40219
|
-
if (
|
|
40252
|
+
const relPath = path106.join(componentName, `index${extension}`);
|
|
40253
|
+
const filePath = path106.join(assetDir, relPath);
|
|
40254
|
+
if (fs94.existsSync(filePath) && fs94.statSync(filePath).isFile()) {
|
|
40220
40255
|
return relPath;
|
|
40221
40256
|
}
|
|
40222
40257
|
}
|
|
40223
40258
|
}
|
|
40224
|
-
return
|
|
40259
|
+
return fs94.readdirSync(assetDir, { withFileTypes: true }).find(
|
|
40225
40260
|
(entry) => entry.isFile() && (entry.name.endsWith(".tsx") || entry.name.endsWith(".ts")) && entry.name.replace(/\.(tsx|ts)$/, "") === componentName
|
|
40226
40261
|
)?.name;
|
|
40227
40262
|
}
|
|
@@ -40263,8 +40298,8 @@ function normalizeShadcnPresetOnly(value) {
|
|
|
40263
40298
|
// adapters/next/commands/update-component/run-shadcn-preset-update.ts
|
|
40264
40299
|
import * as clack6 from "@clack/prompts";
|
|
40265
40300
|
import { execFileSync as execFileSync4 } from "child_process";
|
|
40266
|
-
import
|
|
40267
|
-
import
|
|
40301
|
+
import fs96 from "fs";
|
|
40302
|
+
import path109 from "path";
|
|
40268
40303
|
|
|
40269
40304
|
// adapters/next/commands/update-component/create-admin-shadcn-components-json.ts
|
|
40270
40305
|
function createAdminShadcnComponentsJson(config) {
|
|
@@ -40295,7 +40330,7 @@ function createAdminShadcnComponentsJson(config) {
|
|
|
40295
40330
|
}
|
|
40296
40331
|
|
|
40297
40332
|
// adapters/next/commands/update-component/get-host-project-files-to-restore.ts
|
|
40298
|
-
import
|
|
40333
|
+
import path107 from "path";
|
|
40299
40334
|
function getHostProjectFilesToRestore(cwd) {
|
|
40300
40335
|
const hostRelativePaths = [
|
|
40301
40336
|
"app/layout.tsx",
|
|
@@ -40309,17 +40344,17 @@ function getHostProjectFilesToRestore(cwd) {
|
|
|
40309
40344
|
"app/globals.css",
|
|
40310
40345
|
"src/app/globals.css"
|
|
40311
40346
|
];
|
|
40312
|
-
return hostRelativePaths.map((relativePath) =>
|
|
40347
|
+
return hostRelativePaths.map((relativePath) => path107.join(cwd, relativePath));
|
|
40313
40348
|
}
|
|
40314
40349
|
|
|
40315
40350
|
// adapters/next/commands/update-component/resolve-local-shadcn-bin.ts
|
|
40316
40351
|
import * as clack5 from "@clack/prompts";
|
|
40317
|
-
import
|
|
40318
|
-
import
|
|
40352
|
+
import fs95 from "fs";
|
|
40353
|
+
import path108 from "path";
|
|
40319
40354
|
function resolveLocalShadcnBin(cwd) {
|
|
40320
40355
|
const binName = process.platform === "win32" ? "shadcn.cmd" : "shadcn";
|
|
40321
|
-
const shadcnBin =
|
|
40322
|
-
if (!
|
|
40356
|
+
const shadcnBin = path108.join(cwd, "node_modules", ".bin", binName);
|
|
40357
|
+
if (!fs95.existsSync(shadcnBin)) {
|
|
40323
40358
|
clack5.cancel(
|
|
40324
40359
|
`shadcn is not installed in this project. Run 'betterstart update-deps' and try again.`
|
|
40325
40360
|
);
|
|
@@ -40336,22 +40371,22 @@ function runShadcnPresetUpdate({
|
|
|
40336
40371
|
only
|
|
40337
40372
|
}) {
|
|
40338
40373
|
const namespace = resolveAdminNamespace(config.frameworkConfig.next.namespace);
|
|
40339
|
-
const adminGlobalsPath =
|
|
40340
|
-
const componentsJsonPath =
|
|
40374
|
+
const adminGlobalsPath = path109.join(cwd, config.paths.admin, namespace.globalsFile);
|
|
40375
|
+
const componentsJsonPath = path109.join(cwd, "components.json");
|
|
40341
40376
|
const shadcnBackupPath = `${componentsJsonPath}.bak`;
|
|
40342
40377
|
const restoreAfterApplyPaths = [
|
|
40343
40378
|
componentsJsonPath,
|
|
40344
40379
|
shadcnBackupPath,
|
|
40345
|
-
|
|
40380
|
+
path109.join(cwd, config.paths.admin, "lib", "utils.ts"),
|
|
40346
40381
|
...getHostProjectFilesToRestore(cwd)
|
|
40347
40382
|
];
|
|
40348
40383
|
if (!preset) {
|
|
40349
40384
|
clack6.cancel("--shadcn-preset requires a preset code, preset name, or preset URL.");
|
|
40350
40385
|
process.exit(1);
|
|
40351
40386
|
}
|
|
40352
|
-
if (!
|
|
40387
|
+
if (!fs96.existsSync(adminGlobalsPath)) {
|
|
40353
40388
|
clack6.cancel(
|
|
40354
|
-
`Admin globals file not found at ${
|
|
40389
|
+
`Admin globals file not found at ${path109.relative(cwd, adminGlobalsPath)}. Run 'betterstart update admin-globals' first.`
|
|
40355
40390
|
);
|
|
40356
40391
|
process.exit(1);
|
|
40357
40392
|
}
|
|
@@ -40361,10 +40396,10 @@ function runShadcnPresetUpdate({
|
|
|
40361
40396
|
snapshot: captureFile(filePath)
|
|
40362
40397
|
}));
|
|
40363
40398
|
clack6.intro("BetterStart Shadcn Preset");
|
|
40364
|
-
clack6.log.info(`Applying preset to ${
|
|
40399
|
+
clack6.log.info(`Applying preset to ${path109.join(config.paths.admin, "components/ui")}`);
|
|
40365
40400
|
let failed = false;
|
|
40366
40401
|
try {
|
|
40367
|
-
|
|
40402
|
+
fs96.writeFileSync(
|
|
40368
40403
|
componentsJsonPath,
|
|
40369
40404
|
`${JSON.stringify(createAdminShadcnComponentsJson(config), null, 2)}
|
|
40370
40405
|
`,
|
|
@@ -40417,7 +40452,7 @@ function validateShadcnPresetOptions(components, options) {
|
|
|
40417
40452
|
|
|
40418
40453
|
// adapters/next/commands/update-component/run-update-command.ts
|
|
40419
40454
|
async function runUpdateCommand(components, options) {
|
|
40420
|
-
const cwd = options.cwd ?
|
|
40455
|
+
const cwd = options.cwd ? path110.resolve(options.cwd) : process.cwd();
|
|
40421
40456
|
const normalizedOnly = normalizeShadcnPresetOnly(options.only);
|
|
40422
40457
|
validateShadcnPresetOptions(components, options);
|
|
40423
40458
|
if (options.json && !options.list) {
|
|
@@ -40478,8 +40513,8 @@ async function runUpdateCommand(components, options) {
|
|
|
40478
40513
|
return;
|
|
40479
40514
|
}
|
|
40480
40515
|
const config = await resolveConfigOrExit(cwd);
|
|
40481
|
-
const admin =
|
|
40482
|
-
if (!
|
|
40516
|
+
const admin = path110.resolve(cwd, config.paths.admin);
|
|
40517
|
+
if (!fs97.existsSync(admin)) {
|
|
40483
40518
|
clack8.cancel(
|
|
40484
40519
|
`Admin directory not found at ${config.paths.admin}. Run 'betterstart init' first.`
|
|
40485
40520
|
);
|
|
@@ -40533,8 +40568,8 @@ async function runUpdateCommand(components, options) {
|
|
|
40533
40568
|
}
|
|
40534
40569
|
const { relPath, content } = applyNamespaceToTemplateEntry(entry, config, cwd);
|
|
40535
40570
|
const baseDir = entry.base === "cwd" ? cwd : admin;
|
|
40536
|
-
const destPath =
|
|
40537
|
-
if (entry.preserveExisting &&
|
|
40571
|
+
const destPath = path110.join(baseDir, relPath);
|
|
40572
|
+
if (entry.preserveExisting && fs97.existsSync(destPath)) {
|
|
40538
40573
|
clack8.log.info(`Preserved ${relPath}`);
|
|
40539
40574
|
updatedTemplateNames.add(name);
|
|
40540
40575
|
skipped++;
|
|
@@ -40543,8 +40578,8 @@ async function runUpdateCommand(components, options) {
|
|
|
40543
40578
|
pendingWrites.push({
|
|
40544
40579
|
displayPath: relPath,
|
|
40545
40580
|
write: () => {
|
|
40546
|
-
fsExtra2.ensureDirSync(
|
|
40547
|
-
|
|
40581
|
+
fsExtra2.ensureDirSync(path110.dirname(destPath));
|
|
40582
|
+
fs97.writeFileSync(destPath, content, "utf-8");
|
|
40548
40583
|
clack8.log.success(`Updated ${relPath}`);
|
|
40549
40584
|
}
|
|
40550
40585
|
});
|
|
@@ -40575,20 +40610,20 @@ async function runUpdateCommand(components, options) {
|
|
|
40575
40610
|
}
|
|
40576
40611
|
const namespace = config.frameworkConfig.next.namespace;
|
|
40577
40612
|
const namespacedAssetFile = applyAdminNamespaceToPath(assetFile, namespace);
|
|
40578
|
-
const destPath =
|
|
40613
|
+
const destPath = path110.join(admin, "components", assetDirectory, namespacedAssetFile);
|
|
40579
40614
|
pendingWrites.push({
|
|
40580
40615
|
displayPath: `components/${assetDirectory}/${namespacedAssetFile}`,
|
|
40581
40616
|
write: () => {
|
|
40582
|
-
fsExtra2.ensureDirSync(
|
|
40583
|
-
writeNamespacedFile(
|
|
40617
|
+
fsExtra2.ensureDirSync(path110.dirname(destPath));
|
|
40618
|
+
writeNamespacedFile(path110.join(assetDir, assetFile), destPath, namespace);
|
|
40584
40619
|
clack8.log.success(`Updated components/${assetDirectory}/${namespacedAssetFile}`);
|
|
40585
40620
|
}
|
|
40586
40621
|
});
|
|
40587
40622
|
if (assetDirectory === "custom") {
|
|
40588
|
-
const assetSubdir =
|
|
40589
|
-
if (
|
|
40623
|
+
const assetSubdir = path110.join(assetDir, name);
|
|
40624
|
+
if (fs97.existsSync(assetSubdir) && fs97.statSync(assetSubdir).isDirectory()) {
|
|
40590
40625
|
const namespacedName = applyAdminNamespaceToPath(name, namespace);
|
|
40591
|
-
const destSubdir =
|
|
40626
|
+
const destSubdir = path110.join(admin, "components", assetDirectory, namespacedName);
|
|
40592
40627
|
pendingWrites.push({
|
|
40593
40628
|
displayPath: `components/${assetDirectory}/${namespacedName}/ (template files)`,
|
|
40594
40629
|
write: () => {
|
|
@@ -40623,19 +40658,19 @@ async function runUpdateCommand(components, options) {
|
|
|
40623
40658
|
"content-editor"
|
|
40624
40659
|
);
|
|
40625
40660
|
const namespace = config.frameworkConfig.next.namespace;
|
|
40626
|
-
const destBaseDir =
|
|
40627
|
-
if (!
|
|
40661
|
+
const destBaseDir = path110.join(admin, "components", "custom", "content-editor");
|
|
40662
|
+
if (!fs97.existsSync(srcBaseDir)) {
|
|
40628
40663
|
return false;
|
|
40629
40664
|
}
|
|
40630
40665
|
const dirsToCopy = [];
|
|
40631
40666
|
for (const directory of TIPTAP_CONTENT_EDITOR_DIRECTORIES) {
|
|
40632
|
-
const srcDir =
|
|
40633
|
-
if (!
|
|
40667
|
+
const srcDir = path110.join(srcBaseDir, directory);
|
|
40668
|
+
if (!fs97.existsSync(srcDir)) {
|
|
40634
40669
|
continue;
|
|
40635
40670
|
}
|
|
40636
40671
|
dirsToCopy.push({
|
|
40637
40672
|
srcDir,
|
|
40638
|
-
destDir:
|
|
40673
|
+
destDir: path110.join(destBaseDir, applyAdminNamespaceToPath(directory, namespace))
|
|
40639
40674
|
});
|
|
40640
40675
|
}
|
|
40641
40676
|
if (dirsToCopy.length === 0) {
|
|
@@ -40649,7 +40684,7 @@ async function runUpdateCommand(components, options) {
|
|
|
40649
40684
|
copyNamespacedDirectory(srcDir, destDir, namespace);
|
|
40650
40685
|
}
|
|
40651
40686
|
clack8.log.success("Updated components/custom/content-editor/tiptap-*/ (template files)");
|
|
40652
|
-
removePath(admin,
|
|
40687
|
+
removePath(admin, path110.join(admin, "components", "custom", "tiptap"));
|
|
40653
40688
|
}
|
|
40654
40689
|
});
|
|
40655
40690
|
updatedStaticNames.add(key);
|
|
@@ -40746,7 +40781,7 @@ async function runUpdateCommand(components, options) {
|
|
|
40746
40781
|
|
|
40747
40782
|
// adapters/next/commands/update-deps.ts
|
|
40748
40783
|
import * as clack9 from "@clack/prompts";
|
|
40749
|
-
import
|
|
40784
|
+
import path111 from "path";
|
|
40750
40785
|
|
|
40751
40786
|
// adapters/next/integration-runtime/get-installed-integrations.ts
|
|
40752
40787
|
function getInstalledIntegrations(config) {
|
|
@@ -40760,7 +40795,7 @@ function getInstalledPresets(config) {
|
|
|
40760
40795
|
|
|
40761
40796
|
// adapters/next/commands/update-deps.ts
|
|
40762
40797
|
async function runUpdateDepsCommand(options) {
|
|
40763
|
-
const cwd = options.cwd ?
|
|
40798
|
+
const cwd = options.cwd ? path111.resolve(options.cwd) : process.cwd();
|
|
40764
40799
|
clack9.intro("BetterStart Update Dependencies");
|
|
40765
40800
|
const pm = detectPackageManager(cwd);
|
|
40766
40801
|
clack9.log.info(`Package manager: ${pm}`);
|
|
@@ -40795,25 +40830,25 @@ async function runUpdateDepsCommand(options) {
|
|
|
40795
40830
|
|
|
40796
40831
|
// adapters/next/commands/update-styles.ts
|
|
40797
40832
|
import * as clack10 from "@clack/prompts";
|
|
40798
|
-
import
|
|
40799
|
-
import
|
|
40833
|
+
import fs98 from "fs";
|
|
40834
|
+
import path112 from "path";
|
|
40800
40835
|
async function runUpdateStylesCommand(options) {
|
|
40801
|
-
const cwd = options.cwd ?
|
|
40836
|
+
const cwd = options.cwd ? path112.resolve(options.cwd) : process.cwd();
|
|
40802
40837
|
clack10.intro("BetterStart Update Styles");
|
|
40803
40838
|
const config = await resolveConfigOrExit(cwd);
|
|
40804
40839
|
const adminDir = config.paths.admin;
|
|
40805
40840
|
const namespace = resolveAdminNamespace(config.frameworkConfig.next.namespace);
|
|
40806
|
-
const targetPath =
|
|
40807
|
-
if (!
|
|
40808
|
-
clack10.cancel(`${namespace.globalsFile} not found at ${
|
|
40841
|
+
const targetPath = path112.join(cwd, adminDir, namespace.globalsFile);
|
|
40842
|
+
if (!fs98.existsSync(targetPath)) {
|
|
40843
|
+
clack10.cancel(`${namespace.globalsFile} not found at ${path112.relative(cwd, targetPath)}`);
|
|
40809
40844
|
process.exit(1);
|
|
40810
40845
|
}
|
|
40811
|
-
|
|
40846
|
+
fs98.writeFileSync(
|
|
40812
40847
|
targetPath,
|
|
40813
40848
|
applyAdminNamespaceToContent(readTemplate("admin-globals.css"), namespace.segment),
|
|
40814
40849
|
"utf-8"
|
|
40815
40850
|
);
|
|
40816
|
-
clack10.log.success(`Updated ${
|
|
40851
|
+
clack10.log.success(`Updated ${path112.relative(cwd, targetPath)}`);
|
|
40817
40852
|
clack10.outro("Styles updated");
|
|
40818
40853
|
}
|
|
40819
40854
|
|