@donotdev/cli 0.0.34 → 0.0.36
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 +2 -2
- package/dist/bin/commands/build.js +28 -2
- package/dist/bin/commands/create-app.js +6 -31
- package/dist/bin/commands/create-project.js +8 -41
- package/dist/bin/commands/deploy.js +430 -355
- package/dist/bin/commands/dev.js +7 -9
- package/dist/bin/commands/staging.js +430 -355
- package/dist/bin/dndev.js +1 -1
- package/dist/bin/donotdev.js +1 -1
- package/dist/index.js +2080 -2039
- package/package.json +1 -1
- package/templates/{root-consumer → deploy-config}/vercel.json.example +22 -13
- package/templates/app-vite/vercel.json.example +0 -11
- package/templates/overlay-supabase/vercel.headers.example +0 -23
- package/templates/overlay-supabase/vercel.json.example +0 -22
- /package/templates/{root-consumer → deploy-config}/.firebaserc.example +0 -0
- /package/templates/{root-consumer → deploy-config}/firebase.json.example +0 -0
- /package/templates/{root-consumer → deploy-config}/firestore.indexes.json.example +0 -0
- /package/templates/{root-consumer → deploy-config}/firestore.rules.example +0 -0
- /package/templates/{root-consumer → deploy-config}/storage.rules.example +0 -0
- /package/templates/{root-consumer → deploy-config}/tsconfig.functions.json.example +0 -0
package/dependencies-matrix.json
CHANGED
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"@donotdev/components": {
|
|
30
30
|
"description": "UI components package",
|
|
31
31
|
"packages": {
|
|
32
|
-
"@donotdev/components": "^0.0.
|
|
32
|
+
"@donotdev/components": "^0.0.31"
|
|
33
33
|
}
|
|
34
34
|
},
|
|
35
35
|
"@donotdev/core": {
|
|
@@ -423,7 +423,7 @@
|
|
|
423
423
|
"@donotdev/cli": {
|
|
424
424
|
"description": "Cli package",
|
|
425
425
|
"packages": {
|
|
426
|
-
"@donotdev/cli": "^0.0.
|
|
426
|
+
"@donotdev/cli": "^0.0.36"
|
|
427
427
|
}
|
|
428
428
|
},
|
|
429
429
|
"@donotdev/mcp-server": {
|
|
@@ -8043,7 +8043,32 @@ init_cli_output();
|
|
|
8043
8043
|
init_errors();
|
|
8044
8044
|
init_pathResolver();
|
|
8045
8045
|
init_typed_file_operations();
|
|
8046
|
-
import { spawnSync, execSync } from "node:child_process";
|
|
8046
|
+
import { spawnSync as spawnSync2, execSync } from "node:child_process";
|
|
8047
|
+
|
|
8048
|
+
// packages/tooling/src/apps/deploy-utils.ts
|
|
8049
|
+
init_utils();
|
|
8050
|
+
import { spawnSync } from "node:child_process";
|
|
8051
|
+
init_pathResolver();
|
|
8052
|
+
function checkConfigPlaceholders(appDir) {
|
|
8053
|
+
const CONFIG_FILES = ["vercel.json", "firebase.json", ".firebaserc"];
|
|
8054
|
+
const bad = [];
|
|
8055
|
+
for (const file of CONFIG_FILES) {
|
|
8056
|
+
const filePath = joinPath(appDir, file);
|
|
8057
|
+
if (!pathExists(filePath)) continue;
|
|
8058
|
+
const content = readSync(filePath, { format: "text" });
|
|
8059
|
+
if (typeof content === "string" && (content.includes("{{") || content.includes("}}"))) {
|
|
8060
|
+
bad.push(file);
|
|
8061
|
+
}
|
|
8062
|
+
}
|
|
8063
|
+
if (bad.length > 0) {
|
|
8064
|
+
log.warn(`Unreplaced template placeholders found in: ${bad.join(", ")}`);
|
|
8065
|
+
log.warn(` Fix manually or re-run "dndev init" to regenerate.
|
|
8066
|
+
`);
|
|
8067
|
+
}
|
|
8068
|
+
return bad.length > 0;
|
|
8069
|
+
}
|
|
8070
|
+
|
|
8071
|
+
// packages/tooling/src/apps/build.ts
|
|
8047
8072
|
function validateFirebaseJson(appDir) {
|
|
8048
8073
|
const firebaseJsonPath = joinPath(appDir, "firebase.json");
|
|
8049
8074
|
if (!pathExists(firebaseJsonPath)) {
|
|
@@ -8124,6 +8149,7 @@ async function main() {
|
|
|
8124
8149
|
return 1;
|
|
8125
8150
|
}
|
|
8126
8151
|
const appDir = app.path;
|
|
8152
|
+
checkConfigPlaceholders(appDir);
|
|
8127
8153
|
const firebaseConfig = validateFirebaseJson(appDir);
|
|
8128
8154
|
const hasFunctions = app.hasFunctions || firebaseConfig.hasFunctions;
|
|
8129
8155
|
const hasFrontend = app.framework !== "unknown";
|
|
@@ -8182,7 +8208,7 @@ async function main() {
|
|
|
8182
8208
|
...process.env,
|
|
8183
8209
|
DNDEV_APP_ROOT: app.path
|
|
8184
8210
|
};
|
|
8185
|
-
const result =
|
|
8211
|
+
const result = spawnSync2("bunx", ["turbo", ...turboArgs], {
|
|
8186
8212
|
stdio: "inherit",
|
|
8187
8213
|
env,
|
|
8188
8214
|
cwd: projectRoot
|
|
@@ -8937,7 +8937,10 @@ async function createApp(appName, appConfig, workspaceRoot, templatesRoot) {
|
|
|
8937
8937
|
backendPlatform,
|
|
8938
8938
|
isFirebase: backendPlatform === "firebase",
|
|
8939
8939
|
isSupabase: backendPlatform === "supabase",
|
|
8940
|
-
isVercel: backendPlatform === "vercel"
|
|
8940
|
+
isVercel: backendPlatform === "vercel",
|
|
8941
|
+
needsAuth: appConfig.userAuth !== "none",
|
|
8942
|
+
needsBilling: appConfig.billing,
|
|
8943
|
+
needsOAuth: appConfig.userAuth === "social" || appConfig.userAuth === "full-social"
|
|
8941
8944
|
};
|
|
8942
8945
|
const templateSourceDir = joinPath(templatesRoot, templateDir);
|
|
8943
8946
|
const templateFiles = await glob("**/*", {
|
|
@@ -8968,8 +8971,6 @@ async function createApp(appName, appConfig, workspaceRoot, templatesRoot) {
|
|
|
8968
8971
|
});
|
|
8969
8972
|
for (const file of overlayFiles) {
|
|
8970
8973
|
if (file.startsWith("env.fragment")) continue;
|
|
8971
|
-
if (file === "vercel.headers.example") continue;
|
|
8972
|
-
if (file === "vercel.json.example") continue;
|
|
8973
8974
|
if (file === "src/config/providers.ts.example") {
|
|
8974
8975
|
const variantFile = `src/config/providers.${appTemplate}.ts.example`;
|
|
8975
8976
|
if (overlayFiles.includes(variantFile)) continue;
|
|
@@ -9006,32 +9007,6 @@ async function createApp(appName, appConfig, workspaceRoot, templatesRoot) {
|
|
|
9006
9007
|
const fragment = readSync(fragmentPath);
|
|
9007
9008
|
await write(envPath, baseEnv + "\n" + fragment, { overwrite: true });
|
|
9008
9009
|
}
|
|
9009
|
-
if (deployConfig === "vercel-supabase") {
|
|
9010
|
-
const vercelPath = joinPath(appDir, "vercel.json");
|
|
9011
|
-
const headersFragmentPath = joinPath(
|
|
9012
|
-
overlayDir,
|
|
9013
|
-
"vercel.headers.example"
|
|
9014
|
-
);
|
|
9015
|
-
const fullVercelPath = joinPath(overlayDir, "vercel.json.example");
|
|
9016
|
-
if (pathExists(vercelPath) && pathExists(headersFragmentPath)) {
|
|
9017
|
-
const vercelJson = readSync(vercelPath, { format: "json" });
|
|
9018
|
-
const headersFragment = readSync(headersFragmentPath, {
|
|
9019
|
-
format: "json"
|
|
9020
|
-
});
|
|
9021
|
-
vercelJson.headers = [
|
|
9022
|
-
...vercelJson.headers ?? [],
|
|
9023
|
-
...headersFragment
|
|
9024
|
-
];
|
|
9025
|
-
await write(vercelPath, vercelJson, {
|
|
9026
|
-
format: "json",
|
|
9027
|
-
overwrite: true
|
|
9028
|
-
});
|
|
9029
|
-
} else if (pathExists(fullVercelPath)) {
|
|
9030
|
-
await copy(fullVercelPath, vercelPath);
|
|
9031
|
-
if (await isTextFile(vercelPath))
|
|
9032
|
-
await replacePlaceholders(vercelPath, replacements);
|
|
9033
|
-
}
|
|
9034
|
-
}
|
|
9035
9010
|
}
|
|
9036
9011
|
}
|
|
9037
9012
|
const executionMode = detectExecutionMode();
|
|
@@ -9101,7 +9076,7 @@ async function createApp(appName, appConfig, workspaceRoot, templatesRoot) {
|
|
|
9101
9076
|
}
|
|
9102
9077
|
}
|
|
9103
9078
|
}
|
|
9104
|
-
const deploymentTemplateDir = joinPath(templatesRoot, "
|
|
9079
|
+
const deploymentTemplateDir = joinPath(templatesRoot, "deploy-config");
|
|
9105
9080
|
if (deployConfig === "firebase") {
|
|
9106
9081
|
const firebaseJsonSource = joinPath(
|
|
9107
9082
|
deploymentTemplateDir,
|
|
@@ -9213,7 +9188,7 @@ async function createApp(appName, appConfig, workspaceRoot, templatesRoot) {
|
|
|
9213
9188
|
}
|
|
9214
9189
|
}
|
|
9215
9190
|
}
|
|
9216
|
-
if (deployConfig === "vercel-vercel") {
|
|
9191
|
+
if (deployConfig === "vercel-supabase" || deployConfig === "vercel-vercel") {
|
|
9217
9192
|
const vercelJsonSource = joinPath(
|
|
9218
9193
|
deploymentTemplateDir,
|
|
9219
9194
|
"vercel.json.example"
|
|
@@ -9258,7 +9258,10 @@ async function createApp(appName, appConfig, workspaceRoot, templatesRoot) {
|
|
|
9258
9258
|
backendPlatform,
|
|
9259
9259
|
isFirebase: backendPlatform === "firebase",
|
|
9260
9260
|
isSupabase: backendPlatform === "supabase",
|
|
9261
|
-
isVercel: backendPlatform === "vercel"
|
|
9261
|
+
isVercel: backendPlatform === "vercel",
|
|
9262
|
+
needsAuth: appConfig.userAuth !== "none",
|
|
9263
|
+
needsBilling: appConfig.billing,
|
|
9264
|
+
needsOAuth: appConfig.userAuth === "social" || appConfig.userAuth === "full-social"
|
|
9262
9265
|
};
|
|
9263
9266
|
const templateSourceDir = joinPath(templatesRoot, templateDir);
|
|
9264
9267
|
const templateFiles = await glob("**/*", {
|
|
@@ -9289,8 +9292,6 @@ async function createApp(appName, appConfig, workspaceRoot, templatesRoot) {
|
|
|
9289
9292
|
});
|
|
9290
9293
|
for (const file of overlayFiles) {
|
|
9291
9294
|
if (file.startsWith("env.fragment")) continue;
|
|
9292
|
-
if (file === "vercel.headers.example") continue;
|
|
9293
|
-
if (file === "vercel.json.example") continue;
|
|
9294
9295
|
if (file === "src/config/providers.ts.example") {
|
|
9295
9296
|
const variantFile = `src/config/providers.${appTemplate}.ts.example`;
|
|
9296
9297
|
if (overlayFiles.includes(variantFile)) continue;
|
|
@@ -9327,32 +9328,6 @@ async function createApp(appName, appConfig, workspaceRoot, templatesRoot) {
|
|
|
9327
9328
|
const fragment = readSync(fragmentPath);
|
|
9328
9329
|
await write(envPath, baseEnv + "\n" + fragment, { overwrite: true });
|
|
9329
9330
|
}
|
|
9330
|
-
if (deployConfig === "vercel-supabase") {
|
|
9331
|
-
const vercelPath = joinPath(appDir, "vercel.json");
|
|
9332
|
-
const headersFragmentPath = joinPath(
|
|
9333
|
-
overlayDir,
|
|
9334
|
-
"vercel.headers.example"
|
|
9335
|
-
);
|
|
9336
|
-
const fullVercelPath = joinPath(overlayDir, "vercel.json.example");
|
|
9337
|
-
if (pathExists(vercelPath) && pathExists(headersFragmentPath)) {
|
|
9338
|
-
const vercelJson = readSync(vercelPath, { format: "json" });
|
|
9339
|
-
const headersFragment = readSync(headersFragmentPath, {
|
|
9340
|
-
format: "json"
|
|
9341
|
-
});
|
|
9342
|
-
vercelJson.headers = [
|
|
9343
|
-
...vercelJson.headers ?? [],
|
|
9344
|
-
...headersFragment
|
|
9345
|
-
];
|
|
9346
|
-
await write(vercelPath, vercelJson, {
|
|
9347
|
-
format: "json",
|
|
9348
|
-
overwrite: true
|
|
9349
|
-
});
|
|
9350
|
-
} else if (pathExists(fullVercelPath)) {
|
|
9351
|
-
await copy(fullVercelPath, vercelPath);
|
|
9352
|
-
if (await isTextFile(vercelPath))
|
|
9353
|
-
await replacePlaceholders(vercelPath, replacements);
|
|
9354
|
-
}
|
|
9355
|
-
}
|
|
9356
9331
|
}
|
|
9357
9332
|
}
|
|
9358
9333
|
const executionMode = detectExecutionMode();
|
|
@@ -9422,7 +9397,7 @@ async function createApp(appName, appConfig, workspaceRoot, templatesRoot) {
|
|
|
9422
9397
|
}
|
|
9423
9398
|
}
|
|
9424
9399
|
}
|
|
9425
|
-
const deploymentTemplateDir = joinPath(templatesRoot, "
|
|
9400
|
+
const deploymentTemplateDir = joinPath(templatesRoot, "deploy-config");
|
|
9426
9401
|
if (deployConfig === "firebase") {
|
|
9427
9402
|
const firebaseJsonSource = joinPath(
|
|
9428
9403
|
deploymentTemplateDir,
|
|
@@ -9534,7 +9509,7 @@ async function createApp(appName, appConfig, workspaceRoot, templatesRoot) {
|
|
|
9534
9509
|
}
|
|
9535
9510
|
}
|
|
9536
9511
|
}
|
|
9537
|
-
if (deployConfig === "vercel-vercel") {
|
|
9512
|
+
if (deployConfig === "vercel-supabase" || deployConfig === "vercel-vercel") {
|
|
9538
9513
|
const vercelJsonSource = joinPath(
|
|
9539
9514
|
deploymentTemplateDir,
|
|
9540
9515
|
"vercel.json.example"
|
|
@@ -9635,7 +9610,7 @@ function detectExecutionMode2() {
|
|
|
9635
9610
|
}
|
|
9636
9611
|
return "published";
|
|
9637
9612
|
}
|
|
9638
|
-
async function main(
|
|
9613
|
+
async function main(_options, name) {
|
|
9639
9614
|
try {
|
|
9640
9615
|
Ie("\u{1F680} DoNotDev Project Creator");
|
|
9641
9616
|
try {
|
|
@@ -9655,7 +9630,7 @@ async function main(options) {
|
|
|
9655
9630
|
const executionMode = detectExecutionMode2();
|
|
9656
9631
|
const monorepoRoot = process.cwd();
|
|
9657
9632
|
const templatesRoot = getTemplatesRoot();
|
|
9658
|
-
let projectName =
|
|
9633
|
+
let projectName = name || "";
|
|
9659
9634
|
while (!projectName) {
|
|
9660
9635
|
const projectNameInput = await askForInput("Project name", "my-project");
|
|
9661
9636
|
if (!isValidFileName(projectNameInput)) {
|
|
@@ -9919,13 +9894,6 @@ async function main(options) {
|
|
|
9919
9894
|
supabase: hasSupabase,
|
|
9920
9895
|
stripe: hasBilling
|
|
9921
9896
|
};
|
|
9922
|
-
const firebaseRootFiles = /* @__PURE__ */ new Set([
|
|
9923
|
-
"firebase.json.example",
|
|
9924
|
-
".firebaserc.example",
|
|
9925
|
-
"firestore.rules.example",
|
|
9926
|
-
"firestore.indexes.json.example",
|
|
9927
|
-
"storage.rules.example"
|
|
9928
|
-
]);
|
|
9929
9897
|
const files = await glob("**/*", {
|
|
9930
9898
|
cwd: rootTemplateDir,
|
|
9931
9899
|
dot: true,
|
|
@@ -9933,7 +9901,6 @@ async function main(options) {
|
|
|
9933
9901
|
});
|
|
9934
9902
|
for (const file of files) {
|
|
9935
9903
|
if (file === "package.json.example") continue;
|
|
9936
|
-
if (firebaseRootFiles.has(file)) continue;
|
|
9937
9904
|
const sourcePath = joinPath(rootTemplateDir, file);
|
|
9938
9905
|
let destFileName = file;
|
|
9939
9906
|
if (destFileName.endsWith(".example")) {
|