@donotdev/cli 0.0.37 → 0.1.1
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/LICENSE.md +21 -48
- package/dependencies-matrix.json +108 -58
- package/dist/bin/commands/agent-setup.js +7196 -123
- package/dist/bin/commands/build.js +3341 -207
- package/dist/bin/commands/bump.js +268 -24
- package/dist/bin/commands/cacheout.js +262 -13
- package/dist/bin/commands/coach.js +365 -61
- package/dist/bin/commands/create-app.js +261 -14
- package/dist/bin/commands/create-project.js +270 -15
- package/dist/bin/commands/db.js +10743 -2346
- package/dist/bin/commands/deploy.js +4202 -776
- package/dist/bin/commands/dev.js +353 -38
- package/dist/bin/commands/doctor.js +412 -108
- package/dist/bin/commands/emu.js +392 -57
- package/dist/bin/commands/format.js +250 -15
- package/dist/bin/commands/get-demo.js +261 -14
- package/dist/bin/commands/make-admin.js +10022 -1552
- package/dist/bin/commands/preview.js +353 -38
- package/dist/bin/commands/seed.js +10743 -2346
- package/dist/bin/commands/setup-cicd.js +456 -133
- package/dist/bin/commands/setup.js +428 -125
- package/dist/bin/commands/staging.js +4202 -776
- package/dist/bin/commands/sync-secrets.js +250 -14
- package/dist/bin/commands/type-check.js +249 -13
- package/dist/bin/commands/wai.js +249 -13
- package/dist/bin/dndev.js +33 -4
- package/dist/bin/donotdev.js +33 -4
- package/dist/index.js +4278 -856
- package/{templates/root-consumer/guides/dndev/advanced/VERSION_CONTROL.md.example → guidelines/VERSION_CONTROL.md} +7 -11
- package/package.json +3 -2
- package/templates/app-demo/src/themes.css.example +21 -0
- package/templates/app-dndev/index.html.example +0 -3
- package/templates/app-dndev/src/themes.css.example +21 -0
- package/templates/app-next/src/app/layout.tsx.example +13 -4
- package/templates/app-next/src/themes.css.example +21 -0
- package/templates/app-vite/csp.example.json +44 -0
- package/templates/app-vite/index.html.example +0 -3
- package/templates/app-vite/src/themes.css.example +21 -0
- package/templates/functions-supabase/supabase/functions/.env.example +12 -0
- package/templates/functions-supabase/supabase/functions/disconnect-oauth/index.ts.example +7 -0
- package/templates/functions-supabase/supabase/functions/exchange-token/index.ts.example +7 -0
- package/templates/functions-supabase/supabase/functions/get-connections/index.ts.example +7 -0
- package/templates/functions-supabase/supabase/functions/refresh-token/index.ts.example +7 -0
- package/templates/functions-supabase/supabase/migrations/20250101000000_idempotency.sql +3 -0
- package/templates/functions-supabase/supabase/migrations/20250101000001_rate_limits.sql +3 -0
- package/templates/functions-supabase/supabase/migrations/20250101000003_operation_metrics.sql +3 -0
- package/templates/preset-admin/src/pages/DashboardPage.tsx.example +189 -0
- package/templates/preset-admin/src/pages/EntityPage.tsx.example +84 -0
- package/templates/preset-admin/src/pages/ReportsPage.tsx.example +243 -0
- package/templates/preset-admin/src/pages/SettingsPage.tsx.example +283 -0
- package/templates/preset-admin/src/pages/UsersPage.tsx.example +128 -0
- package/templates/preset-ecommerce/src/pages/CartPage.tsx.example +167 -0
- package/templates/preset-ecommerce/src/pages/CatalogPage.tsx.example +187 -0
- package/templates/preset-ecommerce/src/pages/CheckoutPage.tsx.example +244 -0
- package/templates/preset-ecommerce/src/pages/HomePage.tsx.example +268 -0
- package/templates/preset-ecommerce/src/pages/ProductPage.tsx.example +228 -0
- package/templates/preset-landing/src/pages/AboutPage.tsx.example +237 -0
- package/templates/preset-landing/src/pages/ContactPage.tsx.example +192 -0
- package/templates/preset-landing/src/pages/HomePage.tsx.example +399 -0
- package/templates/preset-saas/src/pages/DashboardPage.tsx.example +195 -0
- package/templates/preset-saas/src/pages/HomePage.tsx.example +270 -0
- package/templates/preset-saas/src/pages/PricingPage.tsx.example +204 -0
- package/templates/preset-saas/src/pages/ProfilePage.tsx.example +191 -0
- package/templates/preset-saas/src/pages/SettingsPage.tsx.example +292 -0
- package/templates/root-consumer/.claude/hooks/framework-compliance.sh.example +56 -0
- package/templates/root-consumer/.claude/hooks/guard-bash.sh.example +61 -0
- package/templates/root-consumer/.claude/hooks/guard-files.sh.example +46 -0
- package/templates/root-consumer/.claude/hooks/guard-mcp.sh.example +91 -0
- package/templates/root-consumer/.claude/hooks/guard-secrets.sh.example +67 -0
- package/templates/root-consumer/.claude/hooks/guard-write.sh.example +89 -0
- package/templates/root-consumer/.claude/hooks/session-start.sh.example +50 -0
- package/templates/root-consumer/.claude/hooks/track-mcp-lookup.sh.example +20 -0
- package/templates/root-consumer/.claude/hooks/typecheck-stop.sh.example +18 -0
- package/templates/root-consumer/.claude/rules/consumer-ux.md.example +32 -0
- package/templates/root-consumer/.claude/rules/definition-of-done.md.example +32 -0
- package/templates/root-consumer/.claude/rules/framework.md.example +39 -0
- package/templates/root-consumer/.claude/rules/git.md.example +14 -0
- package/templates/root-consumer/.claude/rules/security.md.example +13 -0
- package/templates/root-consumer/.claude/settings.json.example +123 -1
- package/templates/root-consumer/.claude/skills/brainstorm/SKILL.md.example +16 -0
- package/templates/root-consumer/.claude/skills/build/SKILL.md.example +103 -25
- package/templates/root-consumer/.claude/skills/design/SKILL.md.example +17 -0
- package/templates/root-consumer/.claude/skills/grill/SKILL.md.example +33 -16
- package/templates/root-consumer/.claude/skills/polish/SKILL.md.example +50 -37
- package/templates/root-consumer/AI.md.example +2 -2
- package/templates/root-consumer/CLAUDE.md.example +33 -1
- package/templates/root-consumer/guides/dndev/INDEX.md.example +23 -27
- package/templates/root-consumer/guides/dndev/SETUP_AUTH.md.example +3 -2
- package/templates/root-consumer/guides/dndev/SETUP_OAUTH.md.example +12 -6
- package/templates/root-consumer/guides/dndev/SETUP_SUPABASE.md.example +50 -3
- package/templates/root-consumer/guides/wai-way/blueprints/3_compose.md.example +13 -15
- package/templates/app-demo/public/manifest.json.example +0 -10
- package/templates/app-dndev/public/manifest.json.example +0 -10
- package/templates/root-consumer/.claude/commands/brainstorm.md.example +0 -147
- package/templates/root-consumer/.claude/commands/build.md.example +0 -131
- package/templates/root-consumer/.claude/commands/design.md.example +0 -153
- package/templates/root-consumer/.claude/commands/grill.md.example +0 -108
- package/templates/root-consumer/.claude/commands/polish.md.example +0 -146
- package/templates/root-consumer/.claude/commands/techdebt.md.example +0 -28
- package/templates/root-consumer/guides/dndev/COMPONENTS_ATOMIC.md.example +0 -180
- package/templates/root-consumer/guides/dndev/COMPONENTS_CRUD.md.example +0 -234
- package/templates/root-consumer/guides/dndev/COMPONENTS_UI.md.example +0 -136
- package/templates/root-consumer/guides/dndev/COMPONENT_API.md.example +0 -195
- package/templates/root-consumer/guides/dndev/ENV_SETUP.md.example +0 -219
- package/templates/root-consumer/guides/dndev/GOTCHAS.md.example +0 -197
- package/templates/root-consumer/guides/dndev/SETUP_APP_CONFIG.md.example +0 -132
- package/templates/root-consumer/guides/dndev/SETUP_BLOG.md.example +0 -280
- package/templates/root-consumer/guides/dndev/SETUP_CICD.md.example +0 -115
- package/templates/root-consumer/guides/dndev/SETUP_CRUD.md.example +0 -334
- package/templates/root-consumer/guides/dndev/SETUP_FUNCTIONS.md.example +0 -9
- package/templates/root-consumer/guides/dndev/SETUP_I18N.md.example +0 -233
- package/templates/root-consumer/guides/dndev/SETUP_LAYOUTS.md.example +0 -158
- package/templates/root-consumer/guides/dndev/SETUP_PAGES.md.example +0 -205
- package/templates/root-consumer/guides/dndev/SETUP_PWA.md.example +0 -213
- package/templates/root-consumer/guides/dndev/SETUP_TESTING.md.example +0 -184
- package/templates/root-consumer/guides/dndev/SETUP_THEMES.md.example +0 -111
- package/templates/root-consumer/guides/dndev/SETUP_VERCEL.md.example +0 -260
- package/templates/root-consumer/guides/dndev/USE_ROUTING.md.example +0 -499
- package/templates/root-consumer/guides/dndev/essences_reference.css.example +0 -288
|
@@ -2440,14 +2440,15 @@ var require_braces = __commonJS({
|
|
|
2440
2440
|
}
|
|
2441
2441
|
});
|
|
2442
2442
|
|
|
2443
|
-
// node_modules/.bun/picomatch@2.3.
|
|
2443
|
+
// node_modules/.bun/picomatch@2.3.2/node_modules/picomatch/lib/constants.js
|
|
2444
2444
|
var require_constants2 = __commonJS({
|
|
2445
|
-
"node_modules/.bun/picomatch@2.3.
|
|
2445
|
+
"node_modules/.bun/picomatch@2.3.2/node_modules/picomatch/lib/constants.js"(exports, module) {
|
|
2446
2446
|
"use strict";
|
|
2447
2447
|
init_utils();
|
|
2448
2448
|
var path = __require("path");
|
|
2449
2449
|
var WIN_SLASH = "\\\\/";
|
|
2450
2450
|
var WIN_NO_SLASH = `[^${WIN_SLASH}]`;
|
|
2451
|
+
var DEFAULT_MAX_EXTGLOB_RECURSION = 0;
|
|
2451
2452
|
var DOT_LITERAL = "\\.";
|
|
2452
2453
|
var PLUS_LITERAL = "\\+";
|
|
2453
2454
|
var QMARK_LITERAL = "\\?";
|
|
@@ -2495,6 +2496,7 @@ var require_constants2 = __commonJS({
|
|
|
2495
2496
|
END_ANCHOR: `(?:[${WIN_SLASH}]|$)`
|
|
2496
2497
|
};
|
|
2497
2498
|
var POSIX_REGEX_SOURCE = {
|
|
2499
|
+
__proto__: null,
|
|
2498
2500
|
alnum: "a-zA-Z0-9",
|
|
2499
2501
|
alpha: "a-zA-Z",
|
|
2500
2502
|
ascii: "\\x00-\\x7F",
|
|
@@ -2511,6 +2513,7 @@ var require_constants2 = __commonJS({
|
|
|
2511
2513
|
xdigit: "A-Fa-f0-9"
|
|
2512
2514
|
};
|
|
2513
2515
|
module.exports = {
|
|
2516
|
+
DEFAULT_MAX_EXTGLOB_RECURSION,
|
|
2514
2517
|
MAX_LENGTH: 1024 * 64,
|
|
2515
2518
|
POSIX_REGEX_SOURCE,
|
|
2516
2519
|
// regular expressions
|
|
@@ -2522,6 +2525,7 @@ var require_constants2 = __commonJS({
|
|
|
2522
2525
|
REGEX_REMOVE_BACKSLASH: /(?:\[.*?[^\\]\]|\\(?=.))/g,
|
|
2523
2526
|
// Replace globs with equivalent patterns to reduce parsing time.
|
|
2524
2527
|
REPLACEMENTS: {
|
|
2528
|
+
__proto__: null,
|
|
2525
2529
|
"***": "*",
|
|
2526
2530
|
"**/**": "**",
|
|
2527
2531
|
"**/**/**": "**"
|
|
@@ -2638,9 +2642,9 @@ var require_constants2 = __commonJS({
|
|
|
2638
2642
|
}
|
|
2639
2643
|
});
|
|
2640
2644
|
|
|
2641
|
-
// node_modules/.bun/picomatch@2.3.
|
|
2645
|
+
// node_modules/.bun/picomatch@2.3.2/node_modules/picomatch/lib/utils.js
|
|
2642
2646
|
var require_utils2 = __commonJS({
|
|
2643
|
-
"node_modules/.bun/picomatch@2.3.
|
|
2647
|
+
"node_modules/.bun/picomatch@2.3.2/node_modules/picomatch/lib/utils.js"(exports) {
|
|
2644
2648
|
"use strict";
|
|
2645
2649
|
init_utils();
|
|
2646
2650
|
var path = __require("path");
|
|
@@ -2700,9 +2704,9 @@ var require_utils2 = __commonJS({
|
|
|
2700
2704
|
}
|
|
2701
2705
|
});
|
|
2702
2706
|
|
|
2703
|
-
// node_modules/.bun/picomatch@2.3.
|
|
2707
|
+
// node_modules/.bun/picomatch@2.3.2/node_modules/picomatch/lib/scan.js
|
|
2704
2708
|
var require_scan = __commonJS({
|
|
2705
|
-
"node_modules/.bun/picomatch@2.3.
|
|
2709
|
+
"node_modules/.bun/picomatch@2.3.2/node_modules/picomatch/lib/scan.js"(exports, module) {
|
|
2706
2710
|
"use strict";
|
|
2707
2711
|
init_utils();
|
|
2708
2712
|
var utils = require_utils2();
|
|
@@ -3031,9 +3035,9 @@ var require_scan = __commonJS({
|
|
|
3031
3035
|
}
|
|
3032
3036
|
});
|
|
3033
3037
|
|
|
3034
|
-
// node_modules/.bun/picomatch@2.3.
|
|
3038
|
+
// node_modules/.bun/picomatch@2.3.2/node_modules/picomatch/lib/parse.js
|
|
3035
3039
|
var require_parse2 = __commonJS({
|
|
3036
|
-
"node_modules/.bun/picomatch@2.3.
|
|
3040
|
+
"node_modules/.bun/picomatch@2.3.2/node_modules/picomatch/lib/parse.js"(exports, module) {
|
|
3037
3041
|
"use strict";
|
|
3038
3042
|
init_utils();
|
|
3039
3043
|
var constants2 = require_constants2();
|
|
@@ -3061,6 +3065,213 @@ var require_parse2 = __commonJS({
|
|
|
3061
3065
|
var syntaxError = (type, char) => {
|
|
3062
3066
|
return `Missing ${type}: "${char}" - use "\\\\${char}" to match literal characters`;
|
|
3063
3067
|
};
|
|
3068
|
+
var splitTopLevel = (input) => {
|
|
3069
|
+
const parts = [];
|
|
3070
|
+
let bracket = 0;
|
|
3071
|
+
let paren = 0;
|
|
3072
|
+
let quote = 0;
|
|
3073
|
+
let value = "";
|
|
3074
|
+
let escaped = false;
|
|
3075
|
+
for (const ch of input) {
|
|
3076
|
+
if (escaped === true) {
|
|
3077
|
+
value += ch;
|
|
3078
|
+
escaped = false;
|
|
3079
|
+
continue;
|
|
3080
|
+
}
|
|
3081
|
+
if (ch === "\\") {
|
|
3082
|
+
value += ch;
|
|
3083
|
+
escaped = true;
|
|
3084
|
+
continue;
|
|
3085
|
+
}
|
|
3086
|
+
if (ch === '"') {
|
|
3087
|
+
quote = quote === 1 ? 0 : 1;
|
|
3088
|
+
value += ch;
|
|
3089
|
+
continue;
|
|
3090
|
+
}
|
|
3091
|
+
if (quote === 0) {
|
|
3092
|
+
if (ch === "[") {
|
|
3093
|
+
bracket++;
|
|
3094
|
+
} else if (ch === "]" && bracket > 0) {
|
|
3095
|
+
bracket--;
|
|
3096
|
+
} else if (bracket === 0) {
|
|
3097
|
+
if (ch === "(") {
|
|
3098
|
+
paren++;
|
|
3099
|
+
} else if (ch === ")" && paren > 0) {
|
|
3100
|
+
paren--;
|
|
3101
|
+
} else if (ch === "|" && paren === 0) {
|
|
3102
|
+
parts.push(value);
|
|
3103
|
+
value = "";
|
|
3104
|
+
continue;
|
|
3105
|
+
}
|
|
3106
|
+
}
|
|
3107
|
+
}
|
|
3108
|
+
value += ch;
|
|
3109
|
+
}
|
|
3110
|
+
parts.push(value);
|
|
3111
|
+
return parts;
|
|
3112
|
+
};
|
|
3113
|
+
var isPlainBranch = (branch) => {
|
|
3114
|
+
let escaped = false;
|
|
3115
|
+
for (const ch of branch) {
|
|
3116
|
+
if (escaped === true) {
|
|
3117
|
+
escaped = false;
|
|
3118
|
+
continue;
|
|
3119
|
+
}
|
|
3120
|
+
if (ch === "\\") {
|
|
3121
|
+
escaped = true;
|
|
3122
|
+
continue;
|
|
3123
|
+
}
|
|
3124
|
+
if (/[?*+@!()[\]{}]/.test(ch)) {
|
|
3125
|
+
return false;
|
|
3126
|
+
}
|
|
3127
|
+
}
|
|
3128
|
+
return true;
|
|
3129
|
+
};
|
|
3130
|
+
var normalizeSimpleBranch = (branch) => {
|
|
3131
|
+
let value = branch.trim();
|
|
3132
|
+
let changed = true;
|
|
3133
|
+
while (changed === true) {
|
|
3134
|
+
changed = false;
|
|
3135
|
+
if (/^@\([^\\()[\]{}|]+\)$/.test(value)) {
|
|
3136
|
+
value = value.slice(2, -1);
|
|
3137
|
+
changed = true;
|
|
3138
|
+
}
|
|
3139
|
+
}
|
|
3140
|
+
if (!isPlainBranch(value)) {
|
|
3141
|
+
return;
|
|
3142
|
+
}
|
|
3143
|
+
return value.replace(/\\(.)/g, "$1");
|
|
3144
|
+
};
|
|
3145
|
+
var hasRepeatedCharPrefixOverlap = (branches) => {
|
|
3146
|
+
const values = branches.map(normalizeSimpleBranch).filter(Boolean);
|
|
3147
|
+
for (let i = 0; i < values.length; i++) {
|
|
3148
|
+
for (let j2 = i + 1; j2 < values.length; j2++) {
|
|
3149
|
+
const a = values[i];
|
|
3150
|
+
const b3 = values[j2];
|
|
3151
|
+
const char = a[0];
|
|
3152
|
+
if (!char || a !== char.repeat(a.length) || b3 !== char.repeat(b3.length)) {
|
|
3153
|
+
continue;
|
|
3154
|
+
}
|
|
3155
|
+
if (a === b3 || a.startsWith(b3) || b3.startsWith(a)) {
|
|
3156
|
+
return true;
|
|
3157
|
+
}
|
|
3158
|
+
}
|
|
3159
|
+
}
|
|
3160
|
+
return false;
|
|
3161
|
+
};
|
|
3162
|
+
var parseRepeatedExtglob = (pattern, requireEnd = true) => {
|
|
3163
|
+
if (pattern[0] !== "+" && pattern[0] !== "*" || pattern[1] !== "(") {
|
|
3164
|
+
return;
|
|
3165
|
+
}
|
|
3166
|
+
let bracket = 0;
|
|
3167
|
+
let paren = 0;
|
|
3168
|
+
let quote = 0;
|
|
3169
|
+
let escaped = false;
|
|
3170
|
+
for (let i = 1; i < pattern.length; i++) {
|
|
3171
|
+
const ch = pattern[i];
|
|
3172
|
+
if (escaped === true) {
|
|
3173
|
+
escaped = false;
|
|
3174
|
+
continue;
|
|
3175
|
+
}
|
|
3176
|
+
if (ch === "\\") {
|
|
3177
|
+
escaped = true;
|
|
3178
|
+
continue;
|
|
3179
|
+
}
|
|
3180
|
+
if (ch === '"') {
|
|
3181
|
+
quote = quote === 1 ? 0 : 1;
|
|
3182
|
+
continue;
|
|
3183
|
+
}
|
|
3184
|
+
if (quote === 1) {
|
|
3185
|
+
continue;
|
|
3186
|
+
}
|
|
3187
|
+
if (ch === "[") {
|
|
3188
|
+
bracket++;
|
|
3189
|
+
continue;
|
|
3190
|
+
}
|
|
3191
|
+
if (ch === "]" && bracket > 0) {
|
|
3192
|
+
bracket--;
|
|
3193
|
+
continue;
|
|
3194
|
+
}
|
|
3195
|
+
if (bracket > 0) {
|
|
3196
|
+
continue;
|
|
3197
|
+
}
|
|
3198
|
+
if (ch === "(") {
|
|
3199
|
+
paren++;
|
|
3200
|
+
continue;
|
|
3201
|
+
}
|
|
3202
|
+
if (ch === ")") {
|
|
3203
|
+
paren--;
|
|
3204
|
+
if (paren === 0) {
|
|
3205
|
+
if (requireEnd === true && i !== pattern.length - 1) {
|
|
3206
|
+
return;
|
|
3207
|
+
}
|
|
3208
|
+
return {
|
|
3209
|
+
type: pattern[0],
|
|
3210
|
+
body: pattern.slice(2, i),
|
|
3211
|
+
end: i
|
|
3212
|
+
};
|
|
3213
|
+
}
|
|
3214
|
+
}
|
|
3215
|
+
}
|
|
3216
|
+
};
|
|
3217
|
+
var getStarExtglobSequenceOutput = (pattern) => {
|
|
3218
|
+
let index = 0;
|
|
3219
|
+
const chars = [];
|
|
3220
|
+
while (index < pattern.length) {
|
|
3221
|
+
const match = parseRepeatedExtglob(pattern.slice(index), false);
|
|
3222
|
+
if (!match || match.type !== "*") {
|
|
3223
|
+
return;
|
|
3224
|
+
}
|
|
3225
|
+
const branches = splitTopLevel(match.body).map((branch2) => branch2.trim());
|
|
3226
|
+
if (branches.length !== 1) {
|
|
3227
|
+
return;
|
|
3228
|
+
}
|
|
3229
|
+
const branch = normalizeSimpleBranch(branches[0]);
|
|
3230
|
+
if (!branch || branch.length !== 1) {
|
|
3231
|
+
return;
|
|
3232
|
+
}
|
|
3233
|
+
chars.push(branch);
|
|
3234
|
+
index += match.end + 1;
|
|
3235
|
+
}
|
|
3236
|
+
if (chars.length < 1) {
|
|
3237
|
+
return;
|
|
3238
|
+
}
|
|
3239
|
+
const source = chars.length === 1 ? utils.escapeRegex(chars[0]) : `[${chars.map((ch) => utils.escapeRegex(ch)).join("")}]`;
|
|
3240
|
+
return `${source}*`;
|
|
3241
|
+
};
|
|
3242
|
+
var repeatedExtglobRecursion = (pattern) => {
|
|
3243
|
+
let depth = 0;
|
|
3244
|
+
let value = pattern.trim();
|
|
3245
|
+
let match = parseRepeatedExtglob(value);
|
|
3246
|
+
while (match) {
|
|
3247
|
+
depth++;
|
|
3248
|
+
value = match.body.trim();
|
|
3249
|
+
match = parseRepeatedExtglob(value);
|
|
3250
|
+
}
|
|
3251
|
+
return depth;
|
|
3252
|
+
};
|
|
3253
|
+
var analyzeRepeatedExtglob = (body, options) => {
|
|
3254
|
+
if (options.maxExtglobRecursion === false) {
|
|
3255
|
+
return { risky: false };
|
|
3256
|
+
}
|
|
3257
|
+
const max = typeof options.maxExtglobRecursion === "number" ? options.maxExtglobRecursion : constants2.DEFAULT_MAX_EXTGLOB_RECURSION;
|
|
3258
|
+
const branches = splitTopLevel(body).map((branch) => branch.trim());
|
|
3259
|
+
if (branches.length > 1) {
|
|
3260
|
+
if (branches.some((branch) => branch === "") || branches.some((branch) => /^[*?]+$/.test(branch)) || hasRepeatedCharPrefixOverlap(branches)) {
|
|
3261
|
+
return { risky: true };
|
|
3262
|
+
}
|
|
3263
|
+
}
|
|
3264
|
+
for (const branch of branches) {
|
|
3265
|
+
const safeOutput = getStarExtglobSequenceOutput(branch);
|
|
3266
|
+
if (safeOutput) {
|
|
3267
|
+
return { risky: true, safeOutput };
|
|
3268
|
+
}
|
|
3269
|
+
if (repeatedExtglobRecursion(branch) > max) {
|
|
3270
|
+
return { risky: true };
|
|
3271
|
+
}
|
|
3272
|
+
}
|
|
3273
|
+
return { risky: false };
|
|
3274
|
+
};
|
|
3064
3275
|
var parse2 = (input, options) => {
|
|
3065
3276
|
if (typeof input !== "string") {
|
|
3066
3277
|
throw new TypeError("Expected a string");
|
|
@@ -3192,6 +3403,8 @@ var require_parse2 = __commonJS({
|
|
|
3192
3403
|
token.prev = prev;
|
|
3193
3404
|
token.parens = state.parens;
|
|
3194
3405
|
token.output = state.output;
|
|
3406
|
+
token.startIndex = state.index;
|
|
3407
|
+
token.tokensIndex = tokens.length;
|
|
3195
3408
|
const output = (opts.capture ? "(" : "") + token.open;
|
|
3196
3409
|
increment("parens");
|
|
3197
3410
|
push({ type, value: value2, output: state.output ? "" : ONE_CHAR });
|
|
@@ -3199,6 +3412,26 @@ var require_parse2 = __commonJS({
|
|
|
3199
3412
|
extglobs.push(token);
|
|
3200
3413
|
};
|
|
3201
3414
|
const extglobClose = (token) => {
|
|
3415
|
+
const literal = input.slice(token.startIndex, state.index + 1);
|
|
3416
|
+
const body = input.slice(token.startIndex + 2, state.index);
|
|
3417
|
+
const analysis = analyzeRepeatedExtglob(body, opts);
|
|
3418
|
+
if ((token.type === "plus" || token.type === "star") && analysis.risky) {
|
|
3419
|
+
const safeOutput = analysis.safeOutput ? (token.output ? "" : ONE_CHAR) + (opts.capture ? `(${analysis.safeOutput})` : analysis.safeOutput) : void 0;
|
|
3420
|
+
const open = tokens[token.tokensIndex];
|
|
3421
|
+
open.type = "text";
|
|
3422
|
+
open.value = literal;
|
|
3423
|
+
open.output = safeOutput || utils.escapeRegex(literal);
|
|
3424
|
+
for (let i = token.tokensIndex + 1; i < tokens.length; i++) {
|
|
3425
|
+
tokens[i].value = "";
|
|
3426
|
+
tokens[i].output = "";
|
|
3427
|
+
delete tokens[i].suffix;
|
|
3428
|
+
}
|
|
3429
|
+
state.output = token.output + open.output;
|
|
3430
|
+
state.backtrack = true;
|
|
3431
|
+
push({ type: "paren", extglob: true, value, output: "" });
|
|
3432
|
+
decrement("parens");
|
|
3433
|
+
return;
|
|
3434
|
+
}
|
|
3202
3435
|
let output = token.close + (opts.capture ? ")" : "");
|
|
3203
3436
|
let rest;
|
|
3204
3437
|
if (token.type === "negate") {
|
|
@@ -3805,9 +4038,9 @@ var require_parse2 = __commonJS({
|
|
|
3805
4038
|
}
|
|
3806
4039
|
});
|
|
3807
4040
|
|
|
3808
|
-
// node_modules/.bun/picomatch@2.3.
|
|
4041
|
+
// node_modules/.bun/picomatch@2.3.2/node_modules/picomatch/lib/picomatch.js
|
|
3809
4042
|
var require_picomatch = __commonJS({
|
|
3810
|
-
"node_modules/.bun/picomatch@2.3.
|
|
4043
|
+
"node_modules/.bun/picomatch@2.3.2/node_modules/picomatch/lib/picomatch.js"(exports, module) {
|
|
3811
4044
|
"use strict";
|
|
3812
4045
|
init_utils();
|
|
3813
4046
|
var path = __require("path");
|
|
@@ -3947,9 +4180,9 @@ var require_picomatch = __commonJS({
|
|
|
3947
4180
|
}
|
|
3948
4181
|
});
|
|
3949
4182
|
|
|
3950
|
-
// node_modules/.bun/picomatch@2.3.
|
|
4183
|
+
// node_modules/.bun/picomatch@2.3.2/node_modules/picomatch/index.js
|
|
3951
4184
|
var require_picomatch2 = __commonJS({
|
|
3952
|
-
"node_modules/.bun/picomatch@2.3.
|
|
4185
|
+
"node_modules/.bun/picomatch@2.3.2/node_modules/picomatch/index.js"(exports, module) {
|
|
3953
4186
|
"use strict";
|
|
3954
4187
|
init_utils();
|
|
3955
4188
|
module.exports = require_picomatch();
|
|
@@ -7745,7 +7978,10 @@ var init_PathResolver = __esm({
|
|
|
7745
7978
|
*/
|
|
7746
7979
|
getEmptyCjsModulePath() {
|
|
7747
7980
|
const resolved = this.resolvePackage("@donotdev/core/empty");
|
|
7748
|
-
if (!resolved)
|
|
7981
|
+
if (!resolved)
|
|
7982
|
+
throw new Error(
|
|
7983
|
+
"Cannot resolve @donotdev/core/empty \u2014 package setup is broken"
|
|
7984
|
+
);
|
|
7749
7985
|
return resolved;
|
|
7750
7986
|
}
|
|
7751
7987
|
// === PRIVATE METHODS ===
|
|
@@ -7848,6 +8084,24 @@ function readFirebaserc(filePath) {
|
|
|
7848
8084
|
}
|
|
7849
8085
|
return content;
|
|
7850
8086
|
}
|
|
8087
|
+
function readPackageJson(filePath) {
|
|
8088
|
+
if (!pathExists(filePath)) {
|
|
8089
|
+
throw new DoNotDevError(
|
|
8090
|
+
`package.json not found: ${filePath}`,
|
|
8091
|
+
DO_NOT_DEV_ERROR_CODES.FILE_NOT_FOUND,
|
|
8092
|
+
{ context: { filePath } }
|
|
8093
|
+
);
|
|
8094
|
+
}
|
|
8095
|
+
const content = readSync(filePath, { format: "json" });
|
|
8096
|
+
if (!content || typeof content !== "object" || !("name" in content)) {
|
|
8097
|
+
throw new DoNotDevError(
|
|
8098
|
+
`Invalid package.json: ${filePath}`,
|
|
8099
|
+
DO_NOT_DEV_ERROR_CODES.CONFIG_INVALID,
|
|
8100
|
+
{ context: { filePath } }
|
|
8101
|
+
);
|
|
8102
|
+
}
|
|
8103
|
+
return content;
|
|
8104
|
+
}
|
|
7851
8105
|
var init_typed_file_operations = __esm({
|
|
7852
8106
|
"packages/tooling/src/utils/typed-file-operations.ts"() {
|
|
7853
8107
|
"use strict";
|
|
@@ -7884,6 +8138,172 @@ var init_utils = __esm({
|
|
|
7884
8138
|
}
|
|
7885
8139
|
});
|
|
7886
8140
|
|
|
8141
|
+
// packages/tooling/src/utils/app-detection.ts
|
|
8142
|
+
function usesFirebase(app) {
|
|
8143
|
+
return app.provider === "firebase" || app.provider === "both";
|
|
8144
|
+
}
|
|
8145
|
+
function usesSupabase(app) {
|
|
8146
|
+
return app.provider === "supabase" || app.provider === "both";
|
|
8147
|
+
}
|
|
8148
|
+
function usesVercel(app) {
|
|
8149
|
+
return app.hosting === "vercel" || app.functions === "vercel";
|
|
8150
|
+
}
|
|
8151
|
+
function analyzeApp(appPath, appName) {
|
|
8152
|
+
const packageJsonPath = joinPath(appPath, "package.json");
|
|
8153
|
+
if (!pathExists(packageJsonPath)) {
|
|
8154
|
+
return null;
|
|
8155
|
+
}
|
|
8156
|
+
let packageJson = null;
|
|
8157
|
+
try {
|
|
8158
|
+
packageJson = readPackageJson(packageJsonPath);
|
|
8159
|
+
if (!packageJson.name) {
|
|
8160
|
+
return null;
|
|
8161
|
+
}
|
|
8162
|
+
} catch {
|
|
8163
|
+
return null;
|
|
8164
|
+
}
|
|
8165
|
+
let framework = "unknown";
|
|
8166
|
+
if (pathExists(joinPath(appPath, "next.config.js")) || pathExists(joinPath(appPath, "next.config.ts")) || pathExists(joinPath(appPath, "next.config.mjs")) || packageJson.dependencies?.next || packageJson.devDependencies?.next) {
|
|
8167
|
+
framework = "nextjs";
|
|
8168
|
+
} else if (pathExists(joinPath(appPath, "vite.config.ts")) || pathExists(joinPath(appPath, "vite.config.js")) || pathExists(joinPath(appPath, "vite.config.mjs")) || packageJson.dependencies?.vite || packageJson.devDependencies?.vite) {
|
|
8169
|
+
framework = "vite";
|
|
8170
|
+
}
|
|
8171
|
+
const firebaseJsonPath = joinPath(appPath, "firebase.json");
|
|
8172
|
+
const hasFirebase = pathExists(firebaseJsonPath);
|
|
8173
|
+
const supabaseDir = joinPath(appPath, "supabase");
|
|
8174
|
+
const supabaseConfigPath = joinPath(supabaseDir, "config.toml");
|
|
8175
|
+
const hasSupabaseDep = !!(packageJson.dependencies?.["@donotdev/supabase"] || packageJson.dependencies?.["@supabase/supabase-js"]);
|
|
8176
|
+
let hasSupabase = pathExists(supabaseDir) || pathExists(supabaseConfigPath) || hasSupabaseDep;
|
|
8177
|
+
if (!hasSupabase) {
|
|
8178
|
+
try {
|
|
8179
|
+
const envPath = joinPath(appPath, ".env");
|
|
8180
|
+
if (pathExists(envPath)) {
|
|
8181
|
+
const envContent = readSync(envPath);
|
|
8182
|
+
if (envContent.match(/VITE_SUPABASE_URL=.+/)) {
|
|
8183
|
+
hasSupabase = true;
|
|
8184
|
+
}
|
|
8185
|
+
}
|
|
8186
|
+
} catch {
|
|
8187
|
+
}
|
|
8188
|
+
}
|
|
8189
|
+
let provider = "unknown";
|
|
8190
|
+
if (hasFirebase && hasSupabase) {
|
|
8191
|
+
provider = "both";
|
|
8192
|
+
} else if (hasFirebase) {
|
|
8193
|
+
provider = "firebase";
|
|
8194
|
+
} else if (hasSupabase) {
|
|
8195
|
+
provider = "supabase";
|
|
8196
|
+
}
|
|
8197
|
+
let firebaseConfig;
|
|
8198
|
+
if (hasFirebase) {
|
|
8199
|
+
try {
|
|
8200
|
+
const config = readSync(firebaseJsonPath, { format: "json" });
|
|
8201
|
+
if (config && typeof config === "object") {
|
|
8202
|
+
const fb = config;
|
|
8203
|
+
firebaseConfig = {
|
|
8204
|
+
projectId: fb.projectId,
|
|
8205
|
+
hasHosting: !!fb.hosting,
|
|
8206
|
+
hasFunctions: !!fb.functions,
|
|
8207
|
+
hasFirestoreRules: !!fb.firestore?.rules,
|
|
8208
|
+
hasStorageRules: !!fb.storage?.rules
|
|
8209
|
+
};
|
|
8210
|
+
}
|
|
8211
|
+
} catch {
|
|
8212
|
+
firebaseConfig = {
|
|
8213
|
+
hasHosting: false,
|
|
8214
|
+
hasFunctions: false,
|
|
8215
|
+
hasFirestoreRules: false,
|
|
8216
|
+
hasStorageRules: false
|
|
8217
|
+
};
|
|
8218
|
+
}
|
|
8219
|
+
}
|
|
8220
|
+
const supabaseFunctionsDir = joinPath(supabaseDir, "functions");
|
|
8221
|
+
const supabaseMigrationsDir = joinPath(supabaseDir, "migrations");
|
|
8222
|
+
let supabaseConfig;
|
|
8223
|
+
if (hasSupabase) {
|
|
8224
|
+
let url;
|
|
8225
|
+
try {
|
|
8226
|
+
const envPath = joinPath(appPath, ".env");
|
|
8227
|
+
if (pathExists(envPath)) {
|
|
8228
|
+
const envContent = readSync(envPath);
|
|
8229
|
+
const urlMatch = envContent.match(/VITE_SUPABASE_URL=(.+)/);
|
|
8230
|
+
if (urlMatch && urlMatch[1]) {
|
|
8231
|
+
url = urlMatch[1].trim();
|
|
8232
|
+
}
|
|
8233
|
+
}
|
|
8234
|
+
} catch {
|
|
8235
|
+
}
|
|
8236
|
+
supabaseConfig = {
|
|
8237
|
+
url,
|
|
8238
|
+
hasFunctions: pathExists(supabaseFunctionsDir),
|
|
8239
|
+
hasMigrations: pathExists(supabaseMigrationsDir)
|
|
8240
|
+
};
|
|
8241
|
+
}
|
|
8242
|
+
let functions;
|
|
8243
|
+
if (hasFirebase && firebaseConfig?.hasFunctions) {
|
|
8244
|
+
const firebaseFunctionsDir = joinPath(appPath, "functions");
|
|
8245
|
+
const firebaseFunctionsStat = statSync2(firebaseFunctionsDir);
|
|
8246
|
+
if (pathExists(firebaseFunctionsDir) && (firebaseFunctionsStat?.isDirectory() ?? false)) {
|
|
8247
|
+
functions = "firebase";
|
|
8248
|
+
}
|
|
8249
|
+
}
|
|
8250
|
+
if (!functions && hasSupabase) {
|
|
8251
|
+
const sbFunctionsStat = statSync2(supabaseFunctionsDir);
|
|
8252
|
+
if (pathExists(supabaseFunctionsDir) && (sbFunctionsStat?.isDirectory() ?? false)) {
|
|
8253
|
+
functions = "supabase";
|
|
8254
|
+
}
|
|
8255
|
+
}
|
|
8256
|
+
if (!functions) {
|
|
8257
|
+
const vercelJsonPath = joinPath(appPath, "vercel.json");
|
|
8258
|
+
const apiDir = joinPath(appPath, "api");
|
|
8259
|
+
const apiDirStat = statSync2(apiDir);
|
|
8260
|
+
if (pathExists(vercelJsonPath) && pathExists(apiDir) && (apiDirStat?.isDirectory() ?? false)) {
|
|
8261
|
+
functions = "vercel";
|
|
8262
|
+
}
|
|
8263
|
+
}
|
|
8264
|
+
let hosting;
|
|
8265
|
+
if (hasFirebase && firebaseConfig?.hasHosting) {
|
|
8266
|
+
hosting = "firebase";
|
|
8267
|
+
}
|
|
8268
|
+
if (!hosting) {
|
|
8269
|
+
if (pathExists(joinPath(appPath, "vercel.json")) || pathExists(joinPath(appPath, ".vercel"))) {
|
|
8270
|
+
hosting = "vercel";
|
|
8271
|
+
}
|
|
8272
|
+
}
|
|
8273
|
+
return {
|
|
8274
|
+
name: appName,
|
|
8275
|
+
packageName: packageJson.name || appName,
|
|
8276
|
+
path: appPath,
|
|
8277
|
+
framework,
|
|
8278
|
+
provider,
|
|
8279
|
+
functions,
|
|
8280
|
+
hosting,
|
|
8281
|
+
firebaseConfig,
|
|
8282
|
+
supabaseConfig
|
|
8283
|
+
};
|
|
8284
|
+
}
|
|
8285
|
+
function detectProvider(appDir) {
|
|
8286
|
+
const pathParts = appDir.split(/[/\\]/);
|
|
8287
|
+
const appName = pathParts[pathParts.length - 1] || "app";
|
|
8288
|
+
const result = analyzeApp(appDir, appName);
|
|
8289
|
+
if (result) return result;
|
|
8290
|
+
return {
|
|
8291
|
+
name: appName,
|
|
8292
|
+
packageName: appName,
|
|
8293
|
+
path: appDir,
|
|
8294
|
+
framework: "unknown",
|
|
8295
|
+
provider: "unknown"
|
|
8296
|
+
};
|
|
8297
|
+
}
|
|
8298
|
+
var init_app_detection = __esm({
|
|
8299
|
+
"packages/tooling/src/utils/app-detection.ts"() {
|
|
8300
|
+
"use strict";
|
|
8301
|
+
init_utils();
|
|
8302
|
+
init_pathResolver();
|
|
8303
|
+
init_typed_file_operations();
|
|
8304
|
+
}
|
|
8305
|
+
});
|
|
8306
|
+
|
|
7887
8307
|
// packages/tooling/src/utils/cli-input.ts
|
|
7888
8308
|
async function askForConfirmation(message, defaultValue = false) {
|
|
7889
8309
|
const result = await ye({
|
|
@@ -8220,95 +8640,13 @@ function readStagingProject(startDir) {
|
|
|
8220
8640
|
return null;
|
|
8221
8641
|
}
|
|
8222
8642
|
|
|
8223
|
-
// packages/tooling/src/utils/provider-detection.ts
|
|
8224
|
-
init_utils();
|
|
8225
|
-
init_pathResolver();
|
|
8226
|
-
function detectProvider(appDir) {
|
|
8227
|
-
const firebaseJsonPath = joinPath(appDir, "firebase.json");
|
|
8228
|
-
const supabaseDir = joinPath(appDir, "supabase");
|
|
8229
|
-
const supabaseConfigPath = joinPath(supabaseDir, "config.toml");
|
|
8230
|
-
const supabaseFunctionsDir = joinPath(supabaseDir, "functions");
|
|
8231
|
-
const supabaseMigrationsDir = joinPath(supabaseDir, "migrations");
|
|
8232
|
-
const hasFirebase = pathExists(firebaseJsonPath);
|
|
8233
|
-
let hasSupabase = pathExists(supabaseDir) || pathExists(supabaseConfigPath);
|
|
8234
|
-
if (!hasSupabase) {
|
|
8235
|
-
try {
|
|
8236
|
-
const envPath = joinPath(appDir, ".env");
|
|
8237
|
-
if (pathExists(envPath)) {
|
|
8238
|
-
const envContent = readSync(envPath);
|
|
8239
|
-
if (envContent.match(/VITE_SUPABASE_URL=.+/)) {
|
|
8240
|
-
hasSupabase = true;
|
|
8241
|
-
}
|
|
8242
|
-
}
|
|
8243
|
-
} catch {
|
|
8244
|
-
}
|
|
8245
|
-
}
|
|
8246
|
-
let provider = "unknown";
|
|
8247
|
-
if (hasFirebase && hasSupabase) {
|
|
8248
|
-
provider = "both";
|
|
8249
|
-
} else if (hasFirebase) {
|
|
8250
|
-
provider = "firebase";
|
|
8251
|
-
} else if (hasSupabase) {
|
|
8252
|
-
provider = "supabase";
|
|
8253
|
-
}
|
|
8254
|
-
let firebaseConfig;
|
|
8255
|
-
if (hasFirebase) {
|
|
8256
|
-
try {
|
|
8257
|
-
const config = readSync(firebaseJsonPath, { format: "json" });
|
|
8258
|
-
if (config && typeof config === "object") {
|
|
8259
|
-
const firebaseConfigObj = config;
|
|
8260
|
-
firebaseConfig = {
|
|
8261
|
-
projectId: firebaseConfigObj.projectId,
|
|
8262
|
-
hasHosting: !!firebaseConfigObj.hosting,
|
|
8263
|
-
hasFunctions: !!firebaseConfigObj.functions,
|
|
8264
|
-
hasFirestoreRules: !!firebaseConfigObj.firestore?.rules,
|
|
8265
|
-
hasStorageRules: !!firebaseConfigObj.storage?.rules
|
|
8266
|
-
};
|
|
8267
|
-
}
|
|
8268
|
-
} catch {
|
|
8269
|
-
firebaseConfig = {
|
|
8270
|
-
hasHosting: false,
|
|
8271
|
-
hasFunctions: false,
|
|
8272
|
-
hasFirestoreRules: false,
|
|
8273
|
-
hasStorageRules: false
|
|
8274
|
-
};
|
|
8275
|
-
}
|
|
8276
|
-
}
|
|
8277
|
-
let supabaseConfig;
|
|
8278
|
-
if (hasSupabase) {
|
|
8279
|
-
let url;
|
|
8280
|
-
try {
|
|
8281
|
-
const envPath = joinPath(appDir, ".env");
|
|
8282
|
-
if (pathExists(envPath)) {
|
|
8283
|
-
const envContent = readSync(envPath);
|
|
8284
|
-
const urlMatch = envContent.match(/VITE_SUPABASE_URL=(.+)/);
|
|
8285
|
-
if (urlMatch && urlMatch[1]) {
|
|
8286
|
-
url = urlMatch[1].trim();
|
|
8287
|
-
}
|
|
8288
|
-
}
|
|
8289
|
-
} catch {
|
|
8290
|
-
}
|
|
8291
|
-
supabaseConfig = {
|
|
8292
|
-
url,
|
|
8293
|
-
hasFunctions: pathExists(supabaseFunctionsDir),
|
|
8294
|
-
hasMigrations: pathExists(supabaseMigrationsDir)
|
|
8295
|
-
};
|
|
8296
|
-
}
|
|
8297
|
-
return {
|
|
8298
|
-
provider,
|
|
8299
|
-
hasFirebase,
|
|
8300
|
-
hasSupabase,
|
|
8301
|
-
firebaseConfig,
|
|
8302
|
-
supabaseConfig
|
|
8303
|
-
};
|
|
8304
|
-
}
|
|
8305
|
-
|
|
8306
8643
|
// packages/tooling/src/scaffolding/setup-cicd.ts
|
|
8307
8644
|
init_utils();
|
|
8308
8645
|
import { execSync } from "node:child_process";
|
|
8309
8646
|
init_sync_secrets();
|
|
8310
8647
|
init_vercel_token();
|
|
8311
8648
|
init_pathResolver();
|
|
8649
|
+
init_app_detection();
|
|
8312
8650
|
init_secrets_resolver();
|
|
8313
8651
|
function isGhCliAvailable() {
|
|
8314
8652
|
try {
|
|
@@ -8338,9 +8676,9 @@ function detectStagingSupport(appDir) {
|
|
|
8338
8676
|
}
|
|
8339
8677
|
function collectSecrets(config) {
|
|
8340
8678
|
const secrets = [];
|
|
8341
|
-
const { appDir, projectRoot, providers,
|
|
8679
|
+
const { appDir, projectRoot, providers, hasStaging } = config;
|
|
8342
8680
|
const saPath = joinPath(appDir, "service-account-key.json");
|
|
8343
|
-
if (providers
|
|
8681
|
+
if (usesFirebase(providers) && pathExists(saPath)) {
|
|
8344
8682
|
secrets.push({
|
|
8345
8683
|
name: "FIREBASE_SERVICE_ACCOUNT",
|
|
8346
8684
|
value: "__SERVICE_ACCOUNT__",
|
|
@@ -8356,7 +8694,7 @@ function collectSecrets(config) {
|
|
|
8356
8694
|
source: "service-account-key.staging.json (base64)"
|
|
8357
8695
|
});
|
|
8358
8696
|
}
|
|
8359
|
-
if (
|
|
8697
|
+
if (usesVercel(providers)) {
|
|
8360
8698
|
const vercelResult = resolveVercelCredentials(appDir, projectRoot);
|
|
8361
8699
|
if (vercelResult.credentials) {
|
|
8362
8700
|
secrets.push({
|
|
@@ -8386,7 +8724,7 @@ function collectSecrets(config) {
|
|
|
8386
8724
|
}
|
|
8387
8725
|
}
|
|
8388
8726
|
}
|
|
8389
|
-
if (providers
|
|
8727
|
+
if (usesSupabase(providers)) {
|
|
8390
8728
|
const accessToken = resolveSecret("SUPABASE_ACCESS_TOKEN", projectRoot, {
|
|
8391
8729
|
appDir,
|
|
8392
8730
|
silent: true
|
|
@@ -8474,7 +8812,8 @@ jobs:
|
|
|
8474
8812
|
run: bun test
|
|
8475
8813
|
`;
|
|
8476
8814
|
}
|
|
8477
|
-
function generateDeployWorkflow(providers,
|
|
8815
|
+
function generateDeployWorkflow(providers, envSecretNames) {
|
|
8816
|
+
const appName = providers.name;
|
|
8478
8817
|
const envBlock = envSecretNames.filter((n) => n.startsWith("VITE_") || n.startsWith("NEXT_PUBLIC_")).map((n) => ` ${n}: \${{ secrets.${n} }}`).join("\n");
|
|
8479
8818
|
let steps = ` - name: Checkout repository
|
|
8480
8819
|
uses: actions/checkout@v4
|
|
@@ -8501,7 +8840,7 @@ function generateDeployWorkflow(providers, appName, envSecretNames) {
|
|
|
8501
8840
|
|
|
8502
8841
|
- name: Build
|
|
8503
8842
|
run: bun run build${envBlock ? "\n env:\n" + envBlock : ""}`;
|
|
8504
|
-
if (providers
|
|
8843
|
+
if (usesFirebase(providers)) {
|
|
8505
8844
|
const fbConfig = providers.firebaseConfig;
|
|
8506
8845
|
if (fbConfig?.hasFunctions) {
|
|
8507
8846
|
steps += `
|
|
@@ -8524,7 +8863,7 @@ function generateDeployWorkflow(providers, appName, envSecretNames) {
|
|
|
8524
8863
|
GOOGLE_APPLICATION_CREDENTIALS_JSON: \${{ secrets.FIREBASE_SERVICE_ACCOUNT }}
|
|
8525
8864
|
working-directory: apps/${appName}`;
|
|
8526
8865
|
}
|
|
8527
|
-
if (fbConfig?.hasHosting && !providers
|
|
8866
|
+
if (fbConfig?.hasHosting && !usesVercel(providers)) {
|
|
8528
8867
|
steps += `
|
|
8529
8868
|
|
|
8530
8869
|
- name: Deploy to Firebase Hosting
|
|
@@ -8536,7 +8875,7 @@ function generateDeployWorkflow(providers, appName, envSecretNames) {
|
|
|
8536
8875
|
entryPoint: apps/${appName}`;
|
|
8537
8876
|
}
|
|
8538
8877
|
}
|
|
8539
|
-
if (providers
|
|
8878
|
+
if (usesVercel(providers)) {
|
|
8540
8879
|
steps += `
|
|
8541
8880
|
|
|
8542
8881
|
- name: Deploy to Vercel
|
|
@@ -8547,7 +8886,7 @@ function generateDeployWorkflow(providers, appName, envSecretNames) {
|
|
|
8547
8886
|
VERCEL_PROJECT_ID: \${{ secrets.VERCEL_PROJECT_ID }}
|
|
8548
8887
|
working-directory: apps/${appName}`;
|
|
8549
8888
|
}
|
|
8550
|
-
if (providers
|
|
8889
|
+
if (usesSupabase(providers) && providers.supabaseConfig?.hasFunctions) {
|
|
8551
8890
|
steps += `
|
|
8552
8891
|
|
|
8553
8892
|
- name: Setup Supabase CLI
|
|
@@ -8575,7 +8914,8 @@ jobs:
|
|
|
8575
8914
|
${steps}
|
|
8576
8915
|
`;
|
|
8577
8916
|
}
|
|
8578
|
-
function generateStagingWorkflow(providers,
|
|
8917
|
+
function generateStagingWorkflow(providers, envSecretNames) {
|
|
8918
|
+
const appName = providers.name;
|
|
8579
8919
|
const envBlock = envSecretNames.filter((n) => n.startsWith("VITE_") || n.startsWith("NEXT_PUBLIC_")).map((n) => ` ${n}: \${{ secrets.${n} }}`).join("\n");
|
|
8580
8920
|
let steps = ` - name: Checkout repository
|
|
8581
8921
|
uses: actions/checkout@v4
|
|
@@ -8602,7 +8942,7 @@ function generateStagingWorkflow(providers, appName, envSecretNames) {
|
|
|
8602
8942
|
|
|
8603
8943
|
- name: Build (staging)
|
|
8604
8944
|
run: bun run build -- --mode staging${envBlock ? "\n env:\n" + envBlock : ""}`;
|
|
8605
|
-
if (providers
|
|
8945
|
+
if (usesFirebase(providers)) {
|
|
8606
8946
|
const fbConfig = providers.firebaseConfig;
|
|
8607
8947
|
if (fbConfig?.hasFunctions) {
|
|
8608
8948
|
steps += `
|
|
@@ -8625,7 +8965,7 @@ function generateStagingWorkflow(providers, appName, envSecretNames) {
|
|
|
8625
8965
|
GOOGLE_APPLICATION_CREDENTIALS_JSON: \${{ secrets.FIREBASE_SERVICE_ACCOUNT_STAGING }}
|
|
8626
8966
|
working-directory: apps/${appName}`;
|
|
8627
8967
|
}
|
|
8628
|
-
if (fbConfig?.hasHosting && !providers
|
|
8968
|
+
if (fbConfig?.hasHosting && !usesVercel(providers)) {
|
|
8629
8969
|
steps += `
|
|
8630
8970
|
|
|
8631
8971
|
- name: Deploy to Firebase Hosting (staging)
|
|
@@ -8637,7 +8977,7 @@ function generateStagingWorkflow(providers, appName, envSecretNames) {
|
|
|
8637
8977
|
entryPoint: apps/${appName}`;
|
|
8638
8978
|
}
|
|
8639
8979
|
}
|
|
8640
|
-
if (providers
|
|
8980
|
+
if (usesVercel(providers)) {
|
|
8641
8981
|
steps += `
|
|
8642
8982
|
|
|
8643
8983
|
- name: Deploy to Vercel (staging)
|
|
@@ -8710,14 +9050,12 @@ async function main(options = {}) {
|
|
|
8710
9050
|
return 1;
|
|
8711
9051
|
}
|
|
8712
9052
|
const providers = detectProvider(appDir);
|
|
8713
|
-
const hasVercel = pathExists(joinPath(appDir, "vercel.json")) || pathExists(joinPath(appDir, ".vercel"));
|
|
8714
9053
|
const staging = detectStagingSupport(appDir);
|
|
8715
9054
|
const config = {
|
|
8716
9055
|
appName,
|
|
8717
9056
|
appDir,
|
|
8718
9057
|
projectRoot,
|
|
8719
9058
|
providers,
|
|
8720
|
-
hasVercel,
|
|
8721
9059
|
hasStaging: staging.hasStaging,
|
|
8722
9060
|
stagingProjectId: staging.stagingProjectId
|
|
8723
9061
|
};
|
|
@@ -8731,9 +9069,9 @@ async function main(options = {}) {
|
|
|
8731
9069
|
workflows.push("deploy-staging.yml (staging)");
|
|
8732
9070
|
}
|
|
8733
9071
|
const providerLabels = [];
|
|
8734
|
-
if (providers
|
|
8735
|
-
if (
|
|
8736
|
-
if (providers
|
|
9072
|
+
if (usesFirebase(providers)) providerLabels.push("Firebase");
|
|
9073
|
+
if (usesVercel(providers)) providerLabels.push("Vercel");
|
|
9074
|
+
if (usesSupabase(providers)) providerLabels.push("Supabase");
|
|
8737
9075
|
const planLines = [
|
|
8738
9076
|
`App: ${appName}`,
|
|
8739
9077
|
`Repo: ${repo}`,
|
|
@@ -8766,7 +9104,7 @@ These will be skipped. Add them to .dndev.secrets or .env and re-run.`
|
|
|
8766
9104
|
const uploadableSecrets = secrets.filter(
|
|
8767
9105
|
(sec) => sec.value !== "" && sec.source !== "MISSING" && !sec.value.startsWith("__SERVICE_ACCOUNT")
|
|
8768
9106
|
);
|
|
8769
|
-
if (uploadableSecrets.length > 0 || providers
|
|
9107
|
+
if (uploadableSecrets.length > 0 || usesFirebase(providers)) {
|
|
8770
9108
|
s.start("Uploading secrets to GitHub...");
|
|
8771
9109
|
let successCount = 0;
|
|
8772
9110
|
let failCount = 0;
|
|
@@ -8781,7 +9119,7 @@ These will be skipped. Add them to .dndev.secrets or .env and re-run.`
|
|
|
8781
9119
|
);
|
|
8782
9120
|
}
|
|
8783
9121
|
}
|
|
8784
|
-
if (providers
|
|
9122
|
+
if (usesFirebase(providers)) {
|
|
8785
9123
|
try {
|
|
8786
9124
|
uploadServiceAccountToGitHub(appDir, repo, dryRun, false);
|
|
8787
9125
|
successCount++;
|
|
@@ -8803,26 +9141,11 @@ These will be skipped. Add them to .dndev.secrets or .env and re-run.`
|
|
|
8803
9141
|
}
|
|
8804
9142
|
const workflowDir = joinPath(projectRoot, ".github", "workflows");
|
|
8805
9143
|
const secretNames = secrets.map((s2) => s2.name);
|
|
8806
|
-
const workflowProviders = {
|
|
8807
|
-
hasFirebase: providers.hasFirebase,
|
|
8808
|
-
hasVercel,
|
|
8809
|
-
hasSupabase: providers.hasSupabase,
|
|
8810
|
-
firebaseConfig: providers.firebaseConfig,
|
|
8811
|
-
supabaseConfig: providers.supabaseConfig
|
|
8812
|
-
};
|
|
8813
9144
|
const ciYaml = generateCIWorkflow(appName);
|
|
8814
|
-
const deployYaml = generateDeployWorkflow(
|
|
8815
|
-
workflowProviders,
|
|
8816
|
-
appName,
|
|
8817
|
-
secretNames
|
|
8818
|
-
);
|
|
9145
|
+
const deployYaml = generateDeployWorkflow(providers, secretNames);
|
|
8819
9146
|
let stagingYaml;
|
|
8820
9147
|
if (config.hasStaging) {
|
|
8821
|
-
stagingYaml = generateStagingWorkflow(
|
|
8822
|
-
workflowProviders,
|
|
8823
|
-
appName,
|
|
8824
|
-
secretNames
|
|
8825
|
-
);
|
|
9148
|
+
stagingYaml = generateStagingWorkflow(providers, secretNames);
|
|
8826
9149
|
}
|
|
8827
9150
|
if (dryRun) {
|
|
8828
9151
|
log.info("\n--- ci.yml ---");
|