@donotdev/cli 0.0.24 → 0.0.26
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/README.md +7 -295
- package/dependencies-matrix.json +47 -135
- package/dist/bin/commands/agent-setup.js +3 -3
- package/dist/bin/commands/build.js +144 -143
- package/dist/bin/commands/bump.js +146 -145
- package/dist/bin/commands/cacheout.js +143 -142
- package/dist/bin/commands/coach.js +157 -152
- package/dist/bin/commands/create-app.js +23 -23
- package/dist/bin/commands/create-project.js +166 -165
- package/dist/bin/commands/db.js +46705 -46704
- package/dist/bin/commands/deploy.js +684 -580
- package/dist/bin/commands/dev.js +180 -160
- package/dist/bin/commands/doctor.js +153 -152
- package/dist/bin/commands/emu.js +174 -168
- package/dist/bin/commands/format.js +144 -143
- package/dist/bin/commands/get-demo.js +2 -2
- package/dist/bin/commands/make-admin.js +64122 -64043
- package/dist/bin/commands/preview.js +179 -160
- package/dist/bin/commands/seed.js +46705 -46704
- package/dist/bin/commands/setup-cicd.js +165 -159
- package/dist/bin/commands/setup.js +414 -214
- package/dist/bin/commands/staging.js +684 -580
- package/dist/bin/commands/sync-secrets.js +143 -142
- package/dist/bin/commands/type-check.js +143 -142
- package/dist/bin/commands/wai.js +1 -1
- package/dist/bin/dndev.js +79 -1
- package/dist/index.js +713 -593
- package/package.json +1 -1
- package/templates/root-consumer/.cursor/mcp.json.example +1 -1
- package/templates/root-consumer/.gemini/settings.json.example +1 -1
- package/templates/root-consumer/.mcp.json.example +1 -1
- package/templates/root-consumer/bunfig.toml.example +6 -53
- package/templates/root-consumer/guides/dndev/SETUP_VERCEL.md.example +26 -9
- package/templates/root-consumer/vercel.json.example +2 -1
|
@@ -767,6 +767,148 @@ var init_cli_output = __esm({
|
|
|
767
767
|
}
|
|
768
768
|
});
|
|
769
769
|
|
|
770
|
+
// packages/tooling/src/utils/errors.ts
|
|
771
|
+
var DO_NOT_DEV_ERROR_CODES, DoNotDevError;
|
|
772
|
+
var init_errors = __esm({
|
|
773
|
+
"packages/tooling/src/utils/errors.ts"() {
|
|
774
|
+
"use strict";
|
|
775
|
+
init_utils();
|
|
776
|
+
DO_NOT_DEV_ERROR_CODES = {
|
|
777
|
+
CONFIGURATION_ERROR: "configuration-error",
|
|
778
|
+
CONFIG_NOT_FOUND: "config-not-found",
|
|
779
|
+
CONFIG_INVALID: "config-invalid",
|
|
780
|
+
PATH_RESOLUTION_ERROR: "path-resolution-error",
|
|
781
|
+
FILE_OPERATION_ERROR: "file-operation-error",
|
|
782
|
+
FILE_NOT_FOUND: "file-not-found",
|
|
783
|
+
PERMISSION_DENIED: "permission-denied",
|
|
784
|
+
GENERATION_ERROR: "generation-error",
|
|
785
|
+
TEMPLATE_ERROR: "template-error",
|
|
786
|
+
TEMPLATE_NOT_FOUND: "template-not-found",
|
|
787
|
+
CLI_EXECUTION_ERROR: "cli-execution-error",
|
|
788
|
+
COMMAND_NOT_FOUND: "command-not-found",
|
|
789
|
+
COMMAND_FAILED: "command-failed",
|
|
790
|
+
VALIDATION_ERROR: "validation-error",
|
|
791
|
+
SCHEMA_ERROR: "schema-error",
|
|
792
|
+
DEPENDENCY_ERROR: "dependency-error",
|
|
793
|
+
DEPENDENCY_NOT_FOUND: "dependency-not-found",
|
|
794
|
+
DEPENDENCY_VERSION_ERROR: "dependency-version-error",
|
|
795
|
+
INVALID_ARGUMENT: "invalid-argument",
|
|
796
|
+
MISSING_ARGUMENT: "missing-argument",
|
|
797
|
+
MISSING_PROJECT_ID: "missing-project-id",
|
|
798
|
+
FIREBASE_CLI_ERROR: "firebase-cli-error",
|
|
799
|
+
DEPLOYMENT_FAILED: "deployment-failed",
|
|
800
|
+
VERCEL_API_ERROR: "vercel-api-error",
|
|
801
|
+
OPERATION_CANCELLED: "operation-cancelled",
|
|
802
|
+
TIMEOUT_ERROR: "timeout-error",
|
|
803
|
+
UNKNOWN_ERROR: "unknown-error"
|
|
804
|
+
};
|
|
805
|
+
DoNotDevError = class _DoNotDevError extends Error {
|
|
806
|
+
/** The error code categorizing this error */
|
|
807
|
+
code;
|
|
808
|
+
/** Original error if this is wrapping another error */
|
|
809
|
+
originalError;
|
|
810
|
+
/** Additional context for the error */
|
|
811
|
+
context;
|
|
812
|
+
/** Whether this error should be displayed to the user */
|
|
813
|
+
displayable;
|
|
814
|
+
/**
|
|
815
|
+
* Creates a new DoNotDev error
|
|
816
|
+
*
|
|
817
|
+
* @param {string} message - Error message
|
|
818
|
+
* @param {DoNotDevErrorCode} code - Error code
|
|
819
|
+
* @param {object} [options] - Additional error options
|
|
820
|
+
* @param {Error} [options.originalError] - Original error if wrapping
|
|
821
|
+
* @param {Record<string, any>} [options.context] - Additional context data
|
|
822
|
+
* @param {boolean} [options.displayable=true] - Whether this error should be displayed to the user
|
|
823
|
+
*/
|
|
824
|
+
constructor(message, code = DO_NOT_DEV_ERROR_CODES.UNKNOWN_ERROR, options) {
|
|
825
|
+
super(message);
|
|
826
|
+
this.name = "DoNotDevError";
|
|
827
|
+
this.code = code;
|
|
828
|
+
this.originalError = options?.originalError;
|
|
829
|
+
this.context = options?.context;
|
|
830
|
+
this.displayable = options?.displayable !== false;
|
|
831
|
+
Object.setPrototypeOf(this, _DoNotDevError.prototype);
|
|
832
|
+
if (Error.captureStackTrace) {
|
|
833
|
+
Error.captureStackTrace(this, _DoNotDevError);
|
|
834
|
+
}
|
|
835
|
+
}
|
|
836
|
+
/**
|
|
837
|
+
* Formats the error for logging or display
|
|
838
|
+
*
|
|
839
|
+
* @returns {string} Formatted error message with code
|
|
840
|
+
*/
|
|
841
|
+
format() {
|
|
842
|
+
return `[${this.code}] ${this.message}`;
|
|
843
|
+
}
|
|
844
|
+
/**
|
|
845
|
+
* Creates a wrapped error from another error
|
|
846
|
+
*
|
|
847
|
+
* @param {Error} error - Original error to wrap
|
|
848
|
+
* @param {string} [context] - Additional context for the error
|
|
849
|
+
* @param {DoNotDevErrorCode} [code='unknown-error'] - Error code
|
|
850
|
+
* @param {object} [options] - Additional error options
|
|
851
|
+
* @param {Record<string, any>} [options.context] - Additional context data
|
|
852
|
+
* @param {boolean} [options.displayable=true] - Whether this error should be displayed to the user
|
|
853
|
+
* @returns {DoNotDevError} New DoNotDev error wrapping the original
|
|
854
|
+
*/
|
|
855
|
+
static from(error2, context, code = DO_NOT_DEV_ERROR_CODES.UNKNOWN_ERROR, options) {
|
|
856
|
+
if (!(error2 instanceof Error)) {
|
|
857
|
+
return new _DoNotDevError(
|
|
858
|
+
`Unknown error: ${String(error2)}`,
|
|
859
|
+
code,
|
|
860
|
+
options
|
|
861
|
+
);
|
|
862
|
+
}
|
|
863
|
+
if (error2 instanceof _DoNotDevError) {
|
|
864
|
+
if (!context) {
|
|
865
|
+
return error2;
|
|
866
|
+
}
|
|
867
|
+
return new _DoNotDevError(`${context}: ${error2.message}`, error2.code, {
|
|
868
|
+
originalError: error2.originalError || error2,
|
|
869
|
+
context: { ...error2.context, ...options?.context || {} },
|
|
870
|
+
displayable: options?.displayable ?? error2.displayable
|
|
871
|
+
});
|
|
872
|
+
}
|
|
873
|
+
const message = context ? `${context}: ${error2.message}` : error2.message;
|
|
874
|
+
return new _DoNotDevError(message, code, {
|
|
875
|
+
originalError: error2,
|
|
876
|
+
context: options?.context,
|
|
877
|
+
displayable: options?.displayable
|
|
878
|
+
});
|
|
879
|
+
}
|
|
880
|
+
/**
|
|
881
|
+
* Maps common error types to DoNotDevErrorCode
|
|
882
|
+
*
|
|
883
|
+
* @param {Error} error - Error to analyze
|
|
884
|
+
* @returns {DoNotDevErrorCode} Mapped error code
|
|
885
|
+
*/
|
|
886
|
+
static getErrorCodeFromError(error2) {
|
|
887
|
+
if (error2 instanceof _DoNotDevError) {
|
|
888
|
+
return error2.code;
|
|
889
|
+
}
|
|
890
|
+
const message = error2.message.toLowerCase();
|
|
891
|
+
if (error2.name === "ValidationError" || message.includes("validation")) {
|
|
892
|
+
return DO_NOT_DEV_ERROR_CODES.VALIDATION_ERROR;
|
|
893
|
+
}
|
|
894
|
+
if (message.includes("not found") || message.includes("no such file")) {
|
|
895
|
+
return DO_NOT_DEV_ERROR_CODES.FILE_NOT_FOUND;
|
|
896
|
+
}
|
|
897
|
+
if (message.includes("permission") || message.includes("access denied")) {
|
|
898
|
+
return DO_NOT_DEV_ERROR_CODES.PERMISSION_DENIED;
|
|
899
|
+
}
|
|
900
|
+
if (message.includes("timeout") || message.includes("timed out")) {
|
|
901
|
+
return DO_NOT_DEV_ERROR_CODES.TIMEOUT_ERROR;
|
|
902
|
+
}
|
|
903
|
+
if (message.includes("dependency") || message.includes("module not found")) {
|
|
904
|
+
return DO_NOT_DEV_ERROR_CODES.DEPENDENCY_ERROR;
|
|
905
|
+
}
|
|
906
|
+
return DO_NOT_DEV_ERROR_CODES.UNKNOWN_ERROR;
|
|
907
|
+
}
|
|
908
|
+
};
|
|
909
|
+
}
|
|
910
|
+
});
|
|
911
|
+
|
|
770
912
|
// node_modules/.bun/fast-glob@3.3.3/node_modules/fast-glob/out/utils/array.js
|
|
771
913
|
var require_array = __commonJS({
|
|
772
914
|
"node_modules/.bun/fast-glob@3.3.3/node_modules/fast-glob/out/utils/array.js"(exports) {
|
|
@@ -7510,147 +7652,6 @@ var init_PathResolver = __esm({
|
|
|
7510
7652
|
}
|
|
7511
7653
|
});
|
|
7512
7654
|
|
|
7513
|
-
// packages/tooling/src/utils/errors.ts
|
|
7514
|
-
var DO_NOT_DEV_ERROR_CODES, DoNotDevError;
|
|
7515
|
-
var init_errors = __esm({
|
|
7516
|
-
"packages/tooling/src/utils/errors.ts"() {
|
|
7517
|
-
"use strict";
|
|
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
|
-
};
|
|
7547
|
-
DoNotDevError = class _DoNotDevError extends Error {
|
|
7548
|
-
/** The error code categorizing this error */
|
|
7549
|
-
code;
|
|
7550
|
-
/** Original error if this is wrapping another error */
|
|
7551
|
-
originalError;
|
|
7552
|
-
/** Additional context for the error */
|
|
7553
|
-
context;
|
|
7554
|
-
/** Whether this error should be displayed to the user */
|
|
7555
|
-
displayable;
|
|
7556
|
-
/**
|
|
7557
|
-
* Creates a new DoNotDev error
|
|
7558
|
-
*
|
|
7559
|
-
* @param {string} message - Error message
|
|
7560
|
-
* @param {DoNotDevErrorCode} code - Error code
|
|
7561
|
-
* @param {object} [options] - Additional error options
|
|
7562
|
-
* @param {Error} [options.originalError] - Original error if wrapping
|
|
7563
|
-
* @param {Record<string, any>} [options.context] - Additional context data
|
|
7564
|
-
* @param {boolean} [options.displayable=true] - Whether this error should be displayed to the user
|
|
7565
|
-
*/
|
|
7566
|
-
constructor(message, code = DO_NOT_DEV_ERROR_CODES.UNKNOWN_ERROR, options) {
|
|
7567
|
-
super(message);
|
|
7568
|
-
this.name = "DoNotDevError";
|
|
7569
|
-
this.code = code;
|
|
7570
|
-
this.originalError = options?.originalError;
|
|
7571
|
-
this.context = options?.context;
|
|
7572
|
-
this.displayable = options?.displayable !== false;
|
|
7573
|
-
Object.setPrototypeOf(this, _DoNotDevError.prototype);
|
|
7574
|
-
if (Error.captureStackTrace) {
|
|
7575
|
-
Error.captureStackTrace(this, _DoNotDevError);
|
|
7576
|
-
}
|
|
7577
|
-
}
|
|
7578
|
-
/**
|
|
7579
|
-
* Formats the error for logging or display
|
|
7580
|
-
*
|
|
7581
|
-
* @returns {string} Formatted error message with code
|
|
7582
|
-
*/
|
|
7583
|
-
format() {
|
|
7584
|
-
return `[${this.code}] ${this.message}`;
|
|
7585
|
-
}
|
|
7586
|
-
/**
|
|
7587
|
-
* Creates a wrapped error from another error
|
|
7588
|
-
*
|
|
7589
|
-
* @param {Error} error - Original error to wrap
|
|
7590
|
-
* @param {string} [context] - Additional context for the error
|
|
7591
|
-
* @param {DoNotDevErrorCode} [code='unknown-error'] - Error code
|
|
7592
|
-
* @param {object} [options] - Additional error options
|
|
7593
|
-
* @param {Record<string, any>} [options.context] - Additional context data
|
|
7594
|
-
* @param {boolean} [options.displayable=true] - Whether this error should be displayed to the user
|
|
7595
|
-
* @returns {DoNotDevError} New DoNotDev error wrapping the original
|
|
7596
|
-
*/
|
|
7597
|
-
static from(error2, context, code = DO_NOT_DEV_ERROR_CODES.UNKNOWN_ERROR, options) {
|
|
7598
|
-
if (!(error2 instanceof Error)) {
|
|
7599
|
-
return new _DoNotDevError(
|
|
7600
|
-
`Unknown error: ${String(error2)}`,
|
|
7601
|
-
code,
|
|
7602
|
-
options
|
|
7603
|
-
);
|
|
7604
|
-
}
|
|
7605
|
-
if (error2 instanceof _DoNotDevError) {
|
|
7606
|
-
if (!context) {
|
|
7607
|
-
return error2;
|
|
7608
|
-
}
|
|
7609
|
-
return new _DoNotDevError(`${context}: ${error2.message}`, error2.code, {
|
|
7610
|
-
originalError: error2.originalError || error2,
|
|
7611
|
-
context: { ...error2.context, ...options?.context || {} },
|
|
7612
|
-
displayable: options?.displayable ?? error2.displayable
|
|
7613
|
-
});
|
|
7614
|
-
}
|
|
7615
|
-
const message = context ? `${context}: ${error2.message}` : error2.message;
|
|
7616
|
-
return new _DoNotDevError(message, code, {
|
|
7617
|
-
originalError: error2,
|
|
7618
|
-
context: options?.context,
|
|
7619
|
-
displayable: options?.displayable
|
|
7620
|
-
});
|
|
7621
|
-
}
|
|
7622
|
-
/**
|
|
7623
|
-
* Maps common error types to DoNotDevErrorCode
|
|
7624
|
-
*
|
|
7625
|
-
* @param {Error} error - Error to analyze
|
|
7626
|
-
* @returns {DoNotDevErrorCode} Mapped error code
|
|
7627
|
-
*/
|
|
7628
|
-
static getErrorCodeFromError(error2) {
|
|
7629
|
-
if (error2 instanceof _DoNotDevError) {
|
|
7630
|
-
return error2.code;
|
|
7631
|
-
}
|
|
7632
|
-
const message = error2.message.toLowerCase();
|
|
7633
|
-
if (error2.name === "ValidationError" || message.includes("validation")) {
|
|
7634
|
-
return DO_NOT_DEV_ERROR_CODES.VALIDATION_ERROR;
|
|
7635
|
-
}
|
|
7636
|
-
if (message.includes("not found") || message.includes("no such file")) {
|
|
7637
|
-
return DO_NOT_DEV_ERROR_CODES.FILE_NOT_FOUND;
|
|
7638
|
-
}
|
|
7639
|
-
if (message.includes("permission") || message.includes("access denied")) {
|
|
7640
|
-
return DO_NOT_DEV_ERROR_CODES.PERMISSION_DENIED;
|
|
7641
|
-
}
|
|
7642
|
-
if (message.includes("timeout") || message.includes("timed out")) {
|
|
7643
|
-
return DO_NOT_DEV_ERROR_CODES.TIMEOUT_ERROR;
|
|
7644
|
-
}
|
|
7645
|
-
if (message.includes("dependency") || message.includes("module not found")) {
|
|
7646
|
-
return DO_NOT_DEV_ERROR_CODES.DEPENDENCY_ERROR;
|
|
7647
|
-
}
|
|
7648
|
-
return DO_NOT_DEV_ERROR_CODES.UNKNOWN_ERROR;
|
|
7649
|
-
}
|
|
7650
|
-
};
|
|
7651
|
-
}
|
|
7652
|
-
});
|
|
7653
|
-
|
|
7654
7655
|
// packages/tooling/src/utils/pathResolver.ts
|
|
7655
7656
|
import { createRequire as createRequire2 } from "node:module";
|
|
7656
7657
|
import {
|
|
@@ -7710,14 +7711,14 @@ var init_typed_file_operations = __esm({
|
|
|
7710
7711
|
"packages/tooling/src/utils/typed-file-operations.ts"() {
|
|
7711
7712
|
"use strict";
|
|
7712
7713
|
init_utils();
|
|
7713
|
-
init_pathResolver();
|
|
7714
7714
|
init_errors();
|
|
7715
|
+
init_pathResolver();
|
|
7715
7716
|
}
|
|
7716
7717
|
});
|
|
7717
7718
|
|
|
7718
7719
|
// packages/tooling/src/bundler/utils.ts
|
|
7719
7720
|
import { Buffer } from "node:buffer";
|
|
7720
|
-
import { readFileSync as readFileSync2, writeFileSync as writeFileSync2, mkdirSync as mkdirSync2 } from "node:fs";
|
|
7721
|
+
import { copyFileSync as copyFileSync2, readFileSync as readFileSync2, writeFileSync as writeFileSync2, mkdirSync as mkdirSync2 } from "node:fs";
|
|
7721
7722
|
import { createRequire as createRequire3 } from "node:module";
|
|
7722
7723
|
import { dirname as dirname3, resolve as resolve3 } from "node:path";
|
|
7723
7724
|
import process from "node:process";
|
|
@@ -7801,23 +7802,23 @@ function analyzeApp(appPath, appName) {
|
|
|
7801
7802
|
const functionsPath = joinPath(appPath, "functions");
|
|
7802
7803
|
const functionsStat = statSync2(functionsPath);
|
|
7803
7804
|
const hasFunctions = pathExists(functionsPath) && (functionsStat?.isDirectory() ?? false);
|
|
7804
|
-
let
|
|
7805
|
+
let platform3;
|
|
7805
7806
|
const firebaseJsonInFunctions = hasFunctions && pathExists(joinPath(functionsPath, "firebase.json"));
|
|
7806
7807
|
const firebaseJsonInApp = pathExists(joinPath(appPath, "firebase.json"));
|
|
7807
7808
|
if (firebaseJsonInFunctions || firebaseJsonInApp) {
|
|
7808
|
-
|
|
7809
|
+
platform3 = "firebase";
|
|
7809
7810
|
}
|
|
7810
|
-
if (!
|
|
7811
|
+
if (!platform3) {
|
|
7811
7812
|
const supabaseConfigPath = joinPath(appPath, "supabase", "config.toml");
|
|
7812
7813
|
const hasSupabaseDep = !!(packageJson.dependencies?.["@donotdev/supabase"] || packageJson.dependencies?.["@supabase/supabase-js"]);
|
|
7813
7814
|
if (pathExists(supabaseConfigPath) || hasSupabaseDep) {
|
|
7814
|
-
|
|
7815
|
+
platform3 = "supabase";
|
|
7815
7816
|
}
|
|
7816
7817
|
}
|
|
7817
|
-
if (!
|
|
7818
|
+
if (!platform3) {
|
|
7818
7819
|
const vercelJsonPath = joinPath(appPath, "vercel.json");
|
|
7819
7820
|
if (pathExists(vercelJsonPath)) {
|
|
7820
|
-
|
|
7821
|
+
platform3 = "vercel";
|
|
7821
7822
|
}
|
|
7822
7823
|
}
|
|
7823
7824
|
return {
|
|
@@ -7828,7 +7829,7 @@ function analyzeApp(appPath, appName) {
|
|
|
7828
7829
|
framework,
|
|
7829
7830
|
hasFunctions,
|
|
7830
7831
|
functionsPath: hasFunctions ? functionsPath : void 0,
|
|
7831
|
-
platform:
|
|
7832
|
+
platform: platform3
|
|
7832
7833
|
};
|
|
7833
7834
|
}
|
|
7834
7835
|
var init_app_detection = __esm({
|
|
@@ -7895,13 +7896,29 @@ init_utils();
|
|
|
7895
7896
|
|
|
7896
7897
|
// packages/tooling/src/utils/spawn-utils.ts
|
|
7897
7898
|
init_utils();
|
|
7898
|
-
import {
|
|
7899
|
+
import {
|
|
7900
|
+
spawn,
|
|
7901
|
+
spawnSync,
|
|
7902
|
+
execSync
|
|
7903
|
+
} from "node:child_process";
|
|
7904
|
+
import { platform } from "node:os";
|
|
7899
7905
|
function createAppEnv(appPath) {
|
|
7900
7906
|
return {
|
|
7901
7907
|
...process.env,
|
|
7902
7908
|
DNDEV_APP_ROOT: appPath
|
|
7903
7909
|
};
|
|
7904
7910
|
}
|
|
7911
|
+
function spawnCrossPlatform(command, args, options) {
|
|
7912
|
+
const isWindows = platform() === "win32";
|
|
7913
|
+
const useShell = options.shell ?? isWindows;
|
|
7914
|
+
if (useShell) {
|
|
7915
|
+
const fullCommand = `${command} ${args.join(" ")}`;
|
|
7916
|
+
const { shell: _4, ...rest2 } = options;
|
|
7917
|
+
return spawn(fullCommand, [], { ...rest2, shell: true });
|
|
7918
|
+
}
|
|
7919
|
+
const { shell: _3, ...rest } = options;
|
|
7920
|
+
return spawn(command, args, rest);
|
|
7921
|
+
}
|
|
7905
7922
|
|
|
7906
7923
|
// packages/tooling/src/apps/preview.ts
|
|
7907
7924
|
init_utils();
|
|
@@ -7910,11 +7927,10 @@ init_cli_output();
|
|
|
7910
7927
|
init_errors();
|
|
7911
7928
|
init_pathResolver();
|
|
7912
7929
|
import {
|
|
7913
|
-
spawn,
|
|
7914
7930
|
spawnSync as spawnSync2,
|
|
7915
7931
|
execSync as execSync2
|
|
7916
7932
|
} from "node:child_process";
|
|
7917
|
-
import { platform } from "node:os";
|
|
7933
|
+
import { platform as platform2 } from "node:os";
|
|
7918
7934
|
var SIGNAL_EXIT_CODES = {
|
|
7919
7935
|
SIGINT: 130,
|
|
7920
7936
|
// 128 + 2
|
|
@@ -7957,13 +7973,16 @@ async function main() {
|
|
|
7957
7973
|
log.info(`Previewing ${app.name}...
|
|
7958
7974
|
`);
|
|
7959
7975
|
const turboArgs = ["preview", "--filter", app.packageName];
|
|
7960
|
-
const isWindows =
|
|
7961
|
-
const childProcess =
|
|
7962
|
-
|
|
7963
|
-
|
|
7964
|
-
|
|
7965
|
-
|
|
7966
|
-
|
|
7976
|
+
const isWindows = platform2() === "win32";
|
|
7977
|
+
const childProcess = spawnCrossPlatform(
|
|
7978
|
+
"bunx",
|
|
7979
|
+
["turbo", ...turboArgs],
|
|
7980
|
+
{
|
|
7981
|
+
stdio: "inherit",
|
|
7982
|
+
env: createAppEnv(app.path),
|
|
7983
|
+
cwd: projectRoot
|
|
7984
|
+
}
|
|
7985
|
+
);
|
|
7967
7986
|
const cleanup = (signal) => {
|
|
7968
7987
|
if (!childProcess.pid) return;
|
|
7969
7988
|
log.debug(`Received ${signal}, cleaning up processes...`);
|