@donotdev/cli 0.0.14 → 0.0.16
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 +372 -88
- package/dist/bin/commands/agent-setup.js +7 -1
- package/dist/bin/commands/build.js +141 -44
- package/dist/bin/commands/bump.js +81 -41
- package/dist/bin/commands/cacheout.js +37 -9
- package/dist/bin/commands/create-app.js +276 -121
- package/dist/bin/commands/create-project.js +506 -217
- package/dist/bin/commands/deploy.js +1785 -694
- package/dist/bin/commands/dev.js +177 -43
- package/dist/bin/commands/doctor.d.ts +6 -0
- package/dist/bin/commands/doctor.d.ts.map +1 -0
- package/dist/bin/commands/{lint.js → doctor.js} +1215 -156
- package/dist/bin/commands/doctor.js.map +1 -0
- package/dist/bin/commands/emu.js +451 -104
- package/dist/bin/commands/format.js +37 -9
- package/dist/bin/commands/make-admin.js +77499 -11
- package/dist/bin/commands/preview.js +181 -43
- package/dist/bin/commands/setup.d.ts +6 -0
- package/dist/bin/commands/setup.d.ts.map +1 -0
- package/dist/bin/commands/setup.js +11733 -0
- package/dist/bin/commands/setup.js.map +1 -0
- 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 +211 -34
- 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 +2049 -0
- package/dist/bin/commands/type-check.js.map +1 -0
- package/dist/bin/commands/wai.js +3 -1
- package/dist/bin/dndev.js +73 -52
- package/dist/bin/donotdev.js +54 -45
- package/dist/index.js +4212 -3050
- package/package.json +3 -3
- 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 +44 -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/assets/adaptive-icon.png +0 -0
- package/templates/app-expo/assets/favicon.png +0 -0
- package/templates/app-expo/assets/icon.png +0 -0
- package/templates/app-expo/assets/splash.png +0 -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/src/config/app.ts.example +46 -0
- package/templates/app-expo/src/config/providers.ts.example +7 -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/config/providers.ts.example +7 -0
- 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/config/providers.ts.example +7 -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 +2 -2
- package/templates/app-vite/src/themes.css.example +109 -79
- package/templates/app-vite/vercel.json.example +11 -0
- package/templates/functions-firebase/README.md.example +1 -1
- package/templates/functions-firebase/build.mjs.example +2 -72
- package/templates/functions-firebase/functions-firebase/.env.example.example +24 -26
- package/templates/functions-firebase/functions-firebase/README.md.example +1 -1
- 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-firebase/functions.config.js.example +1 -1
- package/templates/functions-supabase/supabase/config.toml.example +59 -0
- package/templates/functions-supabase/supabase/functions/.env.example +13 -0
- 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/deno.json.example +8 -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 +12 -0
- package/templates/overlay-supabase/env.fragment.expo.example +12 -0
- package/templates/overlay-supabase/env.fragment.nextjs.example +12 -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/grill.md.example +30 -0
- 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/.github/copilot-instructions.md.example +1 -0
- package/templates/root-consumer/.windsurfrules.example +1 -0
- package/templates/root-consumer/AI.md.example +44 -123
- package/templates/root-consumer/CLAUDE.md.example +1 -134
- 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 +22 -2
- 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 +101 -32
- package/templates/root-consumer/guides/dndev/INDEX.md.example +4 -2
- package/templates/root-consumer/guides/dndev/SETUP_APP_CONFIG.md.example +3 -3
- package/templates/root-consumer/guides/dndev/SETUP_CRUD.md.example +241 -12
- package/templates/root-consumer/guides/dndev/SETUP_FIREBASE.md.example +13 -7
- package/templates/root-consumer/guides/dndev/SETUP_OAUTH_PROVIDERS.md.example +60 -0
- package/templates/root-consumer/guides/dndev/SETUP_SOC2.md.example +234 -0
- package/templates/root-consumer/guides/dndev/SETUP_STRIPE.md.example +62 -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/WAI_WAY_CLI.md.example +7 -8
- 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 +55 -15
- 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/dist/bin/commands/lint.d.ts +0 -11
- package/dist/bin/commands/lint.d.ts.map +0 -1
- package/dist/bin/commands/lint.js.map +0 -1
- package/dist/bin/commands/staging.d.ts +0 -11
- package/dist/bin/commands/staging.d.ts.map +0 -1
- package/dist/bin/commands/staging.js +0 -12
- package/dist/bin/commands/staging.js.map +0 -1
- 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
|
@@ -7511,11 +7511,39 @@ var init_PathResolver = __esm({
|
|
|
7511
7511
|
});
|
|
7512
7512
|
|
|
7513
7513
|
// packages/tooling/src/utils/errors.ts
|
|
7514
|
-
var DoNotDevError;
|
|
7514
|
+
var DO_NOT_DEV_ERROR_CODES, DoNotDevError;
|
|
7515
7515
|
var init_errors = __esm({
|
|
7516
7516
|
"packages/tooling/src/utils/errors.ts"() {
|
|
7517
7517
|
"use strict";
|
|
7518
7518
|
init_utils();
|
|
7519
|
+
DO_NOT_DEV_ERROR_CODES = {
|
|
7520
|
+
CONFIGURATION_ERROR: "configuration-error",
|
|
7521
|
+
CONFIG_NOT_FOUND: "config-not-found",
|
|
7522
|
+
CONFIG_INVALID: "config-invalid",
|
|
7523
|
+
PATH_RESOLUTION_ERROR: "path-resolution-error",
|
|
7524
|
+
FILE_OPERATION_ERROR: "file-operation-error",
|
|
7525
|
+
FILE_NOT_FOUND: "file-not-found",
|
|
7526
|
+
PERMISSION_DENIED: "permission-denied",
|
|
7527
|
+
GENERATION_ERROR: "generation-error",
|
|
7528
|
+
TEMPLATE_ERROR: "template-error",
|
|
7529
|
+
TEMPLATE_NOT_FOUND: "template-not-found",
|
|
7530
|
+
CLI_EXECUTION_ERROR: "cli-execution-error",
|
|
7531
|
+
COMMAND_NOT_FOUND: "command-not-found",
|
|
7532
|
+
COMMAND_FAILED: "command-failed",
|
|
7533
|
+
VALIDATION_ERROR: "validation-error",
|
|
7534
|
+
SCHEMA_ERROR: "schema-error",
|
|
7535
|
+
DEPENDENCY_ERROR: "dependency-error",
|
|
7536
|
+
DEPENDENCY_NOT_FOUND: "dependency-not-found",
|
|
7537
|
+
DEPENDENCY_VERSION_ERROR: "dependency-version-error",
|
|
7538
|
+
INVALID_ARGUMENT: "invalid-argument",
|
|
7539
|
+
MISSING_ARGUMENT: "missing-argument",
|
|
7540
|
+
MISSING_PROJECT_ID: "missing-project-id",
|
|
7541
|
+
FIREBASE_CLI_ERROR: "firebase-cli-error",
|
|
7542
|
+
DEPLOYMENT_FAILED: "deployment-failed",
|
|
7543
|
+
OPERATION_CANCELLED: "operation-cancelled",
|
|
7544
|
+
TIMEOUT_ERROR: "timeout-error",
|
|
7545
|
+
UNKNOWN_ERROR: "unknown-error"
|
|
7546
|
+
};
|
|
7519
7547
|
DoNotDevError = class _DoNotDevError extends Error {
|
|
7520
7548
|
/** The error code categorizing this error */
|
|
7521
7549
|
code;
|
|
@@ -7535,7 +7563,7 @@ var init_errors = __esm({
|
|
|
7535
7563
|
* @param {Record<string, any>} [options.context] - Additional context data
|
|
7536
7564
|
* @param {boolean} [options.displayable=true] - Whether this error should be displayed to the user
|
|
7537
7565
|
*/
|
|
7538
|
-
constructor(message, code =
|
|
7566
|
+
constructor(message, code = DO_NOT_DEV_ERROR_CODES.UNKNOWN_ERROR, options) {
|
|
7539
7567
|
super(message);
|
|
7540
7568
|
this.name = "DoNotDevError";
|
|
7541
7569
|
this.code = code;
|
|
@@ -7566,7 +7594,7 @@ var init_errors = __esm({
|
|
|
7566
7594
|
* @param {boolean} [options.displayable=true] - Whether this error should be displayed to the user
|
|
7567
7595
|
* @returns {DoNotDevError} New DoNotDev error wrapping the original
|
|
7568
7596
|
*/
|
|
7569
|
-
static from(error2, context, code =
|
|
7597
|
+
static from(error2, context, code = DO_NOT_DEV_ERROR_CODES.UNKNOWN_ERROR, options) {
|
|
7570
7598
|
if (!(error2 instanceof Error)) {
|
|
7571
7599
|
return new _DoNotDevError(
|
|
7572
7600
|
`Unknown error: ${String(error2)}`,
|
|
@@ -7603,21 +7631,21 @@ var init_errors = __esm({
|
|
|
7603
7631
|
}
|
|
7604
7632
|
const message = error2.message.toLowerCase();
|
|
7605
7633
|
if (error2.name === "ValidationError" || message.includes("validation")) {
|
|
7606
|
-
return
|
|
7634
|
+
return DO_NOT_DEV_ERROR_CODES.VALIDATION_ERROR;
|
|
7607
7635
|
}
|
|
7608
7636
|
if (message.includes("not found") || message.includes("no such file")) {
|
|
7609
|
-
return
|
|
7637
|
+
return DO_NOT_DEV_ERROR_CODES.FILE_NOT_FOUND;
|
|
7610
7638
|
}
|
|
7611
7639
|
if (message.includes("permission") || message.includes("access denied")) {
|
|
7612
|
-
return
|
|
7640
|
+
return DO_NOT_DEV_ERROR_CODES.PERMISSION_DENIED;
|
|
7613
7641
|
}
|
|
7614
7642
|
if (message.includes("timeout") || message.includes("timed out")) {
|
|
7615
|
-
return
|
|
7643
|
+
return DO_NOT_DEV_ERROR_CODES.TIMEOUT_ERROR;
|
|
7616
7644
|
}
|
|
7617
7645
|
if (message.includes("dependency") || message.includes("module not found")) {
|
|
7618
|
-
return
|
|
7646
|
+
return DO_NOT_DEV_ERROR_CODES.DEPENDENCY_ERROR;
|
|
7619
7647
|
}
|
|
7620
|
-
return
|
|
7648
|
+
return DO_NOT_DEV_ERROR_CODES.UNKNOWN_ERROR;
|
|
7621
7649
|
}
|
|
7622
7650
|
};
|
|
7623
7651
|
}
|
|
@@ -7659,6 +7687,34 @@ var init_pathResolver = __esm({
|
|
|
7659
7687
|
}
|
|
7660
7688
|
});
|
|
7661
7689
|
|
|
7690
|
+
// packages/tooling/src/utils/typed-file-operations.ts
|
|
7691
|
+
function readPackageJson(filePath) {
|
|
7692
|
+
if (!pathExists(filePath)) {
|
|
7693
|
+
throw new DoNotDevError(
|
|
7694
|
+
`package.json not found: ${filePath}`,
|
|
7695
|
+
DO_NOT_DEV_ERROR_CODES.FILE_NOT_FOUND,
|
|
7696
|
+
{ context: { filePath } }
|
|
7697
|
+
);
|
|
7698
|
+
}
|
|
7699
|
+
const content = readSync(filePath, { format: "json" });
|
|
7700
|
+
if (!content || typeof content !== "object" || !("name" in content)) {
|
|
7701
|
+
throw new DoNotDevError(
|
|
7702
|
+
`Invalid package.json: ${filePath}`,
|
|
7703
|
+
DO_NOT_DEV_ERROR_CODES.CONFIG_INVALID,
|
|
7704
|
+
{ context: { filePath } }
|
|
7705
|
+
);
|
|
7706
|
+
}
|
|
7707
|
+
return content;
|
|
7708
|
+
}
|
|
7709
|
+
var init_typed_file_operations = __esm({
|
|
7710
|
+
"packages/tooling/src/utils/typed-file-operations.ts"() {
|
|
7711
|
+
"use strict";
|
|
7712
|
+
init_utils();
|
|
7713
|
+
init_pathResolver();
|
|
7714
|
+
init_errors();
|
|
7715
|
+
}
|
|
7716
|
+
});
|
|
7717
|
+
|
|
7662
7718
|
// packages/tooling/src/bundler/utils.ts
|
|
7663
7719
|
import { Buffer as Buffer2 } from "node:buffer";
|
|
7664
7720
|
import { readFileSync as readFileSync2, writeFileSync as writeFileSync2, mkdirSync as mkdirSync2 } from "node:fs";
|
|
@@ -7686,22 +7742,7 @@ var init_utils = __esm({
|
|
|
7686
7742
|
}
|
|
7687
7743
|
});
|
|
7688
7744
|
|
|
7689
|
-
// packages/cli/src/bin/commands/preview.ts
|
|
7690
|
-
init_utils();
|
|
7691
|
-
|
|
7692
|
-
// packages/tooling/src/index.ts
|
|
7693
|
-
init_utils();
|
|
7694
|
-
|
|
7695
|
-
// packages/tooling/src/cli/index.ts
|
|
7696
|
-
init_utils();
|
|
7697
|
-
|
|
7698
|
-
// packages/tooling/src/utils/app-selector.ts
|
|
7699
|
-
init_utils();
|
|
7700
|
-
init_dist2();
|
|
7701
|
-
|
|
7702
7745
|
// packages/tooling/src/utils/app-detection.ts
|
|
7703
|
-
init_utils();
|
|
7704
|
-
init_pathResolver();
|
|
7705
7746
|
function detectApps(projectRoot) {
|
|
7706
7747
|
const apps = [];
|
|
7707
7748
|
const appsDir = joinPath(projectRoot, "apps");
|
|
@@ -7722,9 +7763,7 @@ function detectApps(projectRoot) {
|
|
|
7722
7763
|
const packageJsonPath = joinPath(projectRoot, "package.json");
|
|
7723
7764
|
if (pathExists(packageJsonPath)) {
|
|
7724
7765
|
try {
|
|
7725
|
-
const packageJson =
|
|
7726
|
-
format: "json"
|
|
7727
|
-
});
|
|
7766
|
+
const packageJson = readPackageJson(packageJsonPath);
|
|
7728
7767
|
if (packageJson && (packageJson.dependencies?.vite || packageJson.devDependencies?.vite || packageJson.dependencies?.next || packageJson.devDependencies?.next)) {
|
|
7729
7768
|
const pathParts = projectRoot.split(/[/\\]/);
|
|
7730
7769
|
const appName = pathParts[pathParts.length - 1] || "app";
|
|
@@ -7744,10 +7783,10 @@ function analyzeApp(appPath, appName) {
|
|
|
7744
7783
|
if (!pathExists(packageJsonPath)) {
|
|
7745
7784
|
return null;
|
|
7746
7785
|
}
|
|
7747
|
-
let packageJson;
|
|
7786
|
+
let packageJson = null;
|
|
7748
7787
|
try {
|
|
7749
|
-
packageJson =
|
|
7750
|
-
if (!packageJson) {
|
|
7788
|
+
packageJson = readPackageJson(packageJsonPath);
|
|
7789
|
+
if (!packageJson.name) {
|
|
7751
7790
|
return null;
|
|
7752
7791
|
}
|
|
7753
7792
|
} catch {
|
|
@@ -7762,14 +7801,23 @@ function analyzeApp(appPath, appName) {
|
|
|
7762
7801
|
const functionsPath = joinPath(appPath, "functions");
|
|
7763
7802
|
const functionsStat = statSync2(functionsPath);
|
|
7764
7803
|
const hasFunctions = pathExists(functionsPath) && (functionsStat?.isDirectory() ?? false);
|
|
7765
|
-
let
|
|
7766
|
-
|
|
7767
|
-
|
|
7804
|
+
let platform2;
|
|
7805
|
+
const firebaseJsonInFunctions = hasFunctions && pathExists(joinPath(functionsPath, "firebase.json"));
|
|
7806
|
+
const firebaseJsonInApp = pathExists(joinPath(appPath, "firebase.json"));
|
|
7807
|
+
if (firebaseJsonInFunctions || firebaseJsonInApp) {
|
|
7808
|
+
platform2 = "firebase";
|
|
7809
|
+
}
|
|
7810
|
+
if (!platform2) {
|
|
7811
|
+
const supabaseConfigPath = joinPath(appPath, "supabase", "config.toml");
|
|
7812
|
+
const hasSupabaseDep = !!(packageJson.dependencies?.["@donotdev/supabase"] || packageJson.dependencies?.["@supabase/supabase-js"]);
|
|
7813
|
+
if (pathExists(supabaseConfigPath) || hasSupabaseDep) {
|
|
7814
|
+
platform2 = "supabase";
|
|
7815
|
+
}
|
|
7816
|
+
}
|
|
7817
|
+
if (!platform2) {
|
|
7768
7818
|
const vercelJsonPath = joinPath(appPath, "vercel.json");
|
|
7769
|
-
if (pathExists(
|
|
7770
|
-
|
|
7771
|
-
} else if (pathExists(vercelJsonPath)) {
|
|
7772
|
-
platform = "vercel";
|
|
7819
|
+
if (pathExists(vercelJsonPath)) {
|
|
7820
|
+
platform2 = "vercel";
|
|
7773
7821
|
}
|
|
7774
7822
|
}
|
|
7775
7823
|
return {
|
|
@@ -7780,12 +7828,19 @@ function analyzeApp(appPath, appName) {
|
|
|
7780
7828
|
framework,
|
|
7781
7829
|
hasFunctions,
|
|
7782
7830
|
functionsPath: hasFunctions ? functionsPath : void 0,
|
|
7783
|
-
platform
|
|
7831
|
+
platform: platform2
|
|
7784
7832
|
};
|
|
7785
7833
|
}
|
|
7834
|
+
var init_app_detection = __esm({
|
|
7835
|
+
"packages/tooling/src/utils/app-detection.ts"() {
|
|
7836
|
+
"use strict";
|
|
7837
|
+
init_utils();
|
|
7838
|
+
init_pathResolver();
|
|
7839
|
+
init_typed_file_operations();
|
|
7840
|
+
}
|
|
7841
|
+
});
|
|
7786
7842
|
|
|
7787
7843
|
// packages/tooling/src/utils/app-selector.ts
|
|
7788
|
-
init_cli_output();
|
|
7789
7844
|
async function selectApp(projectRoot, appName) {
|
|
7790
7845
|
const apps = detectApps(projectRoot);
|
|
7791
7846
|
if (apps.length === 0) {
|
|
@@ -7819,6 +7874,24 @@ async function selectApp(projectRoot, appName) {
|
|
|
7819
7874
|
}
|
|
7820
7875
|
return apps.find((a) => a.name === selected) || null;
|
|
7821
7876
|
}
|
|
7877
|
+
var init_app_selector = __esm({
|
|
7878
|
+
"packages/tooling/src/utils/app-selector.ts"() {
|
|
7879
|
+
"use strict";
|
|
7880
|
+
init_utils();
|
|
7881
|
+
init_dist2();
|
|
7882
|
+
init_app_detection();
|
|
7883
|
+
init_cli_output();
|
|
7884
|
+
}
|
|
7885
|
+
});
|
|
7886
|
+
|
|
7887
|
+
// packages/cli/src/bin/commands/preview.ts
|
|
7888
|
+
init_utils();
|
|
7889
|
+
|
|
7890
|
+
// packages/tooling/src/index.ts
|
|
7891
|
+
init_utils();
|
|
7892
|
+
|
|
7893
|
+
// packages/tooling/src/cli/index.ts
|
|
7894
|
+
init_utils();
|
|
7822
7895
|
|
|
7823
7896
|
// packages/tooling/src/utils/spawn-utils.ts
|
|
7824
7897
|
init_utils();
|
|
@@ -7832,10 +7905,22 @@ function createAppEnv(appPath) {
|
|
|
7832
7905
|
|
|
7833
7906
|
// packages/tooling/src/apps/preview.ts
|
|
7834
7907
|
init_utils();
|
|
7835
|
-
|
|
7908
|
+
init_app_selector();
|
|
7836
7909
|
init_cli_output();
|
|
7837
7910
|
init_errors();
|
|
7838
7911
|
init_pathResolver();
|
|
7912
|
+
import {
|
|
7913
|
+
spawn,
|
|
7914
|
+
spawnSync as spawnSync2,
|
|
7915
|
+
execSync as execSync2
|
|
7916
|
+
} from "node:child_process";
|
|
7917
|
+
import { platform } from "node:os";
|
|
7918
|
+
var SIGNAL_EXIT_CODES = {
|
|
7919
|
+
SIGINT: 130,
|
|
7920
|
+
// 128 + 2
|
|
7921
|
+
SIGTERM: 143
|
|
7922
|
+
// 128 + 15
|
|
7923
|
+
};
|
|
7839
7924
|
async function main() {
|
|
7840
7925
|
const args = process.argv.slice(2);
|
|
7841
7926
|
const appName = args[0] && args[0] !== "preview" ? args[0] : void 0;
|
|
@@ -7872,12 +7957,65 @@ async function main() {
|
|
|
7872
7957
|
log.info(`Previewing ${app.name}...
|
|
7873
7958
|
`);
|
|
7874
7959
|
const turboArgs = ["preview", "--filter", app.packageName];
|
|
7875
|
-
const
|
|
7960
|
+
const isWindows = platform() === "win32";
|
|
7961
|
+
const childProcess = spawn("bunx", ["turbo", ...turboArgs], {
|
|
7876
7962
|
stdio: "inherit",
|
|
7877
7963
|
env: createAppEnv(app.path),
|
|
7878
|
-
cwd: projectRoot
|
|
7964
|
+
cwd: projectRoot,
|
|
7965
|
+
shell: isWindows
|
|
7966
|
+
});
|
|
7967
|
+
const cleanup = (signal) => {
|
|
7968
|
+
if (!childProcess.pid) return;
|
|
7969
|
+
log.debug(`Received ${signal}, cleaning up processes...`);
|
|
7970
|
+
if (isWindows) {
|
|
7971
|
+
try {
|
|
7972
|
+
execSync2(`taskkill /F /T /PID ${childProcess.pid}`, {
|
|
7973
|
+
stdio: "ignore",
|
|
7974
|
+
timeout: 2e3
|
|
7975
|
+
});
|
|
7976
|
+
} catch {
|
|
7977
|
+
}
|
|
7978
|
+
} else {
|
|
7979
|
+
try {
|
|
7980
|
+
process.kill(childProcess.pid, signal);
|
|
7981
|
+
} catch {
|
|
7982
|
+
}
|
|
7983
|
+
try {
|
|
7984
|
+
execSync2(`pkill -P ${childProcess.pid}`, {
|
|
7985
|
+
stdio: "ignore",
|
|
7986
|
+
timeout: 1e3
|
|
7987
|
+
});
|
|
7988
|
+
} catch {
|
|
7989
|
+
}
|
|
7990
|
+
}
|
|
7991
|
+
};
|
|
7992
|
+
const signals = ["SIGINT", "SIGTERM"];
|
|
7993
|
+
const handlers = [];
|
|
7994
|
+
for (const signal of signals) {
|
|
7995
|
+
const handler = () => {
|
|
7996
|
+
cleanup(signal);
|
|
7997
|
+
handlers.forEach((h2) => h2());
|
|
7998
|
+
process.exit(SIGNAL_EXIT_CODES[signal] ?? 130);
|
|
7999
|
+
};
|
|
8000
|
+
process.on(signal, handler);
|
|
8001
|
+
handlers.push(() => process.removeListener(signal, handler));
|
|
8002
|
+
}
|
|
8003
|
+
return new Promise((resolve4) => {
|
|
8004
|
+
childProcess.on("exit", (code, signal) => {
|
|
8005
|
+
handlers.forEach((h2) => h2());
|
|
8006
|
+
if (signal) {
|
|
8007
|
+
log.debug(`Process killed by signal: ${signal}`);
|
|
8008
|
+
resolve4(SIGNAL_EXIT_CODES[signal] ?? 130);
|
|
8009
|
+
} else {
|
|
8010
|
+
resolve4(code ?? 0);
|
|
8011
|
+
}
|
|
8012
|
+
});
|
|
8013
|
+
childProcess.on("error", (error2) => {
|
|
8014
|
+
handlers.forEach((h2) => h2());
|
|
8015
|
+
log.error(`Failed to start preview server: ${error2.message}`);
|
|
8016
|
+
resolve4(1);
|
|
8017
|
+
});
|
|
7879
8018
|
});
|
|
7880
|
-
return result.status || 0;
|
|
7881
8019
|
}
|
|
7882
8020
|
export {
|
|
7883
8021
|
main
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setup.d.ts","sourceRoot":"","sources":["../../../src/bin/commands/setup.ts"],"names":[],"mappings":"AACA;;;GAGG;AAEH,OAAO,EAAE,KAAK,IAAI,IAAI,EAAE,MAAM,mBAAmB,CAAC"}
|