@donotdev/cli 0.1.0 → 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/dependencies-matrix.json +100 -50
- package/dist/bin/commands/agent-setup.js +245 -12
- package/dist/bin/commands/build.js +3339 -208
- package/dist/bin/commands/bump.js +245 -12
- package/dist/bin/commands/cacheout.js +245 -12
- package/dist/bin/commands/coach.js +361 -60
- package/dist/bin/commands/create-app.js +245 -12
- package/dist/bin/commands/create-project.js +253 -12
- package/dist/bin/commands/db.js +9114 -2327
- package/dist/bin/commands/deploy.js +4074 -694
- package/dist/bin/commands/dev.js +347 -33
- package/dist/bin/commands/doctor.js +408 -107
- package/dist/bin/commands/emu.js +386 -52
- package/dist/bin/commands/format.js +245 -12
- package/dist/bin/commands/get-demo.js +245 -12
- package/dist/bin/commands/make-admin.js +8356 -1516
- package/dist/bin/commands/preview.js +347 -33
- package/dist/bin/commands/seed.js +9114 -2327
- package/dist/bin/commands/setup-cicd.js +452 -132
- package/dist/bin/commands/setup.js +407 -107
- package/dist/bin/commands/staging.js +4074 -694
- package/dist/bin/commands/sync-secrets.js +246 -13
- package/dist/bin/commands/type-check.js +245 -12
- package/dist/bin/commands/wai.js +245 -12
- package/dist/bin/dndev.js +13 -4
- package/dist/bin/donotdev.js +13 -4
- package/dist/index.js +4169 -812
- package/{templates/root-consumer/guides/dndev/advanced/VERSION_CONTROL.md.example → guidelines/VERSION_CONTROL.md} +7 -11
- package/package.json +2 -1
- 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/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/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/build/SKILL.md.example +103 -25
- package/templates/root-consumer/.claude/skills/grill/SKILL.md.example +26 -15
- 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 +10 -5
- 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 -175
- package/templates/root-consumer/.claude/commands/build.md.example +0 -131
- package/templates/root-consumer/.claude/commands/design.md.example +0 -184
- package/templates/root-consumer/.claude/commands/grill.md.example +0 -135
- 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();
|
|
@@ -7851,6 +8084,24 @@ function readFirebaserc(filePath) {
|
|
|
7851
8084
|
}
|
|
7852
8085
|
return content;
|
|
7853
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
|
+
}
|
|
7854
8105
|
var init_typed_file_operations = __esm({
|
|
7855
8106
|
"packages/tooling/src/utils/typed-file-operations.ts"() {
|
|
7856
8107
|
"use strict";
|
|
@@ -7887,6 +8138,172 @@ var init_utils = __esm({
|
|
|
7887
8138
|
}
|
|
7888
8139
|
});
|
|
7889
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
|
+
|
|
7890
8307
|
// packages/tooling/src/utils/cli-input.ts
|
|
7891
8308
|
async function askForConfirmation(message, defaultValue = false) {
|
|
7892
8309
|
const result = await ye({
|
|
@@ -8223,95 +8640,13 @@ function readStagingProject(startDir) {
|
|
|
8223
8640
|
return null;
|
|
8224
8641
|
}
|
|
8225
8642
|
|
|
8226
|
-
// packages/tooling/src/utils/provider-detection.ts
|
|
8227
|
-
init_utils();
|
|
8228
|
-
init_pathResolver();
|
|
8229
|
-
function detectProvider(appDir) {
|
|
8230
|
-
const firebaseJsonPath = joinPath(appDir, "firebase.json");
|
|
8231
|
-
const supabaseDir = joinPath(appDir, "supabase");
|
|
8232
|
-
const supabaseConfigPath = joinPath(supabaseDir, "config.toml");
|
|
8233
|
-
const supabaseFunctionsDir = joinPath(supabaseDir, "functions");
|
|
8234
|
-
const supabaseMigrationsDir = joinPath(supabaseDir, "migrations");
|
|
8235
|
-
const hasFirebase = pathExists(firebaseJsonPath);
|
|
8236
|
-
let hasSupabase = pathExists(supabaseDir) || pathExists(supabaseConfigPath);
|
|
8237
|
-
if (!hasSupabase) {
|
|
8238
|
-
try {
|
|
8239
|
-
const envPath = joinPath(appDir, ".env");
|
|
8240
|
-
if (pathExists(envPath)) {
|
|
8241
|
-
const envContent = readSync(envPath);
|
|
8242
|
-
if (envContent.match(/VITE_SUPABASE_URL=.+/)) {
|
|
8243
|
-
hasSupabase = true;
|
|
8244
|
-
}
|
|
8245
|
-
}
|
|
8246
|
-
} catch {
|
|
8247
|
-
}
|
|
8248
|
-
}
|
|
8249
|
-
let provider = "unknown";
|
|
8250
|
-
if (hasFirebase && hasSupabase) {
|
|
8251
|
-
provider = "both";
|
|
8252
|
-
} else if (hasFirebase) {
|
|
8253
|
-
provider = "firebase";
|
|
8254
|
-
} else if (hasSupabase) {
|
|
8255
|
-
provider = "supabase";
|
|
8256
|
-
}
|
|
8257
|
-
let firebaseConfig;
|
|
8258
|
-
if (hasFirebase) {
|
|
8259
|
-
try {
|
|
8260
|
-
const config = readSync(firebaseJsonPath, { format: "json" });
|
|
8261
|
-
if (config && typeof config === "object") {
|
|
8262
|
-
const firebaseConfigObj = config;
|
|
8263
|
-
firebaseConfig = {
|
|
8264
|
-
projectId: firebaseConfigObj.projectId,
|
|
8265
|
-
hasHosting: !!firebaseConfigObj.hosting,
|
|
8266
|
-
hasFunctions: !!firebaseConfigObj.functions,
|
|
8267
|
-
hasFirestoreRules: !!firebaseConfigObj.firestore?.rules,
|
|
8268
|
-
hasStorageRules: !!firebaseConfigObj.storage?.rules
|
|
8269
|
-
};
|
|
8270
|
-
}
|
|
8271
|
-
} catch {
|
|
8272
|
-
firebaseConfig = {
|
|
8273
|
-
hasHosting: false,
|
|
8274
|
-
hasFunctions: false,
|
|
8275
|
-
hasFirestoreRules: false,
|
|
8276
|
-
hasStorageRules: false
|
|
8277
|
-
};
|
|
8278
|
-
}
|
|
8279
|
-
}
|
|
8280
|
-
let supabaseConfig;
|
|
8281
|
-
if (hasSupabase) {
|
|
8282
|
-
let url;
|
|
8283
|
-
try {
|
|
8284
|
-
const envPath = joinPath(appDir, ".env");
|
|
8285
|
-
if (pathExists(envPath)) {
|
|
8286
|
-
const envContent = readSync(envPath);
|
|
8287
|
-
const urlMatch = envContent.match(/VITE_SUPABASE_URL=(.+)/);
|
|
8288
|
-
if (urlMatch && urlMatch[1]) {
|
|
8289
|
-
url = urlMatch[1].trim();
|
|
8290
|
-
}
|
|
8291
|
-
}
|
|
8292
|
-
} catch {
|
|
8293
|
-
}
|
|
8294
|
-
supabaseConfig = {
|
|
8295
|
-
url,
|
|
8296
|
-
hasFunctions: pathExists(supabaseFunctionsDir),
|
|
8297
|
-
hasMigrations: pathExists(supabaseMigrationsDir)
|
|
8298
|
-
};
|
|
8299
|
-
}
|
|
8300
|
-
return {
|
|
8301
|
-
provider,
|
|
8302
|
-
hasFirebase,
|
|
8303
|
-
hasSupabase,
|
|
8304
|
-
firebaseConfig,
|
|
8305
|
-
supabaseConfig
|
|
8306
|
-
};
|
|
8307
|
-
}
|
|
8308
|
-
|
|
8309
8643
|
// packages/tooling/src/scaffolding/setup-cicd.ts
|
|
8310
8644
|
init_utils();
|
|
8311
8645
|
import { execSync } from "node:child_process";
|
|
8312
8646
|
init_sync_secrets();
|
|
8313
8647
|
init_vercel_token();
|
|
8314
8648
|
init_pathResolver();
|
|
8649
|
+
init_app_detection();
|
|
8315
8650
|
init_secrets_resolver();
|
|
8316
8651
|
function isGhCliAvailable() {
|
|
8317
8652
|
try {
|
|
@@ -8341,9 +8676,9 @@ function detectStagingSupport(appDir) {
|
|
|
8341
8676
|
}
|
|
8342
8677
|
function collectSecrets(config) {
|
|
8343
8678
|
const secrets = [];
|
|
8344
|
-
const { appDir, projectRoot, providers,
|
|
8679
|
+
const { appDir, projectRoot, providers, hasStaging } = config;
|
|
8345
8680
|
const saPath = joinPath(appDir, "service-account-key.json");
|
|
8346
|
-
if (providers
|
|
8681
|
+
if (usesFirebase(providers) && pathExists(saPath)) {
|
|
8347
8682
|
secrets.push({
|
|
8348
8683
|
name: "FIREBASE_SERVICE_ACCOUNT",
|
|
8349
8684
|
value: "__SERVICE_ACCOUNT__",
|
|
@@ -8359,7 +8694,7 @@ function collectSecrets(config) {
|
|
|
8359
8694
|
source: "service-account-key.staging.json (base64)"
|
|
8360
8695
|
});
|
|
8361
8696
|
}
|
|
8362
|
-
if (
|
|
8697
|
+
if (usesVercel(providers)) {
|
|
8363
8698
|
const vercelResult = resolveVercelCredentials(appDir, projectRoot);
|
|
8364
8699
|
if (vercelResult.credentials) {
|
|
8365
8700
|
secrets.push({
|
|
@@ -8389,7 +8724,7 @@ function collectSecrets(config) {
|
|
|
8389
8724
|
}
|
|
8390
8725
|
}
|
|
8391
8726
|
}
|
|
8392
|
-
if (providers
|
|
8727
|
+
if (usesSupabase(providers)) {
|
|
8393
8728
|
const accessToken = resolveSecret("SUPABASE_ACCESS_TOKEN", projectRoot, {
|
|
8394
8729
|
appDir,
|
|
8395
8730
|
silent: true
|
|
@@ -8477,7 +8812,8 @@ jobs:
|
|
|
8477
8812
|
run: bun test
|
|
8478
8813
|
`;
|
|
8479
8814
|
}
|
|
8480
|
-
function generateDeployWorkflow(providers,
|
|
8815
|
+
function generateDeployWorkflow(providers, envSecretNames) {
|
|
8816
|
+
const appName = providers.name;
|
|
8481
8817
|
const envBlock = envSecretNames.filter((n) => n.startsWith("VITE_") || n.startsWith("NEXT_PUBLIC_")).map((n) => ` ${n}: \${{ secrets.${n} }}`).join("\n");
|
|
8482
8818
|
let steps = ` - name: Checkout repository
|
|
8483
8819
|
uses: actions/checkout@v4
|
|
@@ -8504,7 +8840,7 @@ function generateDeployWorkflow(providers, appName, envSecretNames) {
|
|
|
8504
8840
|
|
|
8505
8841
|
- name: Build
|
|
8506
8842
|
run: bun run build${envBlock ? "\n env:\n" + envBlock : ""}`;
|
|
8507
|
-
if (providers
|
|
8843
|
+
if (usesFirebase(providers)) {
|
|
8508
8844
|
const fbConfig = providers.firebaseConfig;
|
|
8509
8845
|
if (fbConfig?.hasFunctions) {
|
|
8510
8846
|
steps += `
|
|
@@ -8527,7 +8863,7 @@ function generateDeployWorkflow(providers, appName, envSecretNames) {
|
|
|
8527
8863
|
GOOGLE_APPLICATION_CREDENTIALS_JSON: \${{ secrets.FIREBASE_SERVICE_ACCOUNT }}
|
|
8528
8864
|
working-directory: apps/${appName}`;
|
|
8529
8865
|
}
|
|
8530
|
-
if (fbConfig?.hasHosting && !providers
|
|
8866
|
+
if (fbConfig?.hasHosting && !usesVercel(providers)) {
|
|
8531
8867
|
steps += `
|
|
8532
8868
|
|
|
8533
8869
|
- name: Deploy to Firebase Hosting
|
|
@@ -8539,7 +8875,7 @@ function generateDeployWorkflow(providers, appName, envSecretNames) {
|
|
|
8539
8875
|
entryPoint: apps/${appName}`;
|
|
8540
8876
|
}
|
|
8541
8877
|
}
|
|
8542
|
-
if (providers
|
|
8878
|
+
if (usesVercel(providers)) {
|
|
8543
8879
|
steps += `
|
|
8544
8880
|
|
|
8545
8881
|
- name: Deploy to Vercel
|
|
@@ -8550,7 +8886,7 @@ function generateDeployWorkflow(providers, appName, envSecretNames) {
|
|
|
8550
8886
|
VERCEL_PROJECT_ID: \${{ secrets.VERCEL_PROJECT_ID }}
|
|
8551
8887
|
working-directory: apps/${appName}`;
|
|
8552
8888
|
}
|
|
8553
|
-
if (providers
|
|
8889
|
+
if (usesSupabase(providers) && providers.supabaseConfig?.hasFunctions) {
|
|
8554
8890
|
steps += `
|
|
8555
8891
|
|
|
8556
8892
|
- name: Setup Supabase CLI
|
|
@@ -8578,7 +8914,8 @@ jobs:
|
|
|
8578
8914
|
${steps}
|
|
8579
8915
|
`;
|
|
8580
8916
|
}
|
|
8581
|
-
function generateStagingWorkflow(providers,
|
|
8917
|
+
function generateStagingWorkflow(providers, envSecretNames) {
|
|
8918
|
+
const appName = providers.name;
|
|
8582
8919
|
const envBlock = envSecretNames.filter((n) => n.startsWith("VITE_") || n.startsWith("NEXT_PUBLIC_")).map((n) => ` ${n}: \${{ secrets.${n} }}`).join("\n");
|
|
8583
8920
|
let steps = ` - name: Checkout repository
|
|
8584
8921
|
uses: actions/checkout@v4
|
|
@@ -8605,7 +8942,7 @@ function generateStagingWorkflow(providers, appName, envSecretNames) {
|
|
|
8605
8942
|
|
|
8606
8943
|
- name: Build (staging)
|
|
8607
8944
|
run: bun run build -- --mode staging${envBlock ? "\n env:\n" + envBlock : ""}`;
|
|
8608
|
-
if (providers
|
|
8945
|
+
if (usesFirebase(providers)) {
|
|
8609
8946
|
const fbConfig = providers.firebaseConfig;
|
|
8610
8947
|
if (fbConfig?.hasFunctions) {
|
|
8611
8948
|
steps += `
|
|
@@ -8628,7 +8965,7 @@ function generateStagingWorkflow(providers, appName, envSecretNames) {
|
|
|
8628
8965
|
GOOGLE_APPLICATION_CREDENTIALS_JSON: \${{ secrets.FIREBASE_SERVICE_ACCOUNT_STAGING }}
|
|
8629
8966
|
working-directory: apps/${appName}`;
|
|
8630
8967
|
}
|
|
8631
|
-
if (fbConfig?.hasHosting && !providers
|
|
8968
|
+
if (fbConfig?.hasHosting && !usesVercel(providers)) {
|
|
8632
8969
|
steps += `
|
|
8633
8970
|
|
|
8634
8971
|
- name: Deploy to Firebase Hosting (staging)
|
|
@@ -8640,7 +8977,7 @@ function generateStagingWorkflow(providers, appName, envSecretNames) {
|
|
|
8640
8977
|
entryPoint: apps/${appName}`;
|
|
8641
8978
|
}
|
|
8642
8979
|
}
|
|
8643
|
-
if (providers
|
|
8980
|
+
if (usesVercel(providers)) {
|
|
8644
8981
|
steps += `
|
|
8645
8982
|
|
|
8646
8983
|
- name: Deploy to Vercel (staging)
|
|
@@ -8713,14 +9050,12 @@ async function main(options = {}) {
|
|
|
8713
9050
|
return 1;
|
|
8714
9051
|
}
|
|
8715
9052
|
const providers = detectProvider(appDir);
|
|
8716
|
-
const hasVercel = pathExists(joinPath(appDir, "vercel.json")) || pathExists(joinPath(appDir, ".vercel"));
|
|
8717
9053
|
const staging = detectStagingSupport(appDir);
|
|
8718
9054
|
const config = {
|
|
8719
9055
|
appName,
|
|
8720
9056
|
appDir,
|
|
8721
9057
|
projectRoot,
|
|
8722
9058
|
providers,
|
|
8723
|
-
hasVercel,
|
|
8724
9059
|
hasStaging: staging.hasStaging,
|
|
8725
9060
|
stagingProjectId: staging.stagingProjectId
|
|
8726
9061
|
};
|
|
@@ -8734,9 +9069,9 @@ async function main(options = {}) {
|
|
|
8734
9069
|
workflows.push("deploy-staging.yml (staging)");
|
|
8735
9070
|
}
|
|
8736
9071
|
const providerLabels = [];
|
|
8737
|
-
if (providers
|
|
8738
|
-
if (
|
|
8739
|
-
if (providers
|
|
9072
|
+
if (usesFirebase(providers)) providerLabels.push("Firebase");
|
|
9073
|
+
if (usesVercel(providers)) providerLabels.push("Vercel");
|
|
9074
|
+
if (usesSupabase(providers)) providerLabels.push("Supabase");
|
|
8740
9075
|
const planLines = [
|
|
8741
9076
|
`App: ${appName}`,
|
|
8742
9077
|
`Repo: ${repo}`,
|
|
@@ -8769,7 +9104,7 @@ These will be skipped. Add them to .dndev.secrets or .env and re-run.`
|
|
|
8769
9104
|
const uploadableSecrets = secrets.filter(
|
|
8770
9105
|
(sec) => sec.value !== "" && sec.source !== "MISSING" && !sec.value.startsWith("__SERVICE_ACCOUNT")
|
|
8771
9106
|
);
|
|
8772
|
-
if (uploadableSecrets.length > 0 || providers
|
|
9107
|
+
if (uploadableSecrets.length > 0 || usesFirebase(providers)) {
|
|
8773
9108
|
s.start("Uploading secrets to GitHub...");
|
|
8774
9109
|
let successCount = 0;
|
|
8775
9110
|
let failCount = 0;
|
|
@@ -8784,7 +9119,7 @@ These will be skipped. Add them to .dndev.secrets or .env and re-run.`
|
|
|
8784
9119
|
);
|
|
8785
9120
|
}
|
|
8786
9121
|
}
|
|
8787
|
-
if (providers
|
|
9122
|
+
if (usesFirebase(providers)) {
|
|
8788
9123
|
try {
|
|
8789
9124
|
uploadServiceAccountToGitHub(appDir, repo, dryRun, false);
|
|
8790
9125
|
successCount++;
|
|
@@ -8806,26 +9141,11 @@ These will be skipped. Add them to .dndev.secrets or .env and re-run.`
|
|
|
8806
9141
|
}
|
|
8807
9142
|
const workflowDir = joinPath(projectRoot, ".github", "workflows");
|
|
8808
9143
|
const secretNames = secrets.map((s2) => s2.name);
|
|
8809
|
-
const workflowProviders = {
|
|
8810
|
-
hasFirebase: providers.hasFirebase,
|
|
8811
|
-
hasVercel,
|
|
8812
|
-
hasSupabase: providers.hasSupabase,
|
|
8813
|
-
firebaseConfig: providers.firebaseConfig,
|
|
8814
|
-
supabaseConfig: providers.supabaseConfig
|
|
8815
|
-
};
|
|
8816
9144
|
const ciYaml = generateCIWorkflow(appName);
|
|
8817
|
-
const deployYaml = generateDeployWorkflow(
|
|
8818
|
-
workflowProviders,
|
|
8819
|
-
appName,
|
|
8820
|
-
secretNames
|
|
8821
|
-
);
|
|
9145
|
+
const deployYaml = generateDeployWorkflow(providers, secretNames);
|
|
8822
9146
|
let stagingYaml;
|
|
8823
9147
|
if (config.hasStaging) {
|
|
8824
|
-
stagingYaml = generateStagingWorkflow(
|
|
8825
|
-
workflowProviders,
|
|
8826
|
-
appName,
|
|
8827
|
-
secretNames
|
|
8828
|
-
);
|
|
9148
|
+
stagingYaml = generateStagingWorkflow(providers, secretNames);
|
|
8829
9149
|
}
|
|
8830
9150
|
if (dryRun) {
|
|
8831
9151
|
log.info("\n--- ci.yml ---");
|