@donotdev/cli 0.0.13 → 0.0.15
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 +357 -89
- package/dist/bin/commands/agent-setup.d.ts +6 -0
- package/dist/bin/commands/agent-setup.d.ts.map +1 -0
- package/dist/bin/commands/agent-setup.js +629 -0
- package/dist/bin/commands/agent-setup.js.map +1 -0
- package/dist/bin/commands/build.js +131 -50
- package/dist/bin/commands/bump.js +137 -49
- package/dist/bin/commands/cacheout.js +50 -21
- package/dist/bin/commands/create-app.js +270 -261
- package/dist/bin/commands/create-project.js +418 -197
- package/dist/bin/commands/deploy.js +1752 -712
- package/dist/bin/commands/dev.js +151 -35
- package/dist/bin/commands/emu.js +228 -70
- package/dist/bin/commands/format.js +50 -21
- package/dist/bin/commands/lint.js +50 -21
- package/dist/bin/commands/preview.js +155 -35
- package/dist/bin/commands/supabase-setup.d.ts +6 -0
- package/dist/bin/commands/supabase-setup.d.ts.map +1 -0
- package/dist/bin/commands/supabase-setup.js +7 -0
- package/dist/bin/commands/supabase-setup.js.map +1 -0
- package/dist/bin/commands/sync-secrets.js +224 -46
- package/dist/bin/commands/type-check.d.ts +14 -0
- package/dist/bin/commands/type-check.d.ts.map +1 -0
- package/dist/bin/commands/type-check.js +314 -0
- package/dist/bin/commands/type-check.js.map +1 -0
- package/dist/bin/commands/wai.js +7399 -11
- package/dist/bin/dndev.js +27 -2
- package/dist/bin/donotdev.js +27 -2
- package/dist/index.js +3960 -2996
- package/package.json +2 -2
- package/templates/app-demo/src/App.tsx.example +1 -0
- package/templates/app-demo/src/pages/FullPage.tsx.example +2 -2
- package/templates/app-demo/src/pages/components/DemoLayout.tsx.example +2 -2
- package/templates/app-demo/src/themes.css.example +5 -12
- package/templates/app-expo/.env.example +64 -0
- package/templates/app-expo/.expo/README.md.example +5 -0
- package/templates/app-expo/.gitignore.example +36 -0
- package/templates/app-expo/README.md.example +58 -0
- package/templates/app-expo/app/.gitkeep +2 -0
- package/templates/app-expo/app/_layout.tsx.example +41 -0
- package/templates/app-expo/app/form.tsx.example +52 -0
- package/templates/app-expo/app/index.tsx.example +89 -0
- package/templates/app-expo/app/list.tsx.example +32 -0
- package/templates/app-expo/app/profile.tsx.example +76 -0
- package/templates/app-expo/app/signin.tsx.example +53 -0
- package/templates/app-expo/app.json.example +39 -0
- package/templates/app-expo/babel.config.js.example +10 -0
- package/templates/app-expo/eas.json.example +20 -0
- package/templates/app-expo/expo-env.d.ts.example +4 -0
- package/templates/app-expo/metro.config.js.example +20 -0
- package/templates/app-expo/service-account-key.json.example +12 -0
- package/templates/app-expo/tsconfig.json.example +19 -0
- package/templates/app-next/.env.example +4 -33
- package/templates/app-next/src/app/ClientLayout.tsx.example +2 -0
- package/templates/app-next/src/app/layout.tsx.example +7 -6
- package/templates/app-next/src/globals.css.example +2 -11
- package/templates/app-next/src/pages/HomePage.tsx.example +1 -1
- package/templates/app-next/src/themes.css.example +10 -13
- package/templates/app-vite/.env.example +3 -32
- package/templates/app-vite/index.html.example +2 -24
- package/templates/app-vite/src/App.tsx.example +2 -0
- package/templates/app-vite/src/globals.css.example +2 -12
- package/templates/app-vite/src/pages/FormPageExample.tsx.example +1 -2
- package/templates/app-vite/src/pages/HomePage.tsx.example +1 -1
- package/templates/app-vite/src/themes.css.example +109 -79
- package/templates/app-vite/vercel.json.example +11 -0
- package/templates/functions-firebase/build.mjs.example +2 -72
- package/templates/functions-firebase/functions-firebase/.env.example.example +23 -25
- package/templates/functions-firebase/functions-firebase/build.mjs.example +2 -72
- package/templates/functions-firebase/functions-firebase/tsconfig.json.example +1 -1
- package/templates/functions-supabase/supabase/functions/cancel-subscription/index.ts.example +7 -0
- package/templates/functions-supabase/supabase/functions/change-plan/index.ts.example +11 -0
- package/templates/functions-supabase/supabase/functions/create-checkout-session/index.ts.example +11 -0
- package/templates/functions-supabase/supabase/functions/create-customer-portal/index.ts.example +7 -0
- package/templates/functions-supabase/supabase/functions/crud/index.ts.example +16 -0
- package/templates/functions-supabase/supabase/functions/delete-account/index.ts.example +7 -0
- package/templates/functions-supabase/supabase/functions/get-custom-claims/index.ts.example +7 -0
- package/templates/functions-supabase/supabase/functions/get-user-auth-status/index.ts.example +7 -0
- package/templates/functions-supabase/supabase/functions/refresh-subscription-status/index.ts.example +7 -0
- package/templates/functions-supabase/supabase/functions/remove-custom-claims/index.ts.example +7 -0
- package/templates/functions-supabase/supabase/functions/set-custom-claims/index.ts.example +7 -0
- package/templates/functions-supabase/supabase/migrations/20250101000000_idempotency.sql +24 -0
- package/templates/functions-supabase/supabase/migrations/20250101000001_rate_limits.sql +22 -0
- package/templates/functions-supabase/supabase/migrations/20250101000002_cleanup_jobs.sql +28 -0
- package/templates/functions-supabase/supabase/migrations/20250101000003_operation_metrics.sql +28 -0
- package/templates/functions-vercel/functions-vercel/tsconfig.json.example +1 -1
- package/templates/functions-vercel/functions-vercel/vercel.json.example +1 -1
- package/templates/functions-vercel/vercel.json.example +1 -1
- package/templates/github/github/workflows/firebase-deploy.yml.example +1 -1
- package/templates/github/workflows/firebase-deploy.yml.example +1 -1
- package/templates/overlay-firebase/env.fragment.example +34 -0
- package/templates/overlay-firebase/env.fragment.expo.example +34 -0
- package/templates/overlay-firebase/env.fragment.nextjs.example +34 -0
- package/templates/overlay-firebase/src/config/providers.expo.ts.example +49 -0
- package/templates/overlay-firebase/src/config/providers.ts.example +23 -0
- package/templates/overlay-supabase/env.fragment.example +7 -0
- package/templates/overlay-supabase/env.fragment.expo.example +7 -0
- package/templates/overlay-supabase/env.fragment.nextjs.example +7 -0
- package/templates/overlay-supabase/src/config/providers.expo.ts.example +35 -0
- package/templates/overlay-supabase/src/config/providers.ts.example +33 -0
- package/templates/overlay-supabase/vercel.headers.example +23 -0
- package/templates/overlay-supabase/vercel.json.example +22 -0
- package/templates/overlay-vercel/env.fragment.example +34 -0
- package/templates/overlay-vercel/env.fragment.nextjs.example +34 -0
- package/templates/overlay-vercel/src/config/providers.ts.example +24 -0
- package/templates/root-consumer/.claude/agents/architect.md.example +2 -310
- package/templates/root-consumer/.claude/agents/builder.md.example +2 -326
- package/templates/root-consumer/.claude/agents/coder.md.example +2 -83
- package/templates/root-consumer/.claude/agents/extractor.md.example +2 -231
- package/templates/root-consumer/.claude/agents/polisher.md.example +2 -132
- package/templates/root-consumer/.claude/agents/prompt-engineer.md.example +2 -81
- package/templates/root-consumer/.claude/commands/brainstorm.md.example +1 -1
- package/templates/root-consumer/.claude/commands/build.md.example +1 -1
- package/templates/root-consumer/.claude/commands/design.md.example +1 -1
- package/templates/root-consumer/.claude/commands/grill.md.example +30 -0
- package/templates/root-consumer/.claude/commands/polish.md.example +1 -1
- package/templates/root-consumer/.claude/commands/techdebt.md.example +28 -0
- package/templates/root-consumer/.clinerules.example +1 -0
- package/templates/root-consumer/.cursor/rules/no-docs.mdc.example +15 -0
- package/templates/root-consumer/.cursorrules.example +1 -0
- package/templates/root-consumer/.dndev/args.json.example +6 -0
- package/templates/root-consumer/.gemini/settings.json.example +2 -2
- package/templates/root-consumer/.github/copilot-instructions.md.example +1 -0
- package/templates/root-consumer/.windsurfrules.example +1 -0
- package/templates/root-consumer/AI.md.example +25 -108
- package/templates/root-consumer/CLAUDE.md.example +1 -128
- package/templates/root-consumer/CONVENTIONS.md.example +1 -0
- package/templates/root-consumer/GEMINI.md.example +1 -0
- package/templates/root-consumer/firebase.json.example +1 -1
- package/templates/root-consumer/guides/dndev/AGENT_START_HERE.md.example +54 -0
- package/templates/root-consumer/guides/dndev/COMPONENTS_ADV.md.example +0 -18
- package/templates/root-consumer/guides/dndev/COMPONENTS_UI.md.example +1 -1
- package/templates/root-consumer/guides/dndev/ENV_SETUP.md.example +99 -30
- package/templates/root-consumer/guides/dndev/GOTCHAS.md.example +186 -0
- package/templates/root-consumer/guides/dndev/INDEX.md.example +4 -1
- package/templates/root-consumer/guides/dndev/SETUP_CRUD.md.example +143 -12
- package/templates/root-consumer/guides/dndev/SETUP_FIREBASE.md.example +9 -3
- package/templates/root-consumer/guides/dndev/SETUP_FUNCTIONS.md.example +12 -7
- package/templates/root-consumer/guides/dndev/SETUP_SOC2.md.example +234 -0
- package/templates/root-consumer/guides/dndev/SETUP_SUPABASE.md.example +124 -0
- package/templates/root-consumer/guides/dndev/SETUP_THEMES.md.example +6 -2
- package/templates/root-consumer/guides/dndev/SETUP_VERCEL.md.example +176 -0
- package/templates/root-consumer/guides/dndev/USE_ROUTING.md.example +5 -9
- package/templates/root-consumer/guides/dndev/essences_reference.css.example +174 -0
- package/templates/root-consumer/guides/wai-way/agents/builder.md.example +10 -0
- package/templates/root-consumer/guides/wai-way/agents/extractor.md.example +25 -5
- package/templates/root-consumer/guides/wai-way/agents/polisher.md.example +13 -2
- package/templates/root-consumer/guides/wai-way/blueprints/0_brainstorm.md.example +2 -2
- package/templates/root-consumer/guides/wai-way/blueprints/1_scaffold.md.example +47 -11
- package/templates/root-consumer/guides/wai-way/blueprints/3_compose.md.example +15 -4
- package/templates/root-consumer/guides/wai-way/spec_template.md.example +7 -6
- package/templates/app-payload/.env.example +0 -28
- package/templates/app-payload/README.md.example +0 -233
- package/templates/app-payload/collections/Company.ts.example +0 -125
- package/templates/app-payload/collections/Hero.ts.example +0 -62
- package/templates/app-payload/collections/Media.ts.example +0 -41
- package/templates/app-payload/collections/Products.ts.example +0 -115
- package/templates/app-payload/collections/Services.ts.example +0 -104
- package/templates/app-payload/collections/Testimonials.ts.example +0 -92
- package/templates/app-payload/collections/Users.ts.example +0 -35
- package/templates/app-payload/src/server.ts.example +0 -79
- package/templates/app-payload/tsconfig.json.example +0 -24
|
@@ -1915,7 +1915,7 @@ var require_parse = __commonJS({
|
|
|
1915
1915
|
CHAR_NO_BREAK_SPACE,
|
|
1916
1916
|
CHAR_ZERO_WIDTH_NOBREAK_SPACE
|
|
1917
1917
|
} = require_constants();
|
|
1918
|
-
var
|
|
1918
|
+
var parse2 = (input, options = {}) => {
|
|
1919
1919
|
if (typeof input !== "string") {
|
|
1920
1920
|
throw new TypeError("Expected a string");
|
|
1921
1921
|
}
|
|
@@ -2115,7 +2115,7 @@ var require_parse = __commonJS({
|
|
|
2115
2115
|
push({ type: "eos" });
|
|
2116
2116
|
return ast;
|
|
2117
2117
|
};
|
|
2118
|
-
module.exports =
|
|
2118
|
+
module.exports = parse2;
|
|
2119
2119
|
}
|
|
2120
2120
|
});
|
|
2121
2121
|
|
|
@@ -2127,7 +2127,7 @@ var require_braces = __commonJS({
|
|
|
2127
2127
|
var stringify2 = require_stringify();
|
|
2128
2128
|
var compile = require_compile();
|
|
2129
2129
|
var expand = require_expand();
|
|
2130
|
-
var
|
|
2130
|
+
var parse2 = require_parse();
|
|
2131
2131
|
var braces = (input, options = {}) => {
|
|
2132
2132
|
let output = [];
|
|
2133
2133
|
if (Array.isArray(input)) {
|
|
@@ -2147,7 +2147,7 @@ var require_braces = __commonJS({
|
|
|
2147
2147
|
}
|
|
2148
2148
|
return output;
|
|
2149
2149
|
};
|
|
2150
|
-
braces.parse = (input, options = {}) =>
|
|
2150
|
+
braces.parse = (input, options = {}) => parse2(input, options);
|
|
2151
2151
|
braces.stringify = (input, options = {}) => {
|
|
2152
2152
|
if (typeof input === "string") {
|
|
2153
2153
|
return stringify2(braces.parse(input, options), options);
|
|
@@ -2804,7 +2804,7 @@ var require_parse2 = __commonJS({
|
|
|
2804
2804
|
var syntaxError = (type, char) => {
|
|
2805
2805
|
return `Missing ${type}: "${char}" - use "\\\\${char}" to match literal characters`;
|
|
2806
2806
|
};
|
|
2807
|
-
var
|
|
2807
|
+
var parse2 = (input, options) => {
|
|
2808
2808
|
if (typeof input !== "string") {
|
|
2809
2809
|
throw new TypeError("Expected a string");
|
|
2810
2810
|
}
|
|
@@ -2953,7 +2953,7 @@ var require_parse2 = __commonJS({
|
|
|
2953
2953
|
output = token.close = `)$))${extglobStar}`;
|
|
2954
2954
|
}
|
|
2955
2955
|
if (token.inner.includes("*") && (rest = remaining()) && /^\.[^\\/.]+$/.test(rest)) {
|
|
2956
|
-
const expression =
|
|
2956
|
+
const expression = parse2(rest, { ...options, fastpaths: false }).output;
|
|
2957
2957
|
output = token.close = `)${expression})${extglobStar})`;
|
|
2958
2958
|
}
|
|
2959
2959
|
if (token.prev.type === "bos") {
|
|
@@ -3478,7 +3478,7 @@ var require_parse2 = __commonJS({
|
|
|
3478
3478
|
}
|
|
3479
3479
|
return state;
|
|
3480
3480
|
};
|
|
3481
|
-
|
|
3481
|
+
parse2.fastpaths = (input, options) => {
|
|
3482
3482
|
const opts = { ...options };
|
|
3483
3483
|
const max = typeof opts.maxLength === "number" ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
|
|
3484
3484
|
const len = input.length;
|
|
@@ -3544,7 +3544,7 @@ var require_parse2 = __commonJS({
|
|
|
3544
3544
|
}
|
|
3545
3545
|
return source;
|
|
3546
3546
|
};
|
|
3547
|
-
module.exports =
|
|
3547
|
+
module.exports = parse2;
|
|
3548
3548
|
}
|
|
3549
3549
|
});
|
|
3550
3550
|
|
|
@@ -3555,7 +3555,7 @@ var require_picomatch = __commonJS({
|
|
|
3555
3555
|
init_utils();
|
|
3556
3556
|
var path = __require("path");
|
|
3557
3557
|
var scan = require_scan();
|
|
3558
|
-
var
|
|
3558
|
+
var parse2 = require_parse2();
|
|
3559
3559
|
var utils = require_utils2();
|
|
3560
3560
|
var constants2 = require_constants2();
|
|
3561
3561
|
var isObject = (val) => val && typeof val === "object" && !Array.isArray(val);
|
|
@@ -3643,7 +3643,7 @@ var require_picomatch = __commonJS({
|
|
|
3643
3643
|
picomatch.isMatch = (str, patterns, options) => picomatch(patterns, options)(str);
|
|
3644
3644
|
picomatch.parse = (pattern, options) => {
|
|
3645
3645
|
if (Array.isArray(pattern)) return pattern.map((p2) => picomatch.parse(p2, options));
|
|
3646
|
-
return
|
|
3646
|
+
return parse2(pattern, { ...options, fastpaths: false });
|
|
3647
3647
|
};
|
|
3648
3648
|
picomatch.scan = (input, options) => scan(input, options);
|
|
3649
3649
|
picomatch.compileRe = (state, options, returnOutput = false, returnState = false) => {
|
|
@@ -3669,10 +3669,10 @@ var require_picomatch = __commonJS({
|
|
|
3669
3669
|
}
|
|
3670
3670
|
let parsed = { negated: false, fastpaths: true };
|
|
3671
3671
|
if (options.fastpaths !== false && (input[0] === "." || input[0] === "*")) {
|
|
3672
|
-
parsed.output =
|
|
3672
|
+
parsed.output = parse2.fastpaths(input, options);
|
|
3673
3673
|
}
|
|
3674
3674
|
if (!parsed.output) {
|
|
3675
|
-
parsed =
|
|
3675
|
+
parsed = parse2(input, options);
|
|
3676
3676
|
}
|
|
3677
3677
|
return picomatch.compileRe(parsed, options, returnOutput, returnState);
|
|
3678
3678
|
};
|
|
@@ -7534,11 +7534,39 @@ var init_PathResolver = __esm({
|
|
|
7534
7534
|
});
|
|
7535
7535
|
|
|
7536
7536
|
// packages/tooling/src/utils/errors.ts
|
|
7537
|
-
var DoNotDevError;
|
|
7537
|
+
var DO_NOT_DEV_ERROR_CODES, DoNotDevError;
|
|
7538
7538
|
var init_errors = __esm({
|
|
7539
7539
|
"packages/tooling/src/utils/errors.ts"() {
|
|
7540
7540
|
"use strict";
|
|
7541
7541
|
init_utils();
|
|
7542
|
+
DO_NOT_DEV_ERROR_CODES = {
|
|
7543
|
+
CONFIGURATION_ERROR: "configuration-error",
|
|
7544
|
+
CONFIG_NOT_FOUND: "config-not-found",
|
|
7545
|
+
CONFIG_INVALID: "config-invalid",
|
|
7546
|
+
PATH_RESOLUTION_ERROR: "path-resolution-error",
|
|
7547
|
+
FILE_OPERATION_ERROR: "file-operation-error",
|
|
7548
|
+
FILE_NOT_FOUND: "file-not-found",
|
|
7549
|
+
PERMISSION_DENIED: "permission-denied",
|
|
7550
|
+
GENERATION_ERROR: "generation-error",
|
|
7551
|
+
TEMPLATE_ERROR: "template-error",
|
|
7552
|
+
TEMPLATE_NOT_FOUND: "template-not-found",
|
|
7553
|
+
CLI_EXECUTION_ERROR: "cli-execution-error",
|
|
7554
|
+
COMMAND_NOT_FOUND: "command-not-found",
|
|
7555
|
+
COMMAND_FAILED: "command-failed",
|
|
7556
|
+
VALIDATION_ERROR: "validation-error",
|
|
7557
|
+
SCHEMA_ERROR: "schema-error",
|
|
7558
|
+
DEPENDENCY_ERROR: "dependency-error",
|
|
7559
|
+
DEPENDENCY_NOT_FOUND: "dependency-not-found",
|
|
7560
|
+
DEPENDENCY_VERSION_ERROR: "dependency-version-error",
|
|
7561
|
+
INVALID_ARGUMENT: "invalid-argument",
|
|
7562
|
+
MISSING_ARGUMENT: "missing-argument",
|
|
7563
|
+
MISSING_PROJECT_ID: "missing-project-id",
|
|
7564
|
+
FIREBASE_CLI_ERROR: "firebase-cli-error",
|
|
7565
|
+
DEPLOYMENT_FAILED: "deployment-failed",
|
|
7566
|
+
OPERATION_CANCELLED: "operation-cancelled",
|
|
7567
|
+
TIMEOUT_ERROR: "timeout-error",
|
|
7568
|
+
UNKNOWN_ERROR: "unknown-error"
|
|
7569
|
+
};
|
|
7542
7570
|
DoNotDevError = class _DoNotDevError extends Error {
|
|
7543
7571
|
/** The error code categorizing this error */
|
|
7544
7572
|
code;
|
|
@@ -7558,7 +7586,7 @@ var init_errors = __esm({
|
|
|
7558
7586
|
* @param {Record<string, any>} [options.context] - Additional context data
|
|
7559
7587
|
* @param {boolean} [options.displayable=true] - Whether this error should be displayed to the user
|
|
7560
7588
|
*/
|
|
7561
|
-
constructor(message, code =
|
|
7589
|
+
constructor(message, code = DO_NOT_DEV_ERROR_CODES.UNKNOWN_ERROR, options) {
|
|
7562
7590
|
super(message);
|
|
7563
7591
|
this.name = "DoNotDevError";
|
|
7564
7592
|
this.code = code;
|
|
@@ -7589,7 +7617,7 @@ var init_errors = __esm({
|
|
|
7589
7617
|
* @param {boolean} [options.displayable=true] - Whether this error should be displayed to the user
|
|
7590
7618
|
* @returns {DoNotDevError} New DoNotDev error wrapping the original
|
|
7591
7619
|
*/
|
|
7592
|
-
static from(error2, context, code =
|
|
7620
|
+
static from(error2, context, code = DO_NOT_DEV_ERROR_CODES.UNKNOWN_ERROR, options) {
|
|
7593
7621
|
if (!(error2 instanceof Error)) {
|
|
7594
7622
|
return new _DoNotDevError(
|
|
7595
7623
|
`Unknown error: ${String(error2)}`,
|
|
@@ -7626,21 +7654,21 @@ var init_errors = __esm({
|
|
|
7626
7654
|
}
|
|
7627
7655
|
const message = error2.message.toLowerCase();
|
|
7628
7656
|
if (error2.name === "ValidationError" || message.includes("validation")) {
|
|
7629
|
-
return
|
|
7657
|
+
return DO_NOT_DEV_ERROR_CODES.VALIDATION_ERROR;
|
|
7630
7658
|
}
|
|
7631
7659
|
if (message.includes("not found") || message.includes("no such file")) {
|
|
7632
|
-
return
|
|
7660
|
+
return DO_NOT_DEV_ERROR_CODES.FILE_NOT_FOUND;
|
|
7633
7661
|
}
|
|
7634
7662
|
if (message.includes("permission") || message.includes("access denied")) {
|
|
7635
|
-
return
|
|
7663
|
+
return DO_NOT_DEV_ERROR_CODES.PERMISSION_DENIED;
|
|
7636
7664
|
}
|
|
7637
7665
|
if (message.includes("timeout") || message.includes("timed out")) {
|
|
7638
|
-
return
|
|
7666
|
+
return DO_NOT_DEV_ERROR_CODES.TIMEOUT_ERROR;
|
|
7639
7667
|
}
|
|
7640
7668
|
if (message.includes("dependency") || message.includes("module not found")) {
|
|
7641
|
-
return
|
|
7669
|
+
return DO_NOT_DEV_ERROR_CODES.DEPENDENCY_ERROR;
|
|
7642
7670
|
}
|
|
7643
|
-
return
|
|
7671
|
+
return DO_NOT_DEV_ERROR_CODES.UNKNOWN_ERROR;
|
|
7644
7672
|
}
|
|
7645
7673
|
};
|
|
7646
7674
|
}
|
|
@@ -7655,6 +7683,7 @@ import {
|
|
|
7655
7683
|
extname as extname2,
|
|
7656
7684
|
relative as relative2,
|
|
7657
7685
|
resolve as resolve2,
|
|
7686
|
+
parse,
|
|
7658
7687
|
isAbsolute as pathIsAbsolute
|
|
7659
7688
|
} from "node:path";
|
|
7660
7689
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
@@ -7716,18 +7745,7 @@ var init_utils = __esm({
|
|
|
7716
7745
|
}
|
|
7717
7746
|
});
|
|
7718
7747
|
|
|
7719
|
-
// packages/cli/src/bin/commands/sync-secrets.ts
|
|
7720
|
-
init_utils();
|
|
7721
|
-
|
|
7722
|
-
// packages/tooling/src/index.ts
|
|
7723
|
-
init_utils();
|
|
7724
|
-
|
|
7725
|
-
// packages/tooling/src/cli/index.ts
|
|
7726
|
-
init_utils();
|
|
7727
|
-
|
|
7728
7748
|
// packages/tooling/src/utils/cli-input.ts
|
|
7729
|
-
init_utils();
|
|
7730
|
-
init_dist2();
|
|
7731
7749
|
async function askForSelection(message, choices, defaultValue = 0) {
|
|
7732
7750
|
const options = choices.map((choice) => ({
|
|
7733
7751
|
value: choice.value,
|
|
@@ -7745,13 +7763,16 @@ async function askForSelection(message, choices, defaultValue = 0) {
|
|
|
7745
7763
|
}
|
|
7746
7764
|
return result;
|
|
7747
7765
|
}
|
|
7766
|
+
var init_cli_input = __esm({
|
|
7767
|
+
"packages/tooling/src/utils/cli-input.ts"() {
|
|
7768
|
+
"use strict";
|
|
7769
|
+
init_utils();
|
|
7770
|
+
init_dist2();
|
|
7771
|
+
}
|
|
7772
|
+
});
|
|
7748
7773
|
|
|
7749
7774
|
// packages/tooling/src/apps/sync-secrets.ts
|
|
7750
|
-
init_utils();
|
|
7751
7775
|
import { spawnSync } from "node:child_process";
|
|
7752
|
-
init_cli_output();
|
|
7753
|
-
init_errors();
|
|
7754
|
-
init_pathResolver();
|
|
7755
7776
|
function parseEnvFile(filePath) {
|
|
7756
7777
|
if (!pathExists(filePath)) {
|
|
7757
7778
|
throw new DoNotDevError(
|
|
@@ -7760,7 +7781,8 @@ function parseEnvFile(filePath) {
|
|
|
7760
7781
|
{ context: { filePath } }
|
|
7761
7782
|
);
|
|
7762
7783
|
}
|
|
7763
|
-
const
|
|
7784
|
+
const contentRaw = readSync(filePath, { format: "text" });
|
|
7785
|
+
const content = typeof contentRaw === "string" ? contentRaw : null;
|
|
7764
7786
|
if (!content) {
|
|
7765
7787
|
throw new Error(`Failed to read secrets file: ${filePath}`);
|
|
7766
7788
|
}
|
|
@@ -7835,7 +7857,8 @@ function detectFirebaseProjectId(cwd) {
|
|
|
7835
7857
|
const firebasercPath = joinPath(searchDir, ".firebaserc");
|
|
7836
7858
|
if (pathExists(firebasercPath)) {
|
|
7837
7859
|
try {
|
|
7838
|
-
const
|
|
7860
|
+
const firebasercRaw = readSync(firebasercPath, { format: "json" });
|
|
7861
|
+
const firebaserc = firebasercRaw && typeof firebasercRaw === "object" ? firebasercRaw : null;
|
|
7839
7862
|
if (firebaserc && firebaserc.projects?.default) {
|
|
7840
7863
|
return firebaserc.projects.default;
|
|
7841
7864
|
}
|
|
@@ -7848,7 +7871,8 @@ function detectFirebaseProjectId(cwd) {
|
|
|
7848
7871
|
const firebasercPath2 = joinPath(current, ".firebaserc");
|
|
7849
7872
|
if (pathExists(firebasercPath2)) {
|
|
7850
7873
|
try {
|
|
7851
|
-
const
|
|
7874
|
+
const firebasercRaw = readSync(firebasercPath2, { format: "json" });
|
|
7875
|
+
const firebaserc = firebasercRaw && typeof firebasercRaw === "object" ? firebasercRaw : null;
|
|
7852
7876
|
if (firebaserc && firebaserc.projects?.default) {
|
|
7853
7877
|
return firebaserc.projects.default;
|
|
7854
7878
|
}
|
|
@@ -8064,12 +8088,99 @@ function setVercelSecret(key, value, projectId, dryRun = false) {
|
|
|
8064
8088
|
);
|
|
8065
8089
|
}
|
|
8066
8090
|
}
|
|
8091
|
+
function detectGitHubRepo() {
|
|
8092
|
+
try {
|
|
8093
|
+
const result = spawnSync("git", ["remote", "get-url", "origin"], {
|
|
8094
|
+
encoding: "utf8",
|
|
8095
|
+
stdio: ["pipe", "pipe", "pipe"]
|
|
8096
|
+
});
|
|
8097
|
+
if (result.status !== 0 || !result.stdout) return void 0;
|
|
8098
|
+
const url = result.stdout.trim();
|
|
8099
|
+
const sshMatch = url.match(/github\.com[:/]([^/]+\/[^/.]+)/);
|
|
8100
|
+
if (sshMatch) return sshMatch[1];
|
|
8101
|
+
const httpsMatch = url.match(/github\.com\/([^/]+\/[^/.]+)/);
|
|
8102
|
+
if (httpsMatch) return httpsMatch[1];
|
|
8103
|
+
return void 0;
|
|
8104
|
+
} catch {
|
|
8105
|
+
return void 0;
|
|
8106
|
+
}
|
|
8107
|
+
}
|
|
8108
|
+
function setGitHubSecret(key, value, repo, dryRun = false) {
|
|
8109
|
+
if (dryRun) {
|
|
8110
|
+
log.info(
|
|
8111
|
+
`[DRY RUN] Would set GitHub secret: ${key}${repo ? ` (repo: ${repo})` : ""}`
|
|
8112
|
+
);
|
|
8113
|
+
return;
|
|
8114
|
+
}
|
|
8115
|
+
try {
|
|
8116
|
+
log.info(`Setting GitHub secret: ${key}${repo ? ` (repo: ${repo})` : ""}`);
|
|
8117
|
+
const args = ["secret", "set", key];
|
|
8118
|
+
if (repo) {
|
|
8119
|
+
args.push("--repo", repo);
|
|
8120
|
+
}
|
|
8121
|
+
const result = spawnSync("gh", args, {
|
|
8122
|
+
input: value,
|
|
8123
|
+
encoding: "utf8",
|
|
8124
|
+
stdio: ["pipe", "pipe", "pipe"]
|
|
8125
|
+
});
|
|
8126
|
+
if (result.error) {
|
|
8127
|
+
throw result.error;
|
|
8128
|
+
}
|
|
8129
|
+
if (result.status !== 0) {
|
|
8130
|
+
const stderr = result.stderr?.toString() || "";
|
|
8131
|
+
const stdout = result.stdout?.toString() || "";
|
|
8132
|
+
const errorOutput = stderr || stdout;
|
|
8133
|
+
if (errorOutput.includes("not logged in") || errorOutput.includes("authentication")) {
|
|
8134
|
+
throw new DoNotDevError(
|
|
8135
|
+
`GitHub CLI authentication required. Run 'gh auth login' to authenticate.`,
|
|
8136
|
+
"permission-denied",
|
|
8137
|
+
{ context: { key, error: errorOutput } }
|
|
8138
|
+
);
|
|
8139
|
+
}
|
|
8140
|
+
throw new Error(
|
|
8141
|
+
`gh CLI exited with code ${result.status}
|
|
8142
|
+
${errorOutput}`
|
|
8143
|
+
);
|
|
8144
|
+
}
|
|
8145
|
+
log.success(`GitHub secret ${key} set successfully`);
|
|
8146
|
+
} catch (err) {
|
|
8147
|
+
if (err instanceof DoNotDevError) throw err;
|
|
8148
|
+
log.error(`Failed to set GitHub secret ${key}:`, err);
|
|
8149
|
+
throw new DoNotDevError(
|
|
8150
|
+
`Failed to set GitHub secret ${key}`,
|
|
8151
|
+
"command-failed",
|
|
8152
|
+
{
|
|
8153
|
+
context: {
|
|
8154
|
+
target: "github",
|
|
8155
|
+
key,
|
|
8156
|
+
error: err instanceof Error ? err.message : String(err)
|
|
8157
|
+
}
|
|
8158
|
+
}
|
|
8159
|
+
);
|
|
8160
|
+
}
|
|
8161
|
+
}
|
|
8162
|
+
function uploadServiceAccountToGitHub(appDir, repo, dryRun = false, staging = false) {
|
|
8163
|
+
const fileName = staging ? "service-account-key.staging.json" : "service-account-key.json";
|
|
8164
|
+
const secretName = staging ? "FIREBASE_SERVICE_ACCOUNT_STAGING" : "FIREBASE_SERVICE_ACCOUNT";
|
|
8165
|
+
const filePath = joinPath(appDir, fileName);
|
|
8166
|
+
if (!pathExists(filePath)) {
|
|
8167
|
+
log.debug(`No ${fileName} found in ${appDir}, skipping GitHub upload`);
|
|
8168
|
+
return;
|
|
8169
|
+
}
|
|
8170
|
+
const contentRaw = readSync(filePath, { format: "text" });
|
|
8171
|
+
const content = typeof contentRaw === "string" ? contentRaw : null;
|
|
8172
|
+
if (!content) return;
|
|
8173
|
+
const encoded = Buffer2.from(content).toString("base64");
|
|
8174
|
+
setGitHubSecret(secretName, encoded, repo, dryRun);
|
|
8175
|
+
}
|
|
8067
8176
|
async function main(options = {}) {
|
|
8068
8177
|
const config = {
|
|
8069
8178
|
envFile: options.envFile || ".env",
|
|
8070
8179
|
platform: options.platform,
|
|
8071
8180
|
projectId: options.projectId,
|
|
8072
8181
|
vercelProjectId: options.vercelProjectId,
|
|
8182
|
+
target: options.target || "runtime",
|
|
8183
|
+
repo: options.repo,
|
|
8073
8184
|
dryRun: options.dryRun ?? false,
|
|
8074
8185
|
verbose: options.verbose ?? false
|
|
8075
8186
|
};
|
|
@@ -8081,20 +8192,22 @@ Usage: bun run sync-secrets [options]
|
|
|
8081
8192
|
|
|
8082
8193
|
Options:
|
|
8083
8194
|
--env-file <path> Path to .env file (default: .env)
|
|
8084
|
-
--
|
|
8195
|
+
--target <target> Sync target: 'runtime' (default) or 'github'
|
|
8196
|
+
--platform <platform> Platform to sync to: 'firebase' or 'vercel' (runtime target only, auto-detected)
|
|
8085
8197
|
--project <id> Firebase project ID (for Firebase platform)
|
|
8086
8198
|
--vercel-project <id> Vercel project ID (for Vercel platform)
|
|
8199
|
+
--repo <owner/repo> GitHub repository (github target only, auto-detected from git remote)
|
|
8087
8200
|
--dry-run, --dry Show what would be done without actually setting secrets
|
|
8088
8201
|
--verbose Show detailed output
|
|
8089
8202
|
--help Show this help message
|
|
8090
8203
|
|
|
8091
8204
|
Examples:
|
|
8092
|
-
|
|
8093
|
-
|
|
8094
|
-
|
|
8095
|
-
|
|
8096
|
-
|
|
8097
|
-
|
|
8205
|
+
dndev sync-secrets # sync to Firebase/Vercel runtime
|
|
8206
|
+
dndev sync-secrets --target github # sync to GitHub Secrets
|
|
8207
|
+
dndev sync-secrets --target github --repo owner/repo # sync to specific repo
|
|
8208
|
+
dndev sync-secrets --platform=firebase
|
|
8209
|
+
dndev sync-secrets --dry-run
|
|
8210
|
+
dndev sync-secrets --env-file .env.production --project my-project
|
|
8098
8211
|
`);
|
|
8099
8212
|
return 0;
|
|
8100
8213
|
}
|
|
@@ -8134,6 +8247,51 @@ Examples:
|
|
|
8134
8247
|
}
|
|
8135
8248
|
}
|
|
8136
8249
|
const envFilePath = joinPath(currentDir, config.envFile);
|
|
8250
|
+
const syncTarget = config.target || "runtime";
|
|
8251
|
+
if (syncTarget === "github") {
|
|
8252
|
+
const repo = config.repo || detectGitHubRepo();
|
|
8253
|
+
if (!repo) {
|
|
8254
|
+
log.error(
|
|
8255
|
+
"Could not detect GitHub repository. Use --repo owner/repo or ensure a GitHub remote is configured."
|
|
8256
|
+
);
|
|
8257
|
+
return 1;
|
|
8258
|
+
}
|
|
8259
|
+
log.info(`Syncing secrets to GitHub repository: ${repo}`);
|
|
8260
|
+
const secrets2 = parseEnvFile(envFilePath);
|
|
8261
|
+
const secretKeys2 = Object.keys(secrets2);
|
|
8262
|
+
if (secretKeys2.length === 0) {
|
|
8263
|
+
log.info("No secrets found in .env file");
|
|
8264
|
+
} else {
|
|
8265
|
+
log.info(`Found ${secretKeys2.length} secrets to sync to GitHub:`);
|
|
8266
|
+
secretKeys2.forEach((key) => log.info(` ${key}`));
|
|
8267
|
+
for (const [key, value] of Object.entries(secrets2)) {
|
|
8268
|
+
setGitHubSecret(key, value, repo, config.dryRun);
|
|
8269
|
+
}
|
|
8270
|
+
}
|
|
8271
|
+
if (firebaseProjectDir) {
|
|
8272
|
+
uploadServiceAccountToGitHub(
|
|
8273
|
+
firebaseProjectDir,
|
|
8274
|
+
repo,
|
|
8275
|
+
config.dryRun,
|
|
8276
|
+
false
|
|
8277
|
+
);
|
|
8278
|
+
uploadServiceAccountToGitHub(
|
|
8279
|
+
firebaseProjectDir,
|
|
8280
|
+
repo,
|
|
8281
|
+
config.dryRun,
|
|
8282
|
+
true
|
|
8283
|
+
);
|
|
8284
|
+
} else {
|
|
8285
|
+
uploadServiceAccountToGitHub(currentDir, repo, config.dryRun, false);
|
|
8286
|
+
uploadServiceAccountToGitHub(currentDir, repo, config.dryRun, true);
|
|
8287
|
+
}
|
|
8288
|
+
if (config.dryRun) {
|
|
8289
|
+
log.success("\nDry run completed. No GitHub secrets were set.");
|
|
8290
|
+
} else {
|
|
8291
|
+
log.success("\nAll secrets synced to GitHub successfully!");
|
|
8292
|
+
}
|
|
8293
|
+
return 0;
|
|
8294
|
+
}
|
|
8137
8295
|
const platform = config.platform || detectPlatform();
|
|
8138
8296
|
log.info(`Reading secrets from: ${envFilePath}`);
|
|
8139
8297
|
if (config.verbose) {
|
|
@@ -8194,6 +8352,26 @@ All secrets synced successfully to ${platform}!`);
|
|
|
8194
8352
|
return 1;
|
|
8195
8353
|
}
|
|
8196
8354
|
}
|
|
8355
|
+
var init_sync_secrets = __esm({
|
|
8356
|
+
"packages/tooling/src/apps/sync-secrets.ts"() {
|
|
8357
|
+
"use strict";
|
|
8358
|
+
init_utils();
|
|
8359
|
+
init_cli_input();
|
|
8360
|
+
init_cli_output();
|
|
8361
|
+
init_errors();
|
|
8362
|
+
init_pathResolver();
|
|
8363
|
+
}
|
|
8364
|
+
});
|
|
8365
|
+
|
|
8366
|
+
// packages/cli/src/bin/commands/sync-secrets.ts
|
|
8367
|
+
init_utils();
|
|
8368
|
+
|
|
8369
|
+
// packages/tooling/src/index.ts
|
|
8370
|
+
init_utils();
|
|
8371
|
+
|
|
8372
|
+
// packages/tooling/src/cli/index.ts
|
|
8373
|
+
init_utils();
|
|
8374
|
+
init_sync_secrets();
|
|
8197
8375
|
export {
|
|
8198
8376
|
main
|
|
8199
8377
|
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export interface TypeCheckOptions {
|
|
2
|
+
/** Optional: scope to one app subdirectory */
|
|
3
|
+
app?: string;
|
|
4
|
+
verbose?: boolean;
|
|
5
|
+
quiet?: boolean;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Type-check all packages with a `type-check` script in the consumer project.
|
|
9
|
+
*
|
|
10
|
+
* @param options - Command options
|
|
11
|
+
* @returns Exit code: 0 = all pass, 1 = any failure
|
|
12
|
+
*/
|
|
13
|
+
export declare function main(options?: TypeCheckOptions): Promise<number>;
|
|
14
|
+
//# sourceMappingURL=type-check.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"type-check.d.ts","sourceRoot":"","sources":["../../../src/bin/commands/type-check.ts"],"names":[],"mappings":"AAgBA,MAAM,WAAW,gBAAgB;IAC/B,8CAA8C;IAC9C,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAoQD;;;;;GAKG;AACH,wBAAsB,IAAI,CAAC,OAAO,GAAE,gBAAqB,GAAG,OAAO,CAAC,MAAM,CAAC,CAkF1E"}
|