Skip to content

Commit ef8e281

Browse files
fix(cli): remove wrangler support
1 parent 207c2fd commit ef8e281

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+160
-1038
lines changed

apps/cli/src/helpers/core/create-readme.ts

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -540,7 +540,7 @@ function generateDatabaseSetup(
540540
packageManagerRunCmd: string,
541541
orm: ORM,
542542
dbSetup: DatabaseSetup,
543-
serverDeploy?: string,
543+
_serverDeploy?: string,
544544
backend?: string,
545545
) {
546546
if (database === "none") {
@@ -565,9 +565,7 @@ function generateDatabaseSetup(
565565
1. Start the local SQLite database:
566566
${
567567
dbSetup === "d1"
568-
? serverDeploy === "alchemy"
569-
? "D1 local development and migrations are handled automatically by Alchemy during dev and deploy."
570-
: "Local development for a Cloudflare D1 database will already be running as part of the `wrangler dev` command."
568+
? "D1 local development and migrations are handled automatically by Alchemy during dev and deploy."
571569
: `\`\`\`bash
572570
cd ${dbLocalPath} && ${packageManagerRunCmd} db:local
573571
\`\`\`
@@ -765,18 +763,5 @@ function generateDeploymentCommands(
765763
}
766764
}
767765

768-
if (webDeploy === "wrangler" || serverDeploy === "wrangler") {
769-
lines.push("\n## Deployment (Cloudflare Wrangler)");
770-
if (webDeploy === "wrangler") {
771-
lines.push(`- Web deploy: cd apps/web && ${packageManagerRunCmd} deploy`);
772-
}
773-
if (serverDeploy === "wrangler") {
774-
lines.push(
775-
`- Server dev: cd apps/server && ${packageManagerRunCmd} dev`,
776-
`- Server deploy: cd apps/server && ${packageManagerRunCmd} deploy`,
777-
);
778-
}
779-
}
780-
781766
return lines.length ? `\n${lines.join("\n")}\n` : "";
782767
}

apps/cli/src/helpers/core/env-setup.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -356,8 +356,6 @@ ${hasWeb ? "# npx convex env set SITE_URL http://localhost:3001\n" : ""}
356356
case "sqlite":
357357
if (
358358
config.runtime === "workers" ||
359-
webDeploy === "wrangler" ||
360-
serverDeploy === "wrangler" ||
361359
webDeploy === "alchemy" ||
362360
serverDeploy === "alchemy"
363361
) {

apps/cli/src/helpers/core/post-installation.ts

Lines changed: 3 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -77,12 +77,6 @@ export async function displayPostInstallInstructions(
7777
config.payments === "polar" && config.auth === "better-auth"
7878
? getPolarInstructions(backend)
7979
: "";
80-
const wranglerDeployInstructions = getWranglerDeployInstructions(
81-
runCmd,
82-
webDeploy,
83-
serverDeploy,
84-
backend,
85-
);
8680
const alchemyDeployInstructions = getAlchemyDeployInstructions(
8781
runCmd,
8882
webDeploy,
@@ -127,10 +121,7 @@ export async function displayPostInstallInstructions(
127121
if (
128122
database === "sqlite" &&
129123
dbSetup === "none" &&
130-
(serverDeploy === "wrangler" ||
131-
serverDeploy === "alchemy" ||
132-
webDeploy === "wrangler" ||
133-
webDeploy === "alchemy")
124+
(serverDeploy === "alchemy" || webDeploy === "alchemy")
134125
) {
135126
output += `${pc.cyan(`${stepCounter++}.`)} ${runCmd} db:local\n${pc.dim(
136127
" (starts local SQLite server for Workers compatibility)",
@@ -162,9 +153,6 @@ export async function displayPostInstallInstructions(
162153
)} Complete D1 database setup first\n (see Database commands below)\n`;
163154
}
164155
output += `${pc.cyan(`${stepCounter++}.`)} ${runCmd} dev\n`;
165-
if (serverDeploy === "wrangler") {
166-
output += `${pc.cyan(`${stepCounter++}.`)} cd apps/server && ${runCmd} cf-typegen\n`;
167-
}
168156
}
169157
}
170158

@@ -203,8 +191,6 @@ export async function displayPostInstallInstructions(
203191
if (tauriInstructions) output += `\n${tauriInstructions.trim()}\n`;
204192
if (lintingInstructions) output += `\n${lintingInstructions.trim()}\n`;
205193
if (pwaInstructions) output += `\n${pwaInstructions.trim()}\n`;
206-
if (wranglerDeployInstructions)
207-
output += `\n${wranglerDeployInstructions.trim()}\n`;
208194
if (alchemyDeployInstructions)
209195
output += `\n${alchemyDeployInstructions.trim()}\n`;
210196
if (starlightInstructions) output += `\n${starlightInstructions.trim()}\n`;
@@ -261,10 +247,10 @@ async function getDatabaseInstructions(
261247
database: Database,
262248
orm?: ORM,
263249
runCmd?: string,
264-
runtime?: Runtime,
250+
_runtime?: Runtime,
265251
dbSetup?: DatabaseSetup,
266252
serverDeploy?: string,
267-
backend?: string,
253+
_backend?: string,
268254
) {
269255
const instructions: string[] = [];
270256

@@ -277,49 +263,6 @@ async function getDatabaseInstructions(
277263
}
278264
}
279265

280-
if (serverDeploy === "wrangler" && dbSetup === "d1") {
281-
if (orm === "prisma" && runtime === "workers") {
282-
instructions.push(
283-
`\n${pc.yellow(
284-
"WARNING:",
285-
)} Prisma + D1 on Workers with Wrangler has migration issues.\n Consider using Alchemy deploy instead of Wrangler for D1 projects.\n`,
286-
);
287-
}
288-
const packageManager = runCmd === "npm run" ? "npm" : runCmd || "npm";
289-
290-
instructions.push(
291-
`${pc.cyan("1.")} Login to Cloudflare: ${pc.white(
292-
`${packageManager} wrangler login`,
293-
)}`,
294-
);
295-
instructions.push(
296-
`${pc.cyan("2.")} Create D1 database: ${pc.white(
297-
`${packageManager} wrangler d1 create your-database-name`,
298-
)}`,
299-
);
300-
const wranglerPath = backend === "self" ? "apps/web" : "apps/server";
301-
instructions.push(
302-
`${pc.cyan(
303-
"3.",
304-
)} Update ${wranglerPath}/wrangler.jsonc with database_id and database_name`,
305-
);
306-
instructions.push(
307-
`${pc.cyan("4.")} Generate migrations: ${pc.white(
308-
`cd ${wranglerPath} && ${runCmd} db:generate`,
309-
)}`,
310-
);
311-
instructions.push(
312-
`${pc.cyan("5.")} Apply migrations locally: ${pc.white(
313-
`${packageManager} wrangler d1 migrations apply YOUR_DB_NAME --local`,
314-
)}`,
315-
);
316-
instructions.push(
317-
`${pc.cyan("6.")} Apply migrations to production: ${pc.white(
318-
`${packageManager} wrangler d1 migrations apply YOUR_DB_NAME`,
319-
)}`,
320-
);
321-
}
322-
323266
if (dbSetup === "d1" && serverDeploy === "alchemy") {
324267
if (orm === "drizzle") {
325268
instructions.push(
@@ -442,29 +385,6 @@ function getBunWebNativeWarning() {
442385
)} 'bun' might cause issues with web + native apps in a monorepo.\n Use 'pnpm' if problems arise.`;
443386
}
444387

445-
function getWranglerDeployInstructions(
446-
runCmd?: string,
447-
webDeploy?: string,
448-
serverDeploy?: string,
449-
backend?: string,
450-
) {
451-
const instructions: string[] = [];
452-
453-
if (webDeploy === "wrangler") {
454-
const deployPath = backend === "self" ? "apps/web" : "apps/web";
455-
instructions.push(
456-
`${pc.bold("Deploy web to Cloudflare Workers:")}\n${pc.cyan("•")} Deploy: ${`cd ${deployPath} && ${runCmd} deploy`}`,
457-
);
458-
}
459-
if (serverDeploy === "wrangler" && backend !== "self") {
460-
instructions.push(
461-
`${pc.bold("Deploy server to Cloudflare Workers:")}\n${pc.cyan("•")} Deploy: ${`cd apps/server && ${runCmd} deploy`}`,
462-
);
463-
}
464-
465-
return instructions.length ? `\n${instructions.join("\n")}` : "";
466-
}
467-
468388
function getClerkInstructions() {
469389
return `${pc.bold("Clerk Authentication Setup:")}\n${pc.cyan("•")} Follow the guide: ${pc.underline("https://docs.convex.dev/auth/clerk")}\n${pc.cyan("•")} Set CLERK_JWT_ISSUER_DOMAIN in Convex Dashboard\n${pc.cyan("•")} Set CLERK_PUBLISHABLE_KEY in apps/*/.env`;
470390
}

apps/cli/src/helpers/database-providers/d1-setup.ts

Lines changed: 1 addition & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -6,37 +6,7 @@ import { addEnvVariablesToFile, type EnvVariable } from "../core/env-setup";
66
export async function setupCloudflareD1(config: ProjectConfig) {
77
const { projectDir, serverDeploy, orm, backend } = config;
88

9-
if (serverDeploy === "wrangler") {
10-
const targetApp = backend === "self" ? "apps/web" : "apps/server";
11-
const envPath = path.join(projectDir, targetApp, ".env");
12-
13-
const variables: EnvVariable[] = [
14-
{
15-
key: "CLOUDFLARE_ACCOUNT_ID",
16-
value: "",
17-
condition: true,
18-
},
19-
{
20-
key: "CLOUDFLARE_DATABASE_ID",
21-
value: "",
22-
condition: true,
23-
},
24-
{
25-
key: "CLOUDFLARE_D1_TOKEN",
26-
value: "",
27-
condition: true,
28-
},
29-
];
30-
31-
try {
32-
await addEnvVariablesToFile(envPath, variables);
33-
} catch (_err) {}
34-
}
35-
36-
if (
37-
(serverDeploy === "wrangler" || serverDeploy === "alchemy") &&
38-
orm === "prisma"
39-
) {
9+
if (serverDeploy === "alchemy" && orm === "prisma") {
4010
const targetApp2 = backend === "self" ? "apps/web" : "apps/server";
4111
const envPath = path.join(projectDir, targetApp2, ".env");
4212
const variables: EnvVariable[] = [

apps/cli/src/helpers/deployment/alchemy/alchemy-combined-setup.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ export async function setupCombinedAlchemyDeploy(
3636

3737
const serverDir = path.join(projectDir, "apps/server");
3838
if (await fs.pathExists(serverDir)) {
39-
await setupAlchemyServerDeploy(serverDir, packageManager, projectDir);
39+
await setupAlchemyServerDeploy(serverDir, projectDir);
4040
}
4141

4242
const frontend = config.frontend;

apps/cli/src/helpers/deployment/server-deploy-setup.ts

Lines changed: 3 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,10 @@
11
import path from "node:path";
2-
import { log, spinner } from "@clack/prompts";
3-
import { execa } from "execa";
42
import fs from "fs-extra";
5-
import pc from "picocolors";
6-
import type { PackageManager, ProjectConfig } from "../../types";
3+
import type { ProjectConfig } from "../../types";
74
import { addPackageDependency } from "../../utils/add-package-deps";
8-
import { getPackageExecutionCommand } from "../../utils/package-runner";
95

106
export async function setupServerDeploy(config: ProjectConfig) {
117
const { serverDeploy, webDeploy, projectDir } = config;
12-
const { packageManager } = config;
138

149
if (serverDeploy === "none") return;
1510

@@ -20,69 +15,13 @@ export async function setupServerDeploy(config: ProjectConfig) {
2015
const serverDir = path.join(projectDir, "apps/server");
2116
if (!(await fs.pathExists(serverDir))) return;
2217

23-
if (serverDeploy === "wrangler") {
24-
await setupWorkersServerDeploy(serverDir, packageManager);
25-
await generateCloudflareWorkerTypes({ serverDir, packageManager });
26-
} else if (serverDeploy === "alchemy") {
27-
await setupAlchemyServerDeploy(serverDir, packageManager, projectDir);
28-
}
29-
}
30-
31-
async function setupWorkersServerDeploy(
32-
serverDir: string,
33-
_packageManager: PackageManager,
34-
) {
35-
const packageJsonPath = path.join(serverDir, "package.json");
36-
if (!(await fs.pathExists(packageJsonPath))) return;
37-
38-
const packageJson = await fs.readJson(packageJsonPath);
39-
40-
packageJson.scripts = {
41-
...packageJson.scripts,
42-
dev: "wrangler dev --port=3000",
43-
start: "wrangler dev",
44-
deploy: "wrangler deploy",
45-
build: "wrangler deploy --dry-run",
46-
"cf-typegen": "wrangler types --env-interface CloudflareBindings",
47-
};
48-
49-
await fs.writeJson(packageJsonPath, packageJson, { spaces: 2 });
50-
51-
await addPackageDependency({
52-
devDependencies: ["wrangler", "@types/node"],
53-
projectDir: serverDir,
54-
});
55-
}
56-
57-
async function generateCloudflareWorkerTypes({
58-
serverDir,
59-
packageManager,
60-
}: {
61-
serverDir: string;
62-
packageManager: ProjectConfig["packageManager"];
63-
}) {
64-
if (!(await fs.pathExists(serverDir))) return;
65-
const s = spinner();
66-
try {
67-
s.start("Generating Cloudflare Workers types...");
68-
const runCmd = getPackageExecutionCommand(
69-
packageManager,
70-
"wrangler types --env-interface CloudflareBindings",
71-
);
72-
await execa(runCmd, { cwd: serverDir, shell: true });
73-
s.stop("Cloudflare Workers types generated successfully!");
74-
} catch {
75-
s.stop(pc.yellow("Failed to generate Cloudflare Workers types"));
76-
const managerCmd = `${packageManager} run`;
77-
log.warn(
78-
`Note: You can manually run 'cd apps/server && ${managerCmd} cf-typegen' in the project directory later`,
79-
);
18+
if (serverDeploy === "alchemy") {
19+
await setupAlchemyServerDeploy(serverDir, projectDir);
8020
}
8121
}
8222

8323
export async function setupAlchemyServerDeploy(
8424
serverDir: string,
85-
_packageManager: PackageManager,
8625
projectDir?: string,
8726
) {
8827
if (!(await fs.pathExists(serverDir))) return;

0 commit comments

Comments
 (0)