@donotdev/cli 0.3.0 → 0.3.2
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/dependencies-matrix.json +51 -27
- package/dist/bin/commands/agent-setup.js +28 -18
- package/dist/bin/commands/build.js +1086 -58
- package/dist/bin/commands/bump.js +337 -53
- package/dist/bin/commands/cacheout.js +28 -18
- package/dist/bin/commands/coach.js +33 -25
- package/dist/bin/commands/create-app.js +597 -244
- package/dist/bin/commands/create-project.js +607 -254
- package/dist/bin/commands/db-check.js +37 -28
- package/dist/bin/commands/db.js +37 -28
- package/dist/bin/commands/deploy.js +13758 -11807
- package/dist/bin/commands/dev.js +50 -34
- package/dist/bin/commands/doctor.js +33 -25
- package/dist/bin/commands/emu.js +65 -43
- package/dist/bin/commands/format.js +28 -18
- package/dist/bin/commands/get-demo.js +81 -46
- package/dist/bin/commands/make-admin.js +966 -896
- package/dist/bin/commands/preview.js +50 -34
- package/dist/bin/commands/seed.js +37 -28
- package/dist/bin/commands/setup-cicd.js +1286 -87
- package/dist/bin/commands/setup.js +152 -138
- package/dist/bin/commands/staging.js +13758 -11807
- package/dist/bin/commands/sync-secrets.js +152 -132
- package/dist/bin/commands/type-check.js +1086 -39
- package/dist/bin/commands/wai.js +28 -18
- package/dist/bin/dndev.js +513 -30
- package/dist/bin/donotdev.js +33 -8
- package/dist/index.js +14568 -12497
- package/package.json +1 -1
- package/templates/app-demo/index.html.example +0 -1
- package/templates/app-demo/src/pages/ConditionalFormPage.tsx.example +2 -2
- package/templates/app-demo/src/pages/ShowcaseDetailPage.tsx.example +1 -0
- package/templates/app-demo/tsconfig.json.example +1 -1
- package/templates/app-dndev/index.html.example +1 -3
- package/templates/app-dndev/src/pages/NotFoundPage.tsx.example +1 -0
- package/templates/app-expo/app/_layout.tsx.example +1 -1
- package/templates/app-expo/app/form.tsx.example +10 -3
- package/templates/app-expo/app/index.tsx.example +3 -3
- package/templates/app-expo/app/list.tsx.example +2 -2
- package/templates/app-expo/app/profile.tsx.example +4 -3
- package/templates/app-expo/app/signin.tsx.example +2 -2
- package/templates/app-expo/babel.config.js.example +23 -6
- package/templates/app-expo/metro.config.js.example +7 -17
- package/templates/app-expo/tsconfig.json.example +2 -1
- package/templates/app-next/src/app/AppDocument.tsx.example +2 -3
- package/templates/app-vite/index.html.example +1 -3
- package/templates/app-vite/src/locales/home_en.json.example +6 -6
- package/templates/app-vite/src/pages/FormPageExample.tsx.example +1 -1
- package/templates/app-vite/src/pages/HomePage.tsx.example +3 -3
- package/templates/app-vite/src/pages/NotFoundPage.tsx.example +1 -0
- package/templates/deploy-config/firebase.json.example +6 -5
- package/templates/deploy-config/tsconfig.functions.json.example +2 -7
- package/templates/deploy-config/vercel.json.example +6 -420
- package/templates/functions-firebase/README.md.example +8 -8
- package/templates/functions-firebase/functions.config.js.example +2 -1
- package/templates/functions-firebase/src/index.ts.example +4 -3
- package/templates/functions-firebase/src/oauth/exchangeToken.ts.example +8 -6
- package/templates/functions-firebase/src/oauth/refreshToken.ts.example +8 -6
- package/templates/functions-firebase/tsconfig.json.example +3 -5
- package/templates/functions-supabase/supabase/config.toml.example +2 -1
- package/templates/functions-supabase/supabase/functions/change-plan/index.ts.example +2 -3
- package/templates/functions-supabase/supabase/functions/create-checkout-session/index.ts.example +2 -3
- package/templates/functions-supabase/supabase/functions/stripe-webhook/index.ts.example +2 -3
- package/templates/functions-vercel/README.md.example +15 -25
- package/templates/functions-vercel/build.mjs.example +4 -46
- package/templates/functions-vercel/src/api/auth/setCustomClaims.ts.example +6 -11
- package/templates/functions-vercel/src/api/billing/handleStripeWebhook.ts.example +2 -3
- package/templates/functions-vercel/src/api/oauth/checkGitHubAccess.ts.example +5 -11
- package/templates/functions-vercel/src/api/oauth/exchangeToken.ts.example +5 -11
- package/templates/functions-vercel/src/api/oauth/grantGitHubAccess.ts.example +5 -11
- package/templates/functions-vercel/tsconfig.json.example +5 -6
- package/templates/github/workflows/firebase-deploy.yml.example +1 -1
- package/templates/preset-admin/src/pages/DashboardPage.tsx.example +3 -2
- package/templates/preset-admin/src/pages/ReportsPage.tsx.example +13 -12
- package/templates/preset-admin/src/pages/SettingsPage.tsx.example +5 -5
- package/templates/preset-admin/src/pages/UsersPage.tsx.example +13 -12
- package/templates/preset-ecommerce/src/pages/CartPage.tsx.example +5 -5
- package/templates/preset-ecommerce/src/pages/CatalogPage.tsx.example +1 -4
- package/templates/preset-ecommerce/src/pages/CheckoutPage.tsx.example +10 -12
- package/templates/preset-ecommerce/src/pages/ProductPage.tsx.example +7 -4
- package/templates/preset-landing/src/pages/AboutPage.tsx.example +11 -9
- package/templates/preset-landing/src/pages/ContactPage.tsx.example +13 -7
- package/templates/preset-landing/src/pages/HomePage.tsx.example +50 -32
- package/templates/preset-saas/src/pages/DashboardPage.tsx.example +1 -1
- package/templates/preset-saas/src/pages/HomePage.tsx.example +3 -2
- package/templates/preset-saas/src/pages/PricingPage.tsx.example +4 -3
- package/templates/preset-saas/src/pages/ProfilePage.tsx.example +7 -7
- package/templates/preset-saas/src/pages/SettingsPage.tsx.example +3 -3
- package/templates/root-consumer/.claude/hooks/guard-bash.sh.example +101 -10
- package/templates/root-consumer/.claude/rules/definition-of-done.md.example +2 -2
- package/templates/root-consumer/.claude/rules/framework.md.example +1 -1
- package/templates/root-consumer/.claude/settings.json.example +0 -11
- package/templates/root-consumer/.claude/skills/build/SKILL.md.example +1 -1
- package/templates/root-consumer/.dndev/args.json.example +2 -2
- package/templates/root-consumer/.env.example +1 -1
- package/templates/root-consumer/.gitignore.example +2 -0
- package/templates/root-consumer/AGENTS.md.example +3 -3
- package/templates/root-consumer/README.md.example +1 -1
- package/templates/app-vite/csp.example.json +0 -44
- package/templates/functions-vercel/src/api/oauth/disconnect.ts.example +0 -20
- package/templates/functions-vercel/src/api/oauth/getConnections.ts.example +0 -20
- package/templates/functions-vercel/src/api/oauth/refreshToken.ts.example +0 -20
- package/templates/functions-vercel/vercel.json.example +0 -14
- package/templates/root-consumer/.claude/hooks/typecheck-stop.sh.example +0 -18
|
@@ -553,8 +553,8 @@ function wrapTextWithPrefix(e, r2, o, n3 = o, s = o, t2) {
|
|
|
553
553
|
trim: false
|
|
554
554
|
}).split(`
|
|
555
555
|
`).map((c3, a2, g) => {
|
|
556
|
-
const
|
|
557
|
-
return a2 === 0 ? `${n3}${
|
|
556
|
+
const m2 = t2 ? t2(c3, a2) : c3;
|
|
557
|
+
return a2 === 0 ? `${n3}${m2}` : a2 === g.length - 1 ? `${s}${m2}` : `${o}${m2}`;
|
|
558
558
|
}).join(`
|
|
559
559
|
`);
|
|
560
560
|
}
|
|
@@ -565,7 +565,7 @@ function runValidation(e, a2) {
|
|
|
565
565
|
}
|
|
566
566
|
return e(a2);
|
|
567
567
|
}
|
|
568
|
-
var a$1, t, settings, R, CANCEL_SYMBOL, getColumns, getRows, C$1, r, n$1, n2;
|
|
568
|
+
var a$1, t, settings, R, CANCEL_SYMBOL, getColumns, getRows, C$1, r, a, n$1, n2;
|
|
569
569
|
var init_dist4 = __esm({
|
|
570
570
|
"node_modules/.bun/@clack+core@1.6.0/node_modules/@clack/core/dist/index.mjs"() {
|
|
571
571
|
init_utils2();
|
|
@@ -783,9 +783,9 @@ var init_dist4 = __esm({
|
|
|
783
783
|
h2 > 0 && this.output.write(cursor.move(0, h2));
|
|
784
784
|
}
|
|
785
785
|
this.output.write(erase.down());
|
|
786
|
-
const
|
|
786
|
+
const m2 = t2.split(`
|
|
787
787
|
`).slice(n3);
|
|
788
|
-
this.output.write(
|
|
788
|
+
this.output.write(m2.join(`
|
|
789
789
|
`)), this._prevFrame = t2;
|
|
790
790
|
return;
|
|
791
791
|
}
|
|
@@ -813,6 +813,56 @@ var init_dist4 = __esm({
|
|
|
813
813
|
});
|
|
814
814
|
}
|
|
815
815
|
};
|
|
816
|
+
a = class extends C$1 {
|
|
817
|
+
options;
|
|
818
|
+
cursor = 0;
|
|
819
|
+
get _value() {
|
|
820
|
+
return this.options[this.cursor]?.value;
|
|
821
|
+
}
|
|
822
|
+
get _enabledOptions() {
|
|
823
|
+
return this.options.filter((e) => e.disabled !== true);
|
|
824
|
+
}
|
|
825
|
+
toggleAll() {
|
|
826
|
+
const e = this._enabledOptions, i2 = this.value !== void 0 && this.value.length === e.length;
|
|
827
|
+
this.value = i2 ? [] : e.map((t2) => t2.value);
|
|
828
|
+
}
|
|
829
|
+
toggleInvert() {
|
|
830
|
+
const e = this.value;
|
|
831
|
+
if (!e)
|
|
832
|
+
return;
|
|
833
|
+
const i2 = this._enabledOptions.filter((t2) => !e.includes(t2.value));
|
|
834
|
+
this.value = i2.map((t2) => t2.value);
|
|
835
|
+
}
|
|
836
|
+
toggleValue() {
|
|
837
|
+
this.value === void 0 && (this.value = []);
|
|
838
|
+
const e = this.value.includes(this._value);
|
|
839
|
+
this.value = e ? this.value.filter((i2) => i2 !== this._value) : [...this.value, this._value];
|
|
840
|
+
}
|
|
841
|
+
constructor(e) {
|
|
842
|
+
super(e, false), this.options = e.options, this.value = [...e.initialValues ?? []];
|
|
843
|
+
const i2 = Math.max(
|
|
844
|
+
this.options.findIndex(({ value: t2 }) => t2 === e.cursorAt),
|
|
845
|
+
0
|
|
846
|
+
);
|
|
847
|
+
this.cursor = this.options[i2]?.disabled ? findCursor(i2, 1, this.options) : i2, this.on("key", (t2, s) => {
|
|
848
|
+
s.name === "a" && this.toggleAll(), s.name === "i" && this.toggleInvert(), s.name === void 0 && t2 === "\u3000" && this.toggleValue();
|
|
849
|
+
}), this.on("cursor", (t2) => {
|
|
850
|
+
switch (t2) {
|
|
851
|
+
case "left":
|
|
852
|
+
case "up":
|
|
853
|
+
this.cursor = findCursor(this.cursor, -1, this.options);
|
|
854
|
+
break;
|
|
855
|
+
case "down":
|
|
856
|
+
case "right":
|
|
857
|
+
this.cursor = findCursor(this.cursor, 1, this.options);
|
|
858
|
+
break;
|
|
859
|
+
case "space":
|
|
860
|
+
this.toggleValue();
|
|
861
|
+
break;
|
|
862
|
+
}
|
|
863
|
+
});
|
|
864
|
+
}
|
|
865
|
+
};
|
|
816
866
|
n$1 = class n extends C$1 {
|
|
817
867
|
options;
|
|
818
868
|
cursor = 0;
|
|
@@ -884,7 +934,7 @@ function formatInstructionFooter(e, o, r2) {
|
|
|
884
934
|
`);
|
|
885
935
|
return r2 && n3.push(styleText2("cyan", S_BAR_END)), n3;
|
|
886
936
|
}
|
|
887
|
-
var unicode, isCI, unicodeOr, S_STEP_ACTIVE, S_STEP_CANCEL, S_STEP_ERROR, S_STEP_SUBMIT, S_BAR_START, S_BAR, S_BAR_END, S_BAR_START_RIGHT, S_BAR_END_RIGHT, S_RADIO_ACTIVE, S_RADIO_INACTIVE, S_CHECKBOX_ACTIVE, S_CHECKBOX_SELECTED, S_CHECKBOX_INACTIVE, S_PASSWORD_MASK, S_BAR_H, S_CORNER_TOP_RIGHT, S_CONNECT_LEFT, S_CORNER_BOTTOM_RIGHT, S_CORNER_BOTTOM_LEFT, S_CORNER_TOP_LEFT, S_INFO, S_SUCCESS, S_WARN, S_ERROR, symbol, symbolBar, E$1, limitOptions, confirm, MULTISELECT_INSTRUCTIONS, log, cancel, intro, outro, W, C2, note, Y, Z, spinner, u2, SELECT_INSTRUCTIONS, c2, select, i, text;
|
|
937
|
+
var unicode, isCI, unicodeOr, S_STEP_ACTIVE, S_STEP_CANCEL, S_STEP_ERROR, S_STEP_SUBMIT, S_BAR_START, S_BAR, S_BAR_END, S_BAR_START_RIGHT, S_BAR_END_RIGHT, S_RADIO_ACTIVE, S_RADIO_INACTIVE, S_CHECKBOX_ACTIVE, S_CHECKBOX_SELECTED, S_CHECKBOX_INACTIVE, S_PASSWORD_MASK, S_BAR_H, S_CORNER_TOP_RIGHT, S_CONNECT_LEFT, S_CORNER_BOTTOM_RIGHT, S_CORNER_BOTTOM_LEFT, S_CORNER_TOP_LEFT, S_INFO, S_SUCCESS, S_WARN, S_ERROR, symbol, symbolBar, E$1, limitOptions, confirm, MULTISELECT_INSTRUCTIONS, m, multiselect, log, cancel, intro, outro, W, C2, note, Y, Z, spinner, u2, SELECT_INSTRUCTIONS, c2, select, i, text;
|
|
888
938
|
var init_dist5 = __esm({
|
|
889
939
|
"node_modules/.bun/@clack+prompts@1.9.0/node_modules/@clack/prompts/dist/index.mjs"() {
|
|
890
940
|
init_utils2();
|
|
@@ -953,13 +1003,13 @@ var init_dist5 = __esm({
|
|
|
953
1003
|
let r2 = e, O = 0;
|
|
954
1004
|
if (C3)
|
|
955
1005
|
for (let i2 = p - 1; i2 >= w; i2--) {
|
|
956
|
-
const
|
|
957
|
-
if (
|
|
1006
|
+
const m2 = l[i2];
|
|
1007
|
+
if (m2 && (r2 -= m2.length), O++, r2 <= b) break;
|
|
958
1008
|
}
|
|
959
1009
|
else
|
|
960
1010
|
for (let i2 = w; i2 < p; i2++) {
|
|
961
|
-
const
|
|
962
|
-
if (
|
|
1011
|
+
const m2 = l[i2];
|
|
1012
|
+
if (m2 && (r2 -= m2.length), O++, r2 <= b) break;
|
|
963
1013
|
}
|
|
964
1014
|
return { lineCount: r2, removals: O };
|
|
965
1015
|
};
|
|
@@ -972,7 +1022,7 @@ var init_dist5 = __esm({
|
|
|
972
1022
|
columnPadding: C3 = 0,
|
|
973
1023
|
rowPadding: r2 = 4
|
|
974
1024
|
}) => {
|
|
975
|
-
const i2 = getColumns(p) - C3,
|
|
1025
|
+
const i2 = getColumns(p) - C3, m2 = getRows(p), M = styleText2("dim", "..."), v = Math.max(m2 - r2, 0), a2 = Math.max(Math.min(b, v), 5);
|
|
976
1026
|
let f = 0;
|
|
977
1027
|
l >= a2 - 3 && (f = Math.max(
|
|
978
1028
|
Math.min(l - a2 + 3, e.length - a2),
|
|
@@ -1060,11 +1110,118 @@ ${g}
|
|
|
1060
1110
|
`${styleText2("dim", "Space:")} select`,
|
|
1061
1111
|
`${styleText2("dim", "Enter:")} confirm`
|
|
1062
1112
|
];
|
|
1113
|
+
m = (n3, u3) => n3.split(`
|
|
1114
|
+
`).map((d) => u3(d)).join(`
|
|
1115
|
+
`);
|
|
1116
|
+
multiselect = (n3) => {
|
|
1117
|
+
const u3 = (t2, a2) => {
|
|
1118
|
+
const r2 = t2.label ?? String(t2.value);
|
|
1119
|
+
return a2 === "disabled" ? `${styleText2("gray", S_CHECKBOX_INACTIVE)} ${m(r2, (o) => styleText2(["strikethrough", "gray"], o))}${t2.hint ? ` ${styleText2("dim", `(${t2.hint ?? "disabled"})`)}` : ""}` : a2 === "active" ? `${styleText2("cyan", S_CHECKBOX_ACTIVE)} ${r2}${t2.hint ? ` ${styleText2("dim", `(${t2.hint})`)}` : ""}` : a2 === "selected" ? `${styleText2("green", S_CHECKBOX_SELECTED)} ${m(r2, (o) => styleText2("dim", o))}${t2.hint ? ` ${styleText2("dim", `(${t2.hint})`)}` : ""}` : a2 === "cancelled" ? `${m(r2, (o) => styleText2(["strikethrough", "dim"], o))}` : a2 === "active-selected" ? `${styleText2("green", S_CHECKBOX_SELECTED)} ${r2}${t2.hint ? ` ${styleText2("dim", `(${t2.hint})`)}` : ""}` : a2 === "submitted" ? `${m(r2, (o) => styleText2("dim", o))}` : `${styleText2("dim", S_CHECKBOX_INACTIVE)} ${m(r2, (o) => styleText2("dim", o))}`;
|
|
1120
|
+
}, d = n3.required ?? true, x = n3.showInstructions ?? true;
|
|
1121
|
+
return new a({
|
|
1122
|
+
options: n3.options,
|
|
1123
|
+
signal: n3.signal,
|
|
1124
|
+
input: n3.input,
|
|
1125
|
+
output: n3.output,
|
|
1126
|
+
initialValues: n3.initialValues,
|
|
1127
|
+
required: d,
|
|
1128
|
+
cursorAt: n3.cursorAt,
|
|
1129
|
+
validate(t2) {
|
|
1130
|
+
if (d && (t2 === void 0 || t2.length === 0))
|
|
1131
|
+
return `Please select at least one option.
|
|
1132
|
+
${styleText2(
|
|
1133
|
+
"reset",
|
|
1134
|
+
styleText2(
|
|
1135
|
+
"dim",
|
|
1136
|
+
`Press ${styleText2(["gray", "bgWhite", "inverse"], " space ")} to select, ${styleText2(
|
|
1137
|
+
"gray",
|
|
1138
|
+
styleText2("bgWhite", styleText2("inverse", " enter "))
|
|
1139
|
+
)} to submit`
|
|
1140
|
+
)
|
|
1141
|
+
)}`;
|
|
1142
|
+
},
|
|
1143
|
+
render() {
|
|
1144
|
+
const t2 = n3.withGuide ?? settings.withGuide, a2 = wrapTextWithPrefix(
|
|
1145
|
+
n3.output,
|
|
1146
|
+
n3.message,
|
|
1147
|
+
t2 ? `${symbolBar(this.state)} ` : "",
|
|
1148
|
+
`${symbol(this.state)} `
|
|
1149
|
+
), r2 = `${t2 ? `${styleText2("gray", S_BAR)}
|
|
1150
|
+
` : ""}${a2}
|
|
1151
|
+
`, o = this.value ?? [], g = (i2, l) => {
|
|
1152
|
+
if (i2.disabled)
|
|
1153
|
+
return u3(i2, "disabled");
|
|
1154
|
+
const s = o.includes(i2.value);
|
|
1155
|
+
return l && s ? u3(i2, "active-selected") : s ? u3(i2, "selected") : u3(i2, l ? "active" : "inactive");
|
|
1156
|
+
};
|
|
1157
|
+
switch (this.state) {
|
|
1158
|
+
case "submit": {
|
|
1159
|
+
const i2 = this.options.filter(({ value: s }) => o.includes(s)).map((s) => u3(s, "submitted")).join(styleText2("dim", ", ")) || styleText2("dim", "none"), l = wrapTextWithPrefix(
|
|
1160
|
+
n3.output,
|
|
1161
|
+
i2,
|
|
1162
|
+
t2 ? `${styleText2("gray", S_BAR)} ` : ""
|
|
1163
|
+
);
|
|
1164
|
+
return `${r2}${l}`;
|
|
1165
|
+
}
|
|
1166
|
+
case "cancel": {
|
|
1167
|
+
const i2 = this.options.filter(({ value: s }) => o.includes(s)).map((s) => u3(s, "cancelled")).join(styleText2("dim", ", "));
|
|
1168
|
+
if (i2.trim() === "")
|
|
1169
|
+
return `${r2}${styleText2("gray", S_BAR)}`;
|
|
1170
|
+
const l = wrapTextWithPrefix(
|
|
1171
|
+
n3.output,
|
|
1172
|
+
i2,
|
|
1173
|
+
t2 ? `${styleText2("gray", S_BAR)} ` : ""
|
|
1174
|
+
);
|
|
1175
|
+
return `${r2}${l}${t2 ? `
|
|
1176
|
+
${styleText2("gray", S_BAR)}` : ""}`;
|
|
1177
|
+
}
|
|
1178
|
+
case "error": {
|
|
1179
|
+
const i2 = t2 ? `${styleText2("yellow", S_BAR)} ` : "", l = this.error.split(`
|
|
1180
|
+
`).map(
|
|
1181
|
+
($, v) => v === 0 ? `${t2 ? `${styleText2("yellow", S_BAR_END)} ` : ""}${styleText2("yellow", $)}` : ` ${$}`
|
|
1182
|
+
).join(`
|
|
1183
|
+
`), s = r2.split(`
|
|
1184
|
+
`).length, h2 = l.split(`
|
|
1185
|
+
`).length + 1;
|
|
1186
|
+
return `${r2}${i2}${limitOptions({
|
|
1187
|
+
output: n3.output,
|
|
1188
|
+
options: this.options,
|
|
1189
|
+
cursor: this.cursor,
|
|
1190
|
+
maxItems: n3.maxItems,
|
|
1191
|
+
columnPadding: i2.length,
|
|
1192
|
+
rowPadding: s + h2,
|
|
1193
|
+
style: g
|
|
1194
|
+
}).join(`
|
|
1195
|
+
${i2}`)}
|
|
1196
|
+
${l}
|
|
1197
|
+
`;
|
|
1198
|
+
}
|
|
1199
|
+
default: {
|
|
1200
|
+
const i2 = t2 ? `${styleText2("cyan", S_BAR)} ` : "", l = r2.split(`
|
|
1201
|
+
`).length, s = x ? formatInstructionFooter(n3.output, MULTISELECT_INSTRUCTIONS, t2) : t2 ? [styleText2("cyan", S_BAR_END)] : [], h2 = s.join(`
|
|
1202
|
+
`), $ = s.length + 1;
|
|
1203
|
+
return `${r2}${i2}${limitOptions({
|
|
1204
|
+
output: n3.output,
|
|
1205
|
+
options: this.options,
|
|
1206
|
+
cursor: this.cursor,
|
|
1207
|
+
maxItems: n3.maxItems,
|
|
1208
|
+
columnPadding: i2.length,
|
|
1209
|
+
rowPadding: l + $,
|
|
1210
|
+
style: g
|
|
1211
|
+
}).join(`
|
|
1212
|
+
${i2}`)}
|
|
1213
|
+
${h2}
|
|
1214
|
+
`;
|
|
1215
|
+
}
|
|
1216
|
+
}
|
|
1217
|
+
}
|
|
1218
|
+
}).prompt();
|
|
1219
|
+
};
|
|
1063
1220
|
log = {
|
|
1064
1221
|
message: (s = [], {
|
|
1065
1222
|
symbol: e = styleText2("gray", S_BAR),
|
|
1066
1223
|
secondarySymbol: r2 = styleText2("gray", S_BAR),
|
|
1067
|
-
output:
|
|
1224
|
+
output: m2 = process.stdout,
|
|
1068
1225
|
spacing: l = 1,
|
|
1069
1226
|
withGuide: c3
|
|
1070
1227
|
} = {}) => {
|
|
@@ -1079,7 +1236,7 @@ ${g}
|
|
|
1079
1236
|
for (const p of y)
|
|
1080
1237
|
p.length > 0 ? t2.push(`${u3}${p}`) : t2.push(o ? r2 : "");
|
|
1081
1238
|
}
|
|
1082
|
-
|
|
1239
|
+
m2.write(`${t2.join(`
|
|
1083
1240
|
`)}
|
|
1084
1241
|
`);
|
|
1085
1242
|
},
|
|
@@ -1133,13 +1290,13 @@ ${styleText2("gray", S_BAR_END)} ` : "";
|
|
|
1133
1290
|
note = (o = "", e = "", s) => {
|
|
1134
1291
|
const a2 = s?.output ?? process$1.stdout, i2 = s?.withGuide ?? settings.withGuide, c3 = s?.format ?? W, g = ["", ...C2(o, getColumns(a2) - 6, c3).split(`
|
|
1135
1292
|
`).map(c3), ""], n3 = dist_default2(e), t2 = Math.max(
|
|
1136
|
-
g.reduce((
|
|
1293
|
+
g.reduce((m2, F) => {
|
|
1137
1294
|
const O = dist_default2(F);
|
|
1138
|
-
return O >
|
|
1295
|
+
return O > m2 ? O : m2;
|
|
1139
1296
|
}, 0),
|
|
1140
1297
|
n3
|
|
1141
1298
|
) + 2, h2 = g.map(
|
|
1142
|
-
(
|
|
1299
|
+
(m2) => `${styleText2("gray", S_BAR)} ${m2}${" ".repeat(t2 - dist_default2(m2))}${styleText2("gray", S_BAR)}`
|
|
1143
1300
|
).join(`
|
|
1144
1301
|
`), T = i2 ? `${styleText2("gray", S_BAR)}
|
|
1145
1302
|
` : "", l$1 = i2 ? S_CONNECT_LEFT : S_CORNER_BOTTOM_LEFT;
|
|
@@ -1170,7 +1327,7 @@ ${styleText2("gray", l$1 + S_BAR_H.repeat(t2 + 2) + S_CORNER_BOTTOM_RIGHT)}
|
|
|
1170
1327
|
let x, I, p = false, l = false, r2 = "", v, w = performance.now();
|
|
1171
1328
|
const y = getColumns(n3), F = E?.styleFrame ?? Z, S = (e) => {
|
|
1172
1329
|
const s = e > 1 ? C3 ?? settings.messages.error : _ ?? settings.messages.cancel;
|
|
1173
|
-
l = e === 1, p && (
|
|
1330
|
+
l = e === 1, p && (m2(s, e), l && typeof b == "function" && b());
|
|
1174
1331
|
}, $ = () => S(2), a2 = () => S(1), H = () => {
|
|
1175
1332
|
process.on("uncaughtExceptionMonitor", $), process.on("unhandledRejection", $), process.on("SIGINT", a2), process.on("SIGTERM", a2), process.on("exit", S), g && g.addEventListener("abort", a2);
|
|
1176
1333
|
}, B = () => {
|
|
@@ -1221,7 +1378,7 @@ ${styleText2("gray", l$1 + S_BAR_H.repeat(t2 + 2) + S_CORNER_BOTTOM_RIGHT)}
|
|
|
1221
1378
|
});
|
|
1222
1379
|
n3.write(D), s = s + 1 < M.length ? s + 1 : 0, i2 = i2 < 4 ? i2 + 0.125 : 0;
|
|
1223
1380
|
}, O);
|
|
1224
|
-
},
|
|
1381
|
+
}, m2 = (e = "", s = 0, i2 = false) => {
|
|
1225
1382
|
if (p) {
|
|
1226
1383
|
if (p = false, l = s === 1, clearInterval(I), h2 || R2(), r2 = e ?? r2, !i2)
|
|
1227
1384
|
if (h2) {
|
|
@@ -1240,13 +1397,13 @@ ${styleText2("gray", l$1 + S_BAR_H.repeat(t2 + 2) + S_CORNER_BOTTOM_RIGHT)}
|
|
|
1240
1397
|
};
|
|
1241
1398
|
return {
|
|
1242
1399
|
start: P,
|
|
1243
|
-
stop: (e = "") =>
|
|
1400
|
+
stop: (e = "") => m2(e, 0),
|
|
1244
1401
|
message: (e = "") => {
|
|
1245
1402
|
r2 = L(e ?? r2);
|
|
1246
1403
|
},
|
|
1247
|
-
cancel: (e = "") =>
|
|
1248
|
-
error: (e = "") =>
|
|
1249
|
-
clear: () =>
|
|
1404
|
+
cancel: (e = "") => m2(e, 1),
|
|
1405
|
+
error: (e = "") => m2(e, 2),
|
|
1406
|
+
clear: () => m2("", 0, true),
|
|
1250
1407
|
get isCancelled() {
|
|
1251
1408
|
return l;
|
|
1252
1409
|
}
|
|
@@ -1266,11 +1423,11 @@ ${styleText2("gray", l$1 + S_BAR_H.repeat(t2 + 2) + S_CORNER_BOTTOM_RIGHT)}
|
|
|
1266
1423
|
`).map((d) => o(d)).join(`
|
|
1267
1424
|
`) : o(t2);
|
|
1268
1425
|
select = (t2) => {
|
|
1269
|
-
const o = (n3,
|
|
1426
|
+
const o = (n3, m2) => {
|
|
1270
1427
|
if (n3 === void 0)
|
|
1271
1428
|
return "";
|
|
1272
1429
|
const s = n3.label ?? String(n3.value);
|
|
1273
|
-
switch (
|
|
1430
|
+
switch (m2) {
|
|
1274
1431
|
case "disabled":
|
|
1275
1432
|
return `${styleText2("gray", S_RADIO_INACTIVE)} ${c2(s, (i2) => styleText2("gray", i2))}${n3.hint ? ` ${styleText2("dim", `(${n3.hint ?? "disabled"})`)}` : ""}`;
|
|
1276
1433
|
case "selected":
|
|
@@ -1290,11 +1447,11 @@ ${styleText2("gray", l$1 + S_BAR_H.repeat(t2 + 2) + S_CORNER_BOTTOM_RIGHT)}
|
|
|
1290
1447
|
output: t2.output,
|
|
1291
1448
|
initialValue: t2.initialValue,
|
|
1292
1449
|
render() {
|
|
1293
|
-
const n3 = t2.withGuide ?? settings.withGuide,
|
|
1450
|
+
const n3 = t2.withGuide ?? settings.withGuide, m2 = `${symbol(this.state)} `, s = `${symbolBar(this.state)} `, i2 = wrapTextWithPrefix(
|
|
1294
1451
|
t2.output,
|
|
1295
1452
|
t2.message,
|
|
1296
1453
|
s,
|
|
1297
|
-
|
|
1454
|
+
m2
|
|
1298
1455
|
), u3 = `${n3 ? `${styleText2("gray", S_BAR)}
|
|
1299
1456
|
` : ""}${i2}
|
|
1300
1457
|
`;
|
|
@@ -4152,10 +4309,10 @@ var require_parse2 = __commonJS({
|
|
|
4152
4309
|
};
|
|
4153
4310
|
if (opts.fastpaths !== false && !/(^[*!]|[/()[\]{}"])/.test(input)) {
|
|
4154
4311
|
let backslashes = false;
|
|
4155
|
-
let output = input.replace(REGEX_SPECIAL_CHARS_BACKREF, (
|
|
4312
|
+
let output = input.replace(REGEX_SPECIAL_CHARS_BACKREF, (m2, esc, chars, first, rest, index) => {
|
|
4156
4313
|
if (first === "\\") {
|
|
4157
4314
|
backslashes = true;
|
|
4158
|
-
return
|
|
4315
|
+
return m2;
|
|
4159
4316
|
}
|
|
4160
4317
|
if (first === "?") {
|
|
4161
4318
|
if (esc) {
|
|
@@ -4175,14 +4332,14 @@ var require_parse2 = __commonJS({
|
|
|
4175
4332
|
}
|
|
4176
4333
|
return star;
|
|
4177
4334
|
}
|
|
4178
|
-
return esc ?
|
|
4335
|
+
return esc ? m2 : `\\${m2}`;
|
|
4179
4336
|
});
|
|
4180
4337
|
if (backslashes === true) {
|
|
4181
4338
|
if (opts.unescape === true) {
|
|
4182
4339
|
output = output.replace(/\\/g, "");
|
|
4183
4340
|
} else {
|
|
4184
|
-
output = output.replace(/\\+/g, (
|
|
4185
|
-
return
|
|
4341
|
+
output = output.replace(/\\+/g, (m2) => {
|
|
4342
|
+
return m2.length % 2 === 0 ? "\\\\" : m2 ? "\\" : "";
|
|
4186
4343
|
});
|
|
4187
4344
|
}
|
|
4188
4345
|
}
|
|
@@ -7579,11 +7736,12 @@ function getPatternsFor(type, repoRoot = null) {
|
|
|
7579
7736
|
function getGlobOptionsFor(type) {
|
|
7580
7737
|
return GLOB_OPTIONS[type] || GLOB_OPTIONS.base;
|
|
7581
7738
|
}
|
|
7582
|
-
var I18N_PATHS, SCAN_PATTERNS, GLOB_OPTIONS;
|
|
7739
|
+
var DEFAULT_OG_IMAGE, I18N_PATHS, SCAN_PATTERNS, GLOB_OPTIONS;
|
|
7583
7740
|
var init_constants = __esm({
|
|
7584
7741
|
"packages/core/config/constants.js"() {
|
|
7585
7742
|
"use strict";
|
|
7586
7743
|
init_utils2();
|
|
7744
|
+
DEFAULT_OG_IMAGE = "/og-image.png";
|
|
7587
7745
|
I18N_PATHS = {
|
|
7588
7746
|
// Monorepo source structure (locales at root, not in src/)
|
|
7589
7747
|
SOURCE_ROOT: "packages/core/i18n",
|
|
@@ -7594,7 +7752,9 @@ var init_constants = __esm({
|
|
|
7594
7752
|
PUBLISHED_ROOT: "i18n",
|
|
7595
7753
|
PUBLISHED_LOCALES: "i18n/locales",
|
|
7596
7754
|
PUBLISHED_EAGER: "i18n/locales/eager",
|
|
7597
|
-
PUBLISHED_LAZY: "i18n/locales/lazy"
|
|
7755
|
+
PUBLISHED_LAZY: "i18n/locales/lazy",
|
|
7756
|
+
// Flag artwork: one SVG per flag code (flagFileName), copied to public/flags/ (AssetDiscovery)
|
|
7757
|
+
PUBLISHED_FLAGS: "i18n/flags"
|
|
7598
7758
|
};
|
|
7599
7759
|
SCAN_PATTERNS = {
|
|
7600
7760
|
routes: {
|
|
@@ -7656,7 +7816,12 @@ var init_constants = __esm({
|
|
|
7656
7816
|
"logo.avif",
|
|
7657
7817
|
"apple-touch-icon*.png",
|
|
7658
7818
|
"android-chrome-*.png",
|
|
7659
|
-
|
|
7819
|
+
// Generated from logo.svg (AssetDiscovery._generateMissingAssets) or the app's own
|
|
7820
|
+
"icon-*x*.png",
|
|
7821
|
+
DEFAULT_OG_IMAGE.slice(1)
|
|
7822
|
+
// Not manifest.json: the web app manifest is a build output on Next (the PWA step
|
|
7823
|
+
// rewrites it after this scan), so its scanned size would differ between a clean
|
|
7824
|
+
// build and a rebuild. The asset manifest's `manifest` reads it from disk instead.
|
|
7660
7825
|
],
|
|
7661
7826
|
fonts: ["fonts/**/*.woff2", "fonts/**/*.woff", "fonts/**/*.ttf"],
|
|
7662
7827
|
framework: ["packages/ui/assets/**/*"]
|
|
@@ -7733,7 +7898,6 @@ import {
|
|
|
7733
7898
|
sep,
|
|
7734
7899
|
extname
|
|
7735
7900
|
} from "node:path";
|
|
7736
|
-
import { fileURLToPath } from "node:url";
|
|
7737
7901
|
function isEexistError(error2) {
|
|
7738
7902
|
return typeof error2 === "object" && error2 !== null && "code" in error2 && error2.code === "EEXIST";
|
|
7739
7903
|
}
|
|
@@ -8555,7 +8719,10 @@ var init_PathResolver = __esm({
|
|
|
8555
8719
|
return resolvedPath;
|
|
8556
8720
|
}
|
|
8557
8721
|
/**
|
|
8558
|
-
* Execute fast-glob with normalized results
|
|
8722
|
+
* Execute fast-glob with normalized results, sorted. fast-glob returns files in
|
|
8723
|
+
* filesystem completion order, which varies between runs: every discovery (routes,
|
|
8724
|
+
* themes, i18n, assets) and what it generates (route manifest, sitemap, llms.txt,
|
|
8725
|
+
* proxy) must list the same sources in the same order on every build.
|
|
8559
8726
|
* @private
|
|
8560
8727
|
*/
|
|
8561
8728
|
async _globWithNormalization(patterns, options) {
|
|
@@ -8563,7 +8730,7 @@ var init_PathResolver = __esm({
|
|
|
8563
8730
|
return results.map((path) => {
|
|
8564
8731
|
const pathStr = typeof path === "string" ? path : path.path;
|
|
8565
8732
|
return this.normalizePath(pathStr);
|
|
8566
|
-
});
|
|
8733
|
+
}).sort();
|
|
8567
8734
|
}
|
|
8568
8735
|
/**
|
|
8569
8736
|
* Resolve files using patterns with cross-platform support
|
|
@@ -8718,15 +8885,6 @@ var init_PathResolver = __esm({
|
|
|
8718
8885
|
const cjsPath = this.getEmptyCjsModulePath();
|
|
8719
8886
|
return cjsPath.replace(/\.cjs$/, ".js");
|
|
8720
8887
|
}
|
|
8721
|
-
/**
|
|
8722
|
-
* Get absolute path to empty flag component module.
|
|
8723
|
-
* Returns `export default () => null;` — used by flag filtering plugins
|
|
8724
|
-
* to replace unused flag files at build time.
|
|
8725
|
-
*/
|
|
8726
|
-
getEmptyFlagModulePath() {
|
|
8727
|
-
const __dirname2 = dirname2(fileURLToPath(import.meta.url));
|
|
8728
|
-
return this.normalizePath(resolve(__dirname2, "emptyFlag.js"));
|
|
8729
|
-
}
|
|
8730
8888
|
/**
|
|
8731
8889
|
* Get absolute path to empty CJS module for esbuild pre-bundling.
|
|
8732
8890
|
* CJS because esbuild statically analyzes ESM exports — CJS has dynamic
|
|
@@ -8859,7 +9017,7 @@ import {
|
|
|
8859
9017
|
parse,
|
|
8860
9018
|
isAbsolute as pathIsAbsolute
|
|
8861
9019
|
} from "node:path";
|
|
8862
|
-
import { fileURLToPath
|
|
9020
|
+
import { fileURLToPath } from "node:url";
|
|
8863
9021
|
function readdirSync3(dirPath, options) {
|
|
8864
9022
|
if (options !== null && typeof options === "object" && options.withFileTypes === true) {
|
|
8865
9023
|
return pathResolverInstance.readdirSync(dirPath, options);
|
|
@@ -8867,7 +9025,7 @@ function readdirSync3(dirPath, options) {
|
|
|
8867
9025
|
return pathResolverInstance.readdirSync(dirPath, options);
|
|
8868
9026
|
}
|
|
8869
9027
|
function getDirnameFromUrl(importMetaUrl) {
|
|
8870
|
-
return dirname3(
|
|
9028
|
+
return dirname3(fileURLToPath(importMetaUrl));
|
|
8871
9029
|
}
|
|
8872
9030
|
function findNodeModulesDir(startDir) {
|
|
8873
9031
|
let currentDir = normalizePath(startDir);
|
|
@@ -8917,7 +9075,7 @@ function getBinPath(binaryName) {
|
|
|
8917
9075
|
return binaryName;
|
|
8918
9076
|
}
|
|
8919
9077
|
function detectExecutionMode() {
|
|
8920
|
-
const fileUrlPath =
|
|
9078
|
+
const fileUrlPath = fileURLToPath(import.meta.url);
|
|
8921
9079
|
if (fileUrlPath.includes("node_modules")) {
|
|
8922
9080
|
return "published";
|
|
8923
9081
|
}
|
|
@@ -8929,7 +9087,7 @@ function detectExecutionMode() {
|
|
|
8929
9087
|
function getTemplatesRoot() {
|
|
8930
9088
|
const mode = detectExecutionMode();
|
|
8931
9089
|
if (mode === "development") {
|
|
8932
|
-
const fileUrlPath =
|
|
9090
|
+
const fileUrlPath = fileURLToPath(import.meta.url);
|
|
8933
9091
|
const frameworkRoot = normalizePath(dirname3(fileUrlPath), "../../../..");
|
|
8934
9092
|
return normalizePath(frameworkRoot, PACKAGE_PATHS.CLI, "templates");
|
|
8935
9093
|
} else {
|
|
@@ -9183,9 +9341,15 @@ var init_pathResolver = __esm({
|
|
|
9183
9341
|
});
|
|
9184
9342
|
|
|
9185
9343
|
// packages/tooling/src/utils/type-guards.ts
|
|
9344
|
+
function isRecord(value) {
|
|
9345
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
9346
|
+
}
|
|
9186
9347
|
function isObjectLike(value) {
|
|
9187
9348
|
return typeof value === "object" && value !== null;
|
|
9188
9349
|
}
|
|
9350
|
+
function isStringArray(value) {
|
|
9351
|
+
return Array.isArray(value) && value.every((item) => typeof item === "string");
|
|
9352
|
+
}
|
|
9189
9353
|
function asText(value) {
|
|
9190
9354
|
return typeof value === "string" ? value : null;
|
|
9191
9355
|
}
|
|
@@ -9232,13 +9396,13 @@ import { copyFileSync as copyFileSync2, readFileSync as readFileSync2, writeFile
|
|
|
9232
9396
|
import { createRequire as createRequire3 } from "node:module";
|
|
9233
9397
|
import { dirname as dirname4, resolve as resolve3 } from "node:path";
|
|
9234
9398
|
import process from "node:process";
|
|
9235
|
-
import { fileURLToPath as
|
|
9399
|
+
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
9236
9400
|
var require2, __filename, __dirname;
|
|
9237
9401
|
var init_utils2 = __esm({
|
|
9238
9402
|
"packages/tooling/src/bundler/utils.ts"() {
|
|
9239
9403
|
"use strict";
|
|
9240
9404
|
require2 = createRequire3(import.meta.url);
|
|
9241
|
-
__filename =
|
|
9405
|
+
__filename = fileURLToPath2(import.meta.url);
|
|
9242
9406
|
__dirname = dirname4(__filename);
|
|
9243
9407
|
if (typeof globalThis !== "undefined") {
|
|
9244
9408
|
globalThis.require = require2;
|
|
@@ -9254,16 +9418,17 @@ var init_utils2 = __esm({
|
|
|
9254
9418
|
});
|
|
9255
9419
|
|
|
9256
9420
|
// packages/tooling/src/utils/cli-input.ts
|
|
9421
|
+
function exitCancelled() {
|
|
9422
|
+
cancel("Cancelled");
|
|
9423
|
+
process.exit(CANCELLED_EXIT_CODE);
|
|
9424
|
+
}
|
|
9257
9425
|
async function askForInput(message, defaultValue = "") {
|
|
9258
9426
|
const result = await text({
|
|
9259
9427
|
message,
|
|
9260
9428
|
placeholder: defaultValue || void 0,
|
|
9261
9429
|
defaultValue: defaultValue || void 0
|
|
9262
9430
|
});
|
|
9263
|
-
if (isCancel(result))
|
|
9264
|
-
cancel("Operation cancelled.");
|
|
9265
|
-
process.exit(0);
|
|
9266
|
-
}
|
|
9431
|
+
if (isCancel(result)) exitCancelled();
|
|
9267
9432
|
return result;
|
|
9268
9433
|
}
|
|
9269
9434
|
async function askForConfirmation(message, defaultValue = false) {
|
|
@@ -9271,10 +9436,7 @@ async function askForConfirmation(message, defaultValue = false) {
|
|
|
9271
9436
|
message,
|
|
9272
9437
|
initialValue: defaultValue
|
|
9273
9438
|
});
|
|
9274
|
-
if (isCancel(result))
|
|
9275
|
-
cancel("Operation cancelled.");
|
|
9276
|
-
process.exit(0);
|
|
9277
|
-
}
|
|
9439
|
+
if (isCancel(result)) exitCancelled();
|
|
9278
9440
|
return result;
|
|
9279
9441
|
}
|
|
9280
9442
|
async function askForSelection(message, choices, defaultValue = 0) {
|
|
@@ -9288,21 +9450,36 @@ async function askForSelection(message, choices, defaultValue = 0) {
|
|
|
9288
9450
|
options,
|
|
9289
9451
|
initialValue
|
|
9290
9452
|
});
|
|
9291
|
-
if (isCancel(result))
|
|
9292
|
-
cancel("Operation cancelled.");
|
|
9293
|
-
process.exit(0);
|
|
9294
|
-
}
|
|
9453
|
+
if (isCancel(result)) exitCancelled();
|
|
9295
9454
|
const picked = choices.find((choice) => choice.value === result);
|
|
9296
9455
|
if (!picked) {
|
|
9297
9456
|
throw new Error(`Unknown selection: ${result}`);
|
|
9298
9457
|
}
|
|
9299
9458
|
return picked.value;
|
|
9300
9459
|
}
|
|
9460
|
+
async function askForMultiSelection(message, choices, defaultIndices = [], required = true) {
|
|
9461
|
+
const options = choices.map((choice) => ({
|
|
9462
|
+
value: choice.value,
|
|
9463
|
+
label: choice.title,
|
|
9464
|
+
hint: choice.hint
|
|
9465
|
+
}));
|
|
9466
|
+
const initialValues = defaultIndices.map((i2) => choices[i2]?.value).filter((value) => Boolean(value));
|
|
9467
|
+
const result = await multiselect({
|
|
9468
|
+
message,
|
|
9469
|
+
options,
|
|
9470
|
+
initialValues: initialValues.length > 0 ? initialValues : void 0,
|
|
9471
|
+
required
|
|
9472
|
+
});
|
|
9473
|
+
if (isCancel(result)) exitCancelled();
|
|
9474
|
+
return result;
|
|
9475
|
+
}
|
|
9476
|
+
var CANCELLED_EXIT_CODE;
|
|
9301
9477
|
var init_cli_input = __esm({
|
|
9302
9478
|
"packages/tooling/src/utils/cli-input.ts"() {
|
|
9303
9479
|
"use strict";
|
|
9304
9480
|
init_utils2();
|
|
9305
9481
|
init_dist5();
|
|
9482
|
+
CANCELLED_EXIT_CODE = 130;
|
|
9306
9483
|
}
|
|
9307
9484
|
});
|
|
9308
9485
|
|
|
@@ -9329,21 +9506,7 @@ var init_error_handling = __esm({
|
|
|
9329
9506
|
}
|
|
9330
9507
|
});
|
|
9331
9508
|
|
|
9332
|
-
// packages/cli/src/bin/commands/create-app.ts
|
|
9333
|
-
init_utils2();
|
|
9334
|
-
|
|
9335
|
-
// packages/tooling/src/index.ts
|
|
9336
|
-
init_utils2();
|
|
9337
|
-
|
|
9338
|
-
// packages/tooling/src/cli/index.ts
|
|
9339
|
-
init_utils2();
|
|
9340
|
-
|
|
9341
9509
|
// packages/tooling/src/utils/create-utils.ts
|
|
9342
|
-
init_utils2();
|
|
9343
|
-
init_cli_output();
|
|
9344
|
-
init_error_handling();
|
|
9345
|
-
init_pathResolver();
|
|
9346
|
-
init_type_guards();
|
|
9347
9510
|
async function isTextFile(filePath) {
|
|
9348
9511
|
const binaryExtensions = [
|
|
9349
9512
|
".png",
|
|
@@ -9466,7 +9629,6 @@ function processArrayIterations(content, replacements) {
|
|
|
9466
9629
|
function isValidFileName(name) {
|
|
9467
9630
|
return typeof name === "string" && /^[a-zA-Z0-9_-]+$/.test(name);
|
|
9468
9631
|
}
|
|
9469
|
-
var RESERVED_APP_NAMES = ["demo", "dndev"];
|
|
9470
9632
|
function isReservedAppName(name) {
|
|
9471
9633
|
return RESERVED_APP_NAMES.includes(
|
|
9472
9634
|
name.toLowerCase()
|
|
@@ -9487,12 +9649,38 @@ async function updateRootPackageJson(rootDir, appNames) {
|
|
|
9487
9649
|
);
|
|
9488
9650
|
}
|
|
9489
9651
|
}
|
|
9652
|
+
async function mergeProjectArgs(rootDir, update) {
|
|
9653
|
+
const argsPath = joinPath(rootDir, ".dndev", "args.json");
|
|
9654
|
+
if (!pathExists(argsPath)) return;
|
|
9655
|
+
const args = readSync(argsPath, { format: "json" });
|
|
9656
|
+
if (!isRecord(args) || !isStringArray(args.features)) {
|
|
9657
|
+
throw new Error(
|
|
9658
|
+
`${argsPath}: expected a JSON object with a "features" string array`
|
|
9659
|
+
);
|
|
9660
|
+
}
|
|
9661
|
+
const features = [...args.features];
|
|
9662
|
+
for (const feature of update.features) {
|
|
9663
|
+
if (!features.includes(feature)) features.push(feature);
|
|
9664
|
+
}
|
|
9665
|
+
args.features = features;
|
|
9666
|
+
if (update.region) args.region = update.region;
|
|
9667
|
+
await write(argsPath, args, { format: "json", overwrite: true });
|
|
9668
|
+
}
|
|
9669
|
+
var RESERVED_APP_NAMES;
|
|
9670
|
+
var init_create_utils = __esm({
|
|
9671
|
+
"packages/tooling/src/utils/create-utils.ts"() {
|
|
9672
|
+
"use strict";
|
|
9673
|
+
init_utils2();
|
|
9674
|
+
init_cli_output();
|
|
9675
|
+
init_error_handling();
|
|
9676
|
+
init_pathResolver();
|
|
9677
|
+
init_type_guards();
|
|
9678
|
+
RESERVED_APP_NAMES = ["demo", "dndev"];
|
|
9679
|
+
}
|
|
9680
|
+
});
|
|
9490
9681
|
|
|
9491
9682
|
// packages/tooling/src/utils/matrix.ts
|
|
9492
|
-
init_utils2();
|
|
9493
|
-
init_pathResolver();
|
|
9494
9683
|
import { createRequire as createRequire4 } from "node:module";
|
|
9495
|
-
var cachedMatrix = null;
|
|
9496
9684
|
function getMatrixPath(mode) {
|
|
9497
9685
|
try {
|
|
9498
9686
|
const require3 = createRequire4(import.meta.url);
|
|
@@ -9551,6 +9739,15 @@ function loadMatrix(mode) {
|
|
|
9551
9739
|
};
|
|
9552
9740
|
return cachedMatrix;
|
|
9553
9741
|
}
|
|
9742
|
+
function getNodePolicy(mode) {
|
|
9743
|
+
const matrix = loadMatrix(mode)?.matrix;
|
|
9744
|
+
if (!matrix?.nodePolicy) {
|
|
9745
|
+
throw new Error(
|
|
9746
|
+
'dependencies-matrix.json has no "nodePolicy" (Node version policy).'
|
|
9747
|
+
);
|
|
9748
|
+
}
|
|
9749
|
+
return matrix.nodePolicy;
|
|
9750
|
+
}
|
|
9554
9751
|
function resolveGroup(groupName, matrix) {
|
|
9555
9752
|
const group2 = matrix.groups[groupName];
|
|
9556
9753
|
if (!group2) return {};
|
|
@@ -9572,118 +9769,35 @@ function resolveGroups(groupNames, matrix) {
|
|
|
9572
9769
|
}
|
|
9573
9770
|
return result;
|
|
9574
9771
|
}
|
|
9772
|
+
var cachedMatrix;
|
|
9773
|
+
var init_matrix = __esm({
|
|
9774
|
+
"packages/tooling/src/utils/matrix.ts"() {
|
|
9775
|
+
"use strict";
|
|
9776
|
+
init_utils2();
|
|
9777
|
+
init_pathResolver();
|
|
9778
|
+
cachedMatrix = null;
|
|
9779
|
+
}
|
|
9780
|
+
});
|
|
9575
9781
|
|
|
9576
9782
|
// packages/tooling/src/utils/scaffolding-questionnaire.ts
|
|
9577
|
-
|
|
9578
|
-
|
|
9579
|
-
{
|
|
9580
|
-
id: "framework",
|
|
9581
|
-
question: "Which framework?",
|
|
9582
|
-
type: "select",
|
|
9583
|
-
defaultValue: "vite",
|
|
9584
|
-
choices: [
|
|
9585
|
-
{
|
|
9586
|
-
title: "Vite \u2014 SPA/SaaS (client-side rendering, fast dev)",
|
|
9587
|
-
value: "vite"
|
|
9588
|
-
},
|
|
9589
|
-
{
|
|
9590
|
-
title: "Next.js \u2014 Static content/SEO (SSR, SSG) \u2014 BETA",
|
|
9591
|
-
value: "nextjs"
|
|
9592
|
-
},
|
|
9593
|
-
{
|
|
9594
|
-
title: "Expo \u2014 Mobile app (iOS + Android)",
|
|
9595
|
-
value: "expo"
|
|
9596
|
-
}
|
|
9597
|
-
]
|
|
9598
|
-
},
|
|
9599
|
-
{
|
|
9600
|
-
id: "host",
|
|
9601
|
-
question: "Where will you host?",
|
|
9602
|
-
type: "select",
|
|
9603
|
-
condition: (answers) => answers.framework !== "expo",
|
|
9604
|
-
defaultValue: (answers) => {
|
|
9605
|
-
return answers.framework === "nextjs" ? "vercel" : "none";
|
|
9606
|
-
},
|
|
9607
|
-
choices: [
|
|
9608
|
-
{ title: "None \u2014 no hosting config", value: "none" },
|
|
9609
|
-
{ title: "Vercel \u2014 edge CDN + serverless", value: "vercel" },
|
|
9610
|
-
{ title: "Firebase Hosting \u2014 Google CDN", value: "firebase" }
|
|
9611
|
-
]
|
|
9612
|
-
},
|
|
9613
|
-
{
|
|
9614
|
-
id: "functions",
|
|
9615
|
-
question: "Serverless functions?",
|
|
9616
|
-
type: "select",
|
|
9617
|
-
defaultValue: "none",
|
|
9618
|
-
// Choices filtered dynamically based on host
|
|
9619
|
-
choices: [
|
|
9620
|
-
{ title: "None", value: "none" },
|
|
9621
|
-
{ title: "Vercel Functions \u2014 edge + node.js", value: "vercel" },
|
|
9622
|
-
{ title: "Firebase Functions \u2014 Google Cloud", value: "firebase" },
|
|
9623
|
-
{ title: "Supabase Edge Functions \u2014 Deno", value: "supabase" }
|
|
9624
|
-
],
|
|
9625
|
-
choicesFilter: (answers) => {
|
|
9626
|
-
const host = answers.host ?? "none";
|
|
9627
|
-
const framework = answers.framework;
|
|
9628
|
-
if (framework === "expo") return ["none", "firebase", "supabase"];
|
|
9629
|
-
if (host === "firebase") return ["none", "firebase"];
|
|
9630
|
-
if (host === "vercel") return ["none", "vercel", "supabase"];
|
|
9631
|
-
return ["none", "vercel", "firebase", "supabase"];
|
|
9632
|
-
}
|
|
9633
|
-
},
|
|
9634
|
-
{
|
|
9635
|
-
id: "backend",
|
|
9636
|
-
question: "Backend / BaaS provider?",
|
|
9637
|
-
type: "select",
|
|
9638
|
-
defaultValue: (answers) => {
|
|
9639
|
-
if (answers.functions === "firebase") return "firebase";
|
|
9640
|
-
if (answers.functions === "supabase") return "supabase";
|
|
9641
|
-
return "none";
|
|
9642
|
-
},
|
|
9643
|
-
choices: [
|
|
9644
|
-
{ title: "None \u2014 frontend only", value: "none" },
|
|
9645
|
-
{
|
|
9646
|
-
title: "Firebase \u2014 Auth + Firestore + Storage",
|
|
9647
|
-
value: "firebase"
|
|
9648
|
-
},
|
|
9649
|
-
{
|
|
9650
|
-
title: "Supabase \u2014 Postgres + Auth + Storage",
|
|
9651
|
-
value: "supabase"
|
|
9652
|
-
}
|
|
9653
|
-
],
|
|
9654
|
-
choicesFilter: (answers) => {
|
|
9655
|
-
const functions = answers.functions ?? "none";
|
|
9656
|
-
if (functions === "firebase") return ["none", "firebase"];
|
|
9657
|
-
if (functions === "supabase") return ["none", "supabase"];
|
|
9658
|
-
if (functions === "vercel") return ["none"];
|
|
9659
|
-
return ["none", "firebase", "supabase"];
|
|
9660
|
-
}
|
|
9661
|
-
}
|
|
9662
|
-
];
|
|
9663
|
-
var PROJECT_QUESTIONNAIRE = [
|
|
9664
|
-
{
|
|
9665
|
-
id: "projectName",
|
|
9666
|
-
question: "Project name",
|
|
9667
|
-
type: "input",
|
|
9668
|
-
defaultValue: "my-project"
|
|
9669
|
-
},
|
|
9670
|
-
{
|
|
9671
|
-
id: "appNames",
|
|
9672
|
-
question: `App name(s) (comma-separated for multiple, e.g., web, admin) - '${RESERVED_APP_NAMES.join("', '")}' reserved`,
|
|
9673
|
-
type: "input",
|
|
9674
|
-
defaultValue: "web"
|
|
9675
|
-
}
|
|
9676
|
-
];
|
|
9677
|
-
function aggregateRequirements(answers) {
|
|
9678
|
-
const hasBackend = Boolean(
|
|
9783
|
+
function hasBackendAnswers(answers) {
|
|
9784
|
+
return Boolean(
|
|
9679
9785
|
answers.backend && answers.backend !== "none" || answers.functions && answers.functions !== "none"
|
|
9680
9786
|
);
|
|
9787
|
+
}
|
|
9788
|
+
function selectedFeatures(answers) {
|
|
9789
|
+
const picked = Array.isArray(answers.features) ? answers.features : [];
|
|
9790
|
+
return {
|
|
9791
|
+
billing: picked.includes("billing"),
|
|
9792
|
+
oauth: picked.includes("oauth")
|
|
9793
|
+
};
|
|
9794
|
+
}
|
|
9795
|
+
function aggregateRequirements(answers) {
|
|
9681
9796
|
const requirements = {
|
|
9682
9797
|
entities: [],
|
|
9683
9798
|
// Entities created in apps/<app>/entities/ (v1), root entities/ for v2
|
|
9684
|
-
billing:
|
|
9685
|
-
|
|
9686
|
-
backend: hasBackend,
|
|
9799
|
+
billing: selectedFeatures(answers).billing,
|
|
9800
|
+
backend: hasBackendAnswers(answers),
|
|
9687
9801
|
features: [],
|
|
9688
9802
|
template: "vite",
|
|
9689
9803
|
// Only Vite for now
|
|
@@ -9712,7 +9826,7 @@ async function runQuestionnaire(questions, initialAnswers, showWIP, askFor) {
|
|
|
9712
9826
|
choices = choices.filter((c3) => allowed.includes(c3.value));
|
|
9713
9827
|
}
|
|
9714
9828
|
if (choices.length === 0) continue;
|
|
9715
|
-
answer = await askFor.selection(question.question, choices);
|
|
9829
|
+
answer = question.type === "multi-select" ? await askFor.multiSelection(question.question, choices, [], false) : await askFor.selection(question.question, choices);
|
|
9716
9830
|
break;
|
|
9717
9831
|
}
|
|
9718
9832
|
case "confirm":
|
|
@@ -9732,6 +9846,140 @@ async function runQuestionnaire(questions, initialAnswers, showWIP, askFor) {
|
|
|
9732
9846
|
}
|
|
9733
9847
|
return answers;
|
|
9734
9848
|
}
|
|
9849
|
+
var APP_QUESTIONNAIRE, PROJECT_QUESTIONNAIRE;
|
|
9850
|
+
var init_scaffolding_questionnaire = __esm({
|
|
9851
|
+
"packages/tooling/src/utils/scaffolding-questionnaire.ts"() {
|
|
9852
|
+
"use strict";
|
|
9853
|
+
init_utils2();
|
|
9854
|
+
init_create_utils();
|
|
9855
|
+
APP_QUESTIONNAIRE = [
|
|
9856
|
+
{
|
|
9857
|
+
id: "framework",
|
|
9858
|
+
question: "Which framework?",
|
|
9859
|
+
type: "select",
|
|
9860
|
+
defaultValue: "vite",
|
|
9861
|
+
choices: [
|
|
9862
|
+
{
|
|
9863
|
+
title: "Vite \u2014 SPA/SaaS (client-side rendering, fast dev)",
|
|
9864
|
+
value: "vite"
|
|
9865
|
+
},
|
|
9866
|
+
{
|
|
9867
|
+
title: "Next.js \u2014 Static content/SEO (SSR, SSG) \u2014 BETA",
|
|
9868
|
+
value: "nextjs"
|
|
9869
|
+
},
|
|
9870
|
+
{
|
|
9871
|
+
title: "Expo \u2014 Mobile app (iOS + Android)",
|
|
9872
|
+
value: "expo"
|
|
9873
|
+
}
|
|
9874
|
+
]
|
|
9875
|
+
},
|
|
9876
|
+
{
|
|
9877
|
+
id: "host",
|
|
9878
|
+
question: "Where will you host?",
|
|
9879
|
+
type: "select",
|
|
9880
|
+
condition: (answers) => answers.framework !== "expo",
|
|
9881
|
+
defaultValue: (answers) => {
|
|
9882
|
+
return answers.framework === "nextjs" ? "vercel" : "none";
|
|
9883
|
+
},
|
|
9884
|
+
choices: [
|
|
9885
|
+
{ title: "None \u2014 no hosting config", value: "none" },
|
|
9886
|
+
{ title: "Vercel \u2014 edge CDN + serverless", value: "vercel" },
|
|
9887
|
+
{ title: "Firebase Hosting \u2014 Google CDN", value: "firebase" }
|
|
9888
|
+
]
|
|
9889
|
+
},
|
|
9890
|
+
{
|
|
9891
|
+
id: "functions",
|
|
9892
|
+
question: "Serverless functions?",
|
|
9893
|
+
type: "select",
|
|
9894
|
+
defaultValue: "none",
|
|
9895
|
+
// Choices filtered dynamically based on host
|
|
9896
|
+
choices: [
|
|
9897
|
+
{ title: "None", value: "none" },
|
|
9898
|
+
{ title: "Vercel Functions \u2014 edge + node.js", value: "vercel" },
|
|
9899
|
+
{ title: "Firebase Functions \u2014 Google Cloud", value: "firebase" },
|
|
9900
|
+
{ title: "Supabase Edge Functions \u2014 Deno", value: "supabase" }
|
|
9901
|
+
],
|
|
9902
|
+
choicesFilter: (answers) => {
|
|
9903
|
+
const host = answers.host ?? "none";
|
|
9904
|
+
const framework = answers.framework;
|
|
9905
|
+
if (framework === "expo") return ["none", "firebase", "supabase"];
|
|
9906
|
+
if (host === "firebase") return ["none", "firebase"];
|
|
9907
|
+
if (host === "vercel") return ["none", "vercel", "supabase"];
|
|
9908
|
+
return ["none", "vercel", "firebase", "supabase"];
|
|
9909
|
+
}
|
|
9910
|
+
},
|
|
9911
|
+
{
|
|
9912
|
+
id: "backend",
|
|
9913
|
+
question: "Backend / BaaS provider?",
|
|
9914
|
+
type: "select",
|
|
9915
|
+
defaultValue: (answers) => {
|
|
9916
|
+
if (answers.functions === "firebase") return "firebase";
|
|
9917
|
+
if (answers.functions === "supabase") return "supabase";
|
|
9918
|
+
return "none";
|
|
9919
|
+
},
|
|
9920
|
+
choices: [
|
|
9921
|
+
{ title: "None \u2014 frontend only", value: "none" },
|
|
9922
|
+
{
|
|
9923
|
+
title: "Firebase \u2014 Auth + Firestore + Storage",
|
|
9924
|
+
value: "firebase"
|
|
9925
|
+
},
|
|
9926
|
+
{
|
|
9927
|
+
title: "Supabase \u2014 Postgres + Auth + Storage",
|
|
9928
|
+
value: "supabase"
|
|
9929
|
+
}
|
|
9930
|
+
],
|
|
9931
|
+
choicesFilter: (answers) => {
|
|
9932
|
+
const functions = answers.functions ?? "none";
|
|
9933
|
+
if (functions === "firebase") return ["none", "firebase"];
|
|
9934
|
+
if (functions === "supabase") return ["none", "supabase"];
|
|
9935
|
+
if (functions === "vercel") return ["none"];
|
|
9936
|
+
return ["none", "firebase", "supabase"];
|
|
9937
|
+
}
|
|
9938
|
+
},
|
|
9939
|
+
{
|
|
9940
|
+
id: "features",
|
|
9941
|
+
question: "Features? (space to toggle, enter to confirm; none is fine)",
|
|
9942
|
+
type: "multi-select",
|
|
9943
|
+
condition: (answers) => hasBackendAnswers(answers),
|
|
9944
|
+
choices: [
|
|
9945
|
+
{
|
|
9946
|
+
title: "Billing (Stripe)",
|
|
9947
|
+
value: "billing",
|
|
9948
|
+
hint: "scaffolds the billing functions"
|
|
9949
|
+
},
|
|
9950
|
+
{
|
|
9951
|
+
title: "OAuth API connections",
|
|
9952
|
+
value: "oauth",
|
|
9953
|
+
hint: "third-party APIs via @donotdev/oauth, not social sign-in"
|
|
9954
|
+
}
|
|
9955
|
+
]
|
|
9956
|
+
}
|
|
9957
|
+
];
|
|
9958
|
+
PROJECT_QUESTIONNAIRE = [
|
|
9959
|
+
{
|
|
9960
|
+
id: "projectName",
|
|
9961
|
+
question: "Project name",
|
|
9962
|
+
type: "input",
|
|
9963
|
+
defaultValue: "my-project"
|
|
9964
|
+
},
|
|
9965
|
+
{
|
|
9966
|
+
id: "appNames",
|
|
9967
|
+
question: `App name(s) (comma-separated for multiple, e.g., web, admin) - '${RESERVED_APP_NAMES.join("', '")}' reserved`,
|
|
9968
|
+
type: "input",
|
|
9969
|
+
defaultValue: "web"
|
|
9970
|
+
}
|
|
9971
|
+
];
|
|
9972
|
+
}
|
|
9973
|
+
});
|
|
9974
|
+
|
|
9975
|
+
// packages/cli/src/bin/commands/create-app.ts
|
|
9976
|
+
init_utils2();
|
|
9977
|
+
|
|
9978
|
+
// packages/tooling/src/index.ts
|
|
9979
|
+
init_utils2();
|
|
9980
|
+
|
|
9981
|
+
// packages/tooling/src/cli/index.ts
|
|
9982
|
+
init_utils2();
|
|
9735
9983
|
|
|
9736
9984
|
// packages/tooling/src/scaffolding/create-app.ts
|
|
9737
9985
|
init_utils2();
|
|
@@ -9742,6 +9990,46 @@ var APP_FRAMEWORKS = ["vite", "nextjs", "expo"];
|
|
|
9742
9990
|
var HOSTS = ["none", "vercel", "firebase"];
|
|
9743
9991
|
var FUNCTIONS = ["none", "vercel", "firebase", "supabase"];
|
|
9744
9992
|
var BACKENDS = ["firebase", "supabase", "vercel", "none"];
|
|
9993
|
+
var FEATURE_FUNCTION_PATHS = {
|
|
9994
|
+
"functions-firebase": {
|
|
9995
|
+
billing: ["src/billing/"],
|
|
9996
|
+
oauth: ["src/oauth/"]
|
|
9997
|
+
},
|
|
9998
|
+
"functions-vercel": {
|
|
9999
|
+
billing: ["src/api/billing/"],
|
|
10000
|
+
oauth: ["src/api/oauth/"]
|
|
10001
|
+
},
|
|
10002
|
+
"functions-supabase": {
|
|
10003
|
+
billing: [
|
|
10004
|
+
"supabase/functions/cancel-subscription/",
|
|
10005
|
+
"supabase/functions/change-plan/",
|
|
10006
|
+
"supabase/functions/create-checkout-session/",
|
|
10007
|
+
"supabase/functions/create-customer-portal/",
|
|
10008
|
+
"supabase/functions/refresh-subscription-status/",
|
|
10009
|
+
"supabase/functions/stripe-webhook/"
|
|
10010
|
+
],
|
|
10011
|
+
oauth: [
|
|
10012
|
+
"supabase/functions/disconnect-oauth/",
|
|
10013
|
+
"supabase/functions/exchange-token/",
|
|
10014
|
+
"supabase/functions/get-connections/",
|
|
10015
|
+
"supabase/functions/refresh-token/"
|
|
10016
|
+
]
|
|
10017
|
+
}
|
|
10018
|
+
};
|
|
10019
|
+
function functionFeatureOf(functionsTemplate, file) {
|
|
10020
|
+
const owners = FEATURE_FUNCTION_PATHS[functionsTemplate];
|
|
10021
|
+
if (!owners) {
|
|
10022
|
+
throw new Error(
|
|
10023
|
+
`No feature map for functions template "${functionsTemplate}" (scaffold-matrix FEATURE_FUNCTION_PATHS)`
|
|
10024
|
+
);
|
|
10025
|
+
}
|
|
10026
|
+
for (const feature of ["billing", "oauth"]) {
|
|
10027
|
+
if (owners[feature].some((prefix) => file.startsWith(prefix))) {
|
|
10028
|
+
return feature;
|
|
10029
|
+
}
|
|
10030
|
+
}
|
|
10031
|
+
return null;
|
|
10032
|
+
}
|
|
9745
10033
|
function resolveDeployConfig(host, backend) {
|
|
9746
10034
|
if (host === "none") return null;
|
|
9747
10035
|
if (host === "firebase") return "firebase";
|
|
@@ -9763,9 +10051,11 @@ function getScaffoldParts(builder, host, functions, backend) {
|
|
|
9763
10051
|
// packages/tooling/src/scaffolding/create-app.ts
|
|
9764
10052
|
init_cli_input();
|
|
9765
10053
|
init_cli_output();
|
|
10054
|
+
init_create_utils();
|
|
9766
10055
|
|
|
9767
10056
|
// packages/tooling/src/utils/dependency-resolver.ts
|
|
9768
10057
|
init_utils2();
|
|
10058
|
+
init_matrix();
|
|
9769
10059
|
function applyConditionals(template, options) {
|
|
9770
10060
|
if (!template.conditional) return [];
|
|
9771
10061
|
const groups = [];
|
|
@@ -9805,13 +10095,13 @@ function generateScripts(templateName, options) {
|
|
|
9805
10095
|
scripts.lint = "eslint .";
|
|
9806
10096
|
scripts["type-check"] = "tsc --noEmit";
|
|
9807
10097
|
} else if (templateName === "consumer-root") {
|
|
9808
|
-
scripts.dev = "
|
|
10098
|
+
scripts.dev = "turbo run dev";
|
|
9809
10099
|
scripts.build = "turbo run build";
|
|
9810
10100
|
scripts.lint = "turbo run lint";
|
|
9811
|
-
scripts["type-check"] = "
|
|
10101
|
+
scripts["type-check"] = "turbo run type-check";
|
|
9812
10102
|
} else if (templateName.includes("functions")) {
|
|
9813
10103
|
scripts.build = "node build.mjs";
|
|
9814
|
-
scripts["
|
|
10104
|
+
scripts["type-check"] = "tsc --noEmit";
|
|
9815
10105
|
if (templateName.includes("firebase") || options.platform === "firebase") {
|
|
9816
10106
|
scripts.serve = "firebase emulators:start --only functions";
|
|
9817
10107
|
scripts.dev = "firebase emulators:start --only functions --inspect-functions";
|
|
@@ -9890,13 +10180,19 @@ function generatePackageJson(templateName, mode, options = {}) {
|
|
|
9890
10180
|
}
|
|
9891
10181
|
if (templateName === "consumer-root") {
|
|
9892
10182
|
result.packageManager = "bun@1.3.5";
|
|
9893
|
-
result.engines = {
|
|
10183
|
+
result.engines = {
|
|
10184
|
+
node: getNodePolicy(mode).enginesMin,
|
|
10185
|
+
bun: ">=1.3.0"
|
|
10186
|
+
};
|
|
9894
10187
|
result.workspaces = ["apps/*", "entities"];
|
|
9895
10188
|
}
|
|
9896
10189
|
if (templateName === "entities") {
|
|
9897
10190
|
result.main = "./index.ts";
|
|
9898
10191
|
result.types = "./index.ts";
|
|
9899
10192
|
}
|
|
10193
|
+
if (templateName.includes("expo")) {
|
|
10194
|
+
result.main = "expo-router/entry";
|
|
10195
|
+
}
|
|
9900
10196
|
if (templateName.includes("nextjs")) {
|
|
9901
10197
|
result.browserslist = [
|
|
9902
10198
|
"chrome >= 64",
|
|
@@ -9957,6 +10253,7 @@ function generatePackageJson(templateName, mode, options = {}) {
|
|
|
9957
10253
|
init_type_guards();
|
|
9958
10254
|
init_pathResolver();
|
|
9959
10255
|
init_pathResolver();
|
|
10256
|
+
init_scaffolding_questionnaire();
|
|
9960
10257
|
var SHOW_WIP = process.env.SHOW_WIP === "true" || process.argv.includes("--wip");
|
|
9961
10258
|
async function createApp(appName, appConfig, workspaceRoot, templatesRoot) {
|
|
9962
10259
|
const isInteractive = !appName || !appConfig;
|
|
@@ -9989,10 +10286,12 @@ async function createApp(appName, appConfig, workspaceRoot, templatesRoot) {
|
|
|
9989
10286
|
}
|
|
9990
10287
|
const answers = await runQuestionnaire(APP_QUESTIONNAIRE, {}, SHOW_WIP, {
|
|
9991
10288
|
selection: askForSelection,
|
|
10289
|
+
multiSelection: askForMultiSelection,
|
|
9992
10290
|
confirmation: askForConfirmation,
|
|
9993
10291
|
input: askForInput
|
|
9994
10292
|
});
|
|
9995
10293
|
const requirements = aggregateRequirements(answers);
|
|
10294
|
+
const { billing, oauth } = selectedFeatures(answers);
|
|
9996
10295
|
const framework = pickAllowed(
|
|
9997
10296
|
answers.framework || "vite",
|
|
9998
10297
|
APP_FRAMEWORKS,
|
|
@@ -10016,8 +10315,10 @@ async function createApp(appName, appConfig, workspaceRoot, templatesRoot) {
|
|
|
10016
10315
|
// Entities created manually or via generators
|
|
10017
10316
|
userAuth: "social",
|
|
10018
10317
|
// Always on (useAuthSafe)
|
|
10019
|
-
billing
|
|
10020
|
-
//
|
|
10318
|
+
billing,
|
|
10319
|
+
// "Features" question (default off; asked only with a backend)
|
|
10320
|
+
oauth,
|
|
10321
|
+
// "Features" question (default off; asked only with a backend)
|
|
10021
10322
|
features: []
|
|
10022
10323
|
};
|
|
10023
10324
|
} else {
|
|
@@ -10062,15 +10363,15 @@ async function createApp(appName, appConfig, workspaceRoot, templatesRoot) {
|
|
|
10062
10363
|
const templateDir = row.baseTemplate;
|
|
10063
10364
|
const firebaseProjectId = (appConfig?.firebaseProjectId ?? "").trim() || appName.toLowerCase().replace(/\s+/g, "-");
|
|
10064
10365
|
const firebaseRegion = appConfig?.firebaseRegion ?? "europe-west1";
|
|
10065
|
-
const backendPlatform = backend !== "none" ? backend : "firebase";
|
|
10066
10366
|
const deployConfig = row.deployConfig;
|
|
10067
10367
|
const replacements = {
|
|
10068
10368
|
projectName: appName,
|
|
10069
10369
|
appName,
|
|
10070
10370
|
appShortName: appName.toUpperCase().replace(/-/g, " "),
|
|
10071
10371
|
includeFunctions: Boolean(row.functionsTemplate),
|
|
10072
|
-
//
|
|
10073
|
-
|
|
10372
|
+
// firebase.json `functions` key: Firebase functions only. App detection reads it, so a
|
|
10373
|
+
// Vercel or Supabase runtime with that key would be detected (and deployed) as Firebase.
|
|
10374
|
+
includeFirebaseFunctions: row.functionsTemplate === "functions-firebase",
|
|
10074
10375
|
needsCRUD: Boolean(appConfig.needsCRUD),
|
|
10075
10376
|
setupGithubActions: false,
|
|
10076
10377
|
appNames: [appName],
|
|
@@ -10083,13 +10384,14 @@ async function createApp(appName, appConfig, workspaceRoot, templatesRoot) {
|
|
|
10083
10384
|
isExpo: appTemplate === "expo",
|
|
10084
10385
|
YOUR_FIREBASE_PROJECT_ID: firebaseProjectId,
|
|
10085
10386
|
YOUR_REGION: firebaseRegion,
|
|
10086
|
-
backendPlatform,
|
|
10087
|
-
isFirebase:
|
|
10088
|
-
isSupabase:
|
|
10089
|
-
isVercel:
|
|
10387
|
+
backendPlatform: backend,
|
|
10388
|
+
isFirebase: backend === "firebase",
|
|
10389
|
+
isSupabase: backend === "supabase",
|
|
10390
|
+
isVercel: backend === "vercel",
|
|
10090
10391
|
needsAuth: appConfig.userAuth !== "none",
|
|
10392
|
+
// Function templates gate billing / OAuth exports and config on these (functions-firebase index.ts, supabase config.toml)
|
|
10091
10393
|
needsBilling: appConfig.billing,
|
|
10092
|
-
needsOAuth: appConfig.
|
|
10394
|
+
needsOAuth: appConfig.oauth
|
|
10093
10395
|
};
|
|
10094
10396
|
const templateSourceDir = joinPath(templatesRoot, templateDir);
|
|
10095
10397
|
const templateFiles = await glob("**/*", {
|
|
@@ -10098,6 +10400,9 @@ async function createApp(appName, appConfig, workspaceRoot, templatesRoot) {
|
|
|
10098
10400
|
onlyFiles: true
|
|
10099
10401
|
});
|
|
10100
10402
|
for (const file of templateFiles) {
|
|
10403
|
+
if (file === "service-account-key.json.example" && backend !== "firebase") {
|
|
10404
|
+
continue;
|
|
10405
|
+
}
|
|
10101
10406
|
const sourcePath = joinPath(templateSourceDir, file);
|
|
10102
10407
|
let destFileName = file;
|
|
10103
10408
|
if (destFileName.endsWith(".example")) {
|
|
@@ -10165,9 +10470,7 @@ async function createApp(appName, appConfig, workspaceRoot, templatesRoot) {
|
|
|
10165
10470
|
appName,
|
|
10166
10471
|
template: isReservedTemplate ? "vite" : appTemplate,
|
|
10167
10472
|
includeFunctions: Boolean(row.functionsTemplate),
|
|
10168
|
-
|
|
10169
|
-
includeVercelFunctions: row.functionsTemplate === "functions-vercel",
|
|
10170
|
-
platform: isReservedTemplate ? void 0 : backendPlatform
|
|
10473
|
+
platform: isReservedTemplate ? void 0 : backend
|
|
10171
10474
|
});
|
|
10172
10475
|
const packageJsonPath = joinPath(appDir, "package.json");
|
|
10173
10476
|
await write(packageJsonPath, packageJson, {
|
|
@@ -10210,6 +10513,8 @@ async function createApp(appName, appConfig, workspaceRoot, templatesRoot) {
|
|
|
10210
10513
|
});
|
|
10211
10514
|
for (const file of templateFiles2) {
|
|
10212
10515
|
if (file === "package.json.example") continue;
|
|
10516
|
+
const feature = functionFeatureOf(functionsTemplateName, file);
|
|
10517
|
+
if (feature && !appConfig[feature]) continue;
|
|
10213
10518
|
const sourcePath = joinPath(templateDir2, file);
|
|
10214
10519
|
let destFileName = file;
|
|
10215
10520
|
if (destFileName.endsWith(".example")) {
|
|
@@ -10225,6 +10530,22 @@ async function createApp(appName, appConfig, workspaceRoot, templatesRoot) {
|
|
|
10225
10530
|
});
|
|
10226
10531
|
}
|
|
10227
10532
|
}
|
|
10533
|
+
if (!isSupabaseFunctions) {
|
|
10534
|
+
const rootFunctionsTsconfig = joinPath(
|
|
10535
|
+
workspaceRoot,
|
|
10536
|
+
"tsconfig.functions.json"
|
|
10537
|
+
);
|
|
10538
|
+
if (!pathExists(rootFunctionsTsconfig)) {
|
|
10539
|
+
await copy(
|
|
10540
|
+
joinPath(
|
|
10541
|
+
templatesRoot,
|
|
10542
|
+
"deploy-config",
|
|
10543
|
+
"tsconfig.functions.json.example"
|
|
10544
|
+
),
|
|
10545
|
+
rootFunctionsTsconfig
|
|
10546
|
+
);
|
|
10547
|
+
}
|
|
10548
|
+
}
|
|
10228
10549
|
}
|
|
10229
10550
|
}
|
|
10230
10551
|
const deploymentTemplateDir = joinPath(templatesRoot, "deploy-config");
|
|
@@ -10248,7 +10569,7 @@ async function createApp(appName, appConfig, workspaceRoot, templatesRoot) {
|
|
|
10248
10569
|
const hosting = firebaseJson.hosting;
|
|
10249
10570
|
if (isObjectLike(hosting) && Array.isArray(hosting.rewrites)) {
|
|
10250
10571
|
hosting.rewrites = hosting.rewrites.filter(
|
|
10251
|
-
(r2) => !(isObjectLike(r2) && r2.destination === "/
|
|
10572
|
+
(r2) => !(isObjectLike(r2) && r2.destination === "/_shell.html")
|
|
10252
10573
|
);
|
|
10253
10574
|
}
|
|
10254
10575
|
if (isObjectLike(hosting)) {
|
|
@@ -10283,40 +10604,49 @@ async function createApp(appName, appConfig, workspaceRoot, templatesRoot) {
|
|
|
10283
10604
|
}
|
|
10284
10605
|
}
|
|
10285
10606
|
}
|
|
10286
|
-
|
|
10607
|
+
const firebaseFunctions = row.functionsTemplate === "functions-firebase";
|
|
10608
|
+
const firebaseBackendWithoutHost = !deployConfig && backend === "firebase" && Boolean(row.functionsTemplate);
|
|
10609
|
+
if (deployConfig !== "firebase" && (firebaseFunctions || firebaseBackendWithoutHost)) {
|
|
10610
|
+
const firebaseRules = backend === "firebase";
|
|
10287
10611
|
const firebaseJsonPath = joinPath(appDir, "firebase.json");
|
|
10288
10612
|
if (!pathExists(firebaseJsonPath)) {
|
|
10289
|
-
const
|
|
10290
|
-
|
|
10291
|
-
|
|
10292
|
-
|
|
10293
|
-
|
|
10294
|
-
|
|
10295
|
-
|
|
10296
|
-
|
|
10297
|
-
|
|
10298
|
-
|
|
10299
|
-
|
|
10300
|
-
|
|
10301
|
-
|
|
10302
|
-
|
|
10303
|
-
|
|
10304
|
-
|
|
10305
|
-
|
|
10306
|
-
|
|
10307
|
-
|
|
10308
|
-
|
|
10613
|
+
const noHostingFirebaseJson = {
|
|
10614
|
+
...firebaseFunctions && {
|
|
10615
|
+
functions: [
|
|
10616
|
+
{
|
|
10617
|
+
source: "functions",
|
|
10618
|
+
codebase: "default",
|
|
10619
|
+
ignore: [
|
|
10620
|
+
"node_modules",
|
|
10621
|
+
".git",
|
|
10622
|
+
"firebase-debug.log",
|
|
10623
|
+
"firebase-debug.*.log",
|
|
10624
|
+
"**/.*",
|
|
10625
|
+
"**/*.test.ts",
|
|
10626
|
+
"**/__tests__/**"
|
|
10627
|
+
],
|
|
10628
|
+
runtime: "nodejs22"
|
|
10629
|
+
}
|
|
10630
|
+
]
|
|
10631
|
+
},
|
|
10632
|
+
...firebaseRules && {
|
|
10633
|
+
firestore: {
|
|
10634
|
+
rules: "firestore.rules",
|
|
10635
|
+
indexes: "firestore.indexes.json"
|
|
10636
|
+
},
|
|
10637
|
+
storage: { rules: "storage.rules" }
|
|
10309
10638
|
},
|
|
10310
|
-
storage: { rules: "storage.rules" },
|
|
10311
10639
|
emulators: {
|
|
10312
|
-
auth: { port: 9099 },
|
|
10313
|
-
functions: { port: 5001 },
|
|
10314
|
-
|
|
10315
|
-
|
|
10640
|
+
...firebaseRules && { auth: { port: 9099 } },
|
|
10641
|
+
...firebaseFunctions && { functions: { port: 5001 } },
|
|
10642
|
+
...firebaseRules && {
|
|
10643
|
+
firestore: { port: 8080 },
|
|
10644
|
+
storage: { port: 9199 }
|
|
10645
|
+
},
|
|
10316
10646
|
ui: { enabled: true, port: 4e3 }
|
|
10317
10647
|
}
|
|
10318
10648
|
};
|
|
10319
|
-
await write(firebaseJsonPath,
|
|
10649
|
+
await write(firebaseJsonPath, noHostingFirebaseJson, {
|
|
10320
10650
|
format: "json",
|
|
10321
10651
|
overwrite: true
|
|
10322
10652
|
});
|
|
@@ -10331,15 +10661,17 @@ async function createApp(appName, appConfig, workspaceRoot, templatesRoot) {
|
|
|
10331
10661
|
if (await isTextFile(firebasercDest))
|
|
10332
10662
|
await replacePlaceholders(firebasercDest, replacements);
|
|
10333
10663
|
}
|
|
10334
|
-
|
|
10335
|
-
|
|
10336
|
-
|
|
10337
|
-
|
|
10338
|
-
|
|
10339
|
-
|
|
10340
|
-
|
|
10341
|
-
|
|
10342
|
-
|
|
10664
|
+
if (firebaseRules) {
|
|
10665
|
+
for (const example of [
|
|
10666
|
+
"firestore.rules.example",
|
|
10667
|
+
"firestore.indexes.json.example",
|
|
10668
|
+
"storage.rules.example"
|
|
10669
|
+
]) {
|
|
10670
|
+
const src = joinPath(deploymentTemplateDir, example);
|
|
10671
|
+
const dest = joinPath(appDir, example.replace(".example", ""));
|
|
10672
|
+
if (pathExists(src) && !pathExists(dest)) {
|
|
10673
|
+
await copy(src, dest);
|
|
10674
|
+
}
|
|
10343
10675
|
}
|
|
10344
10676
|
}
|
|
10345
10677
|
}
|
|
@@ -10365,6 +10697,14 @@ async function createApp(appName, appConfig, workspaceRoot, templatesRoot) {
|
|
|
10365
10697
|
})).filter((d) => d.isDirectory()).map((d) => d.name).filter(isValidFileName) : [];
|
|
10366
10698
|
await updateRootPackageJson(workspaceRoot, allDirs);
|
|
10367
10699
|
}
|
|
10700
|
+
await mergeProjectArgs(workspaceRoot, {
|
|
10701
|
+
features: [
|
|
10702
|
+
...backend !== "none" || functions !== "none" ? ["functions"] : [],
|
|
10703
|
+
...appConfig.billing ? ["billing"] : [],
|
|
10704
|
+
...appConfig.oauth ? ["oauth"] : []
|
|
10705
|
+
],
|
|
10706
|
+
region: appConfig.firebaseRegion
|
|
10707
|
+
});
|
|
10368
10708
|
if (isInteractive) {
|
|
10369
10709
|
outro("\u{1F389} App created successfully!");
|
|
10370
10710
|
const firebaseStep = row.functionsTemplate === "functions-firebase" ? `2. Set Firebase project: cd apps/${appName} && firebase use --add (or edit .firebaserc)
|
|
@@ -10384,7 +10724,7 @@ Happy coding!`,
|
|
|
10384
10724
|
}
|
|
10385
10725
|
async function main(options) {
|
|
10386
10726
|
try {
|
|
10387
|
-
const hasExplicitFlags = options?.builder !== void 0 || options?.host !== void 0 || options?.functions !== void 0 || options?.backend !== void 0;
|
|
10727
|
+
const hasExplicitFlags = options?.builder !== void 0 || options?.host !== void 0 || options?.functions !== void 0 || options?.backend !== void 0 || options?.billing !== void 0 || options?.oauth !== void 0;
|
|
10388
10728
|
if (hasExplicitFlags && options?.name) {
|
|
10389
10729
|
const appName = options.name;
|
|
10390
10730
|
const builder = options.builder || "vite";
|
|
@@ -10401,6 +10741,13 @@ async function main(options) {
|
|
|
10401
10741
|
`App name "${appName}" is reserved for framework demos. Please choose a different name.`
|
|
10402
10742
|
);
|
|
10403
10743
|
}
|
|
10744
|
+
const billing = options.billing === true;
|
|
10745
|
+
const oauth = options.oauth === true;
|
|
10746
|
+
if ((billing || oauth) && backendOpt === "none" && functionsOpt === "none") {
|
|
10747
|
+
throw new Error(
|
|
10748
|
+
"--billing and --oauth scaffold functions: pass --functions <runtime> or --backend <backend> too."
|
|
10749
|
+
);
|
|
10750
|
+
}
|
|
10404
10751
|
const appConfig = {
|
|
10405
10752
|
template: builder === "next" ? "nextjs" : builder === "expo" ? "expo" : "vite",
|
|
10406
10753
|
host: hostOpt,
|
|
@@ -10409,7 +10756,10 @@ async function main(options) {
|
|
|
10409
10756
|
needsCRUD: true,
|
|
10410
10757
|
selectedEntities: [],
|
|
10411
10758
|
userAuth: "social",
|
|
10412
|
-
billing
|
|
10759
|
+
billing,
|
|
10760
|
+
// --billing (default off)
|
|
10761
|
+
oauth,
|
|
10762
|
+
// --oauth (default off)
|
|
10413
10763
|
features: [],
|
|
10414
10764
|
firebaseProjectId: options.firebaseProjectId,
|
|
10415
10765
|
firebaseRegion: options.firebaseRegion
|
|
@@ -10423,6 +10773,9 @@ async function main(options) {
|
|
|
10423
10773
|
throw error2;
|
|
10424
10774
|
}
|
|
10425
10775
|
}
|
|
10776
|
+
|
|
10777
|
+
// packages/tooling/src/cli/index.ts
|
|
10778
|
+
init_create_utils();
|
|
10426
10779
|
export {
|
|
10427
10780
|
main
|
|
10428
10781
|
};
|