Skip to content

Commit fbfe7f5

Browse files
fix(cli): add @cloudflare/workers-types in root instead of packages when alchemy deploy
1 parent 28c82cf commit fbfe7f5

File tree

5 files changed

+30
-33
lines changed

5 files changed

+30
-33
lines changed

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

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -117,15 +117,8 @@ export async function setupAlchemyServerDeploy(
117117
}
118118

119119
async function addAlchemyPackagesDependencies(projectDir: string) {
120-
const packages = ["packages/api", "packages/auth", "packages/db"];
121-
122-
for (const packageName of packages) {
123-
const packageDir = path.join(projectDir, packageName);
124-
if (await fs.pathExists(packageDir)) {
125-
await addPackageDependency({
126-
devDependencies: ["@cloudflare/workers-types"],
127-
projectDir: packageDir,
128-
});
129-
}
130-
}
120+
await addPackageDependency({
121+
devDependencies: ["@cloudflare/workers-types"],
122+
projectDir,
123+
});
131124
}

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

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -98,15 +98,8 @@ async function setupWorkersWebDeploy(
9898
}
9999

100100
async function addAlchemyPackagesDependencies(projectDir: string) {
101-
const packages = ["packages/api", "packages/auth", "packages/db"];
102-
103-
for (const packageName of packages) {
104-
const packageDir = path.join(projectDir, packageName);
105-
if (await fs.pathExists(packageDir)) {
106-
await addPackageDependency({
107-
devDependencies: ["@cloudflare/workers-types"],
108-
projectDir: packageDir,
109-
});
110-
}
111-
}
101+
await addPackageDependency({
102+
devDependencies: ["@cloudflare/workers-types"],
103+
projectDir,
104+
});
112105
}

apps/cli/src/utils/config-validation.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -446,6 +446,16 @@ export function validateFullConfig(
446446
);
447447
}
448448

449+
if (
450+
providedFlags.has("serverDeploy") &&
451+
(config.serverDeploy === "alchemy" || config.serverDeploy === "wrangler") &&
452+
config.runtime !== "workers"
453+
) {
454+
exitWithError(
455+
`Server deployment '${config.serverDeploy}' requires '--runtime workers'. Please use '--runtime workers' or choose a different server deployment.`,
456+
);
457+
}
458+
449459
if (config.addons && config.addons.length > 0) {
450460
validateAddonsAgainstFrontends(config.addons, config.frontend, config.auth);
451461
config.addons = [...new Set(config.addons)];

apps/cli/templates/deploy/alchemy/alchemy.run.ts.hbs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ export const web = await Nextjs("web", {
5959
bindings: {
6060
{{#if (eq backend "convex")}}
6161
NEXT_PUBLIC_CONVEX_URL: process.env.NEXT_PUBLIC_CONVEX_URL || "",
62-
{{else}}
62+
{{else if (ne backend "self")}}
6363
NEXT_PUBLIC_SERVER_URL: process.env.NEXT_PUBLIC_SERVER_URL || "",
6464
{{/if}}
6565
},
@@ -73,7 +73,7 @@ export const web = await Nuxt("web", {
7373
bindings: {
7474
{{#if (eq backend "convex")}}
7575
NUXT_PUBLIC_CONVEX_URL: process.env.NUXT_PUBLIC_CONVEX_URL || "",
76-
{{else}}
76+
{{else if (ne backend "self")}}
7777
NUXT_PUBLIC_SERVER_URL: process.env.NUXT_PUBLIC_SERVER_URL || "",
7878
{{/if}}
7979
},
@@ -87,7 +87,7 @@ export const web = await SvelteKit("web", {
8787
bindings: {
8888
{{#if (eq backend "convex")}}
8989
PUBLIC_CONVEX_URL: process.env.PUBLIC_CONVEX_URL || "",
90-
{{else}}
90+
{{else if (ne backend "self")}}
9191
PUBLIC_SERVER_URL: process.env.PUBLIC_SERVER_URL || "",
9292
{{/if}}
9393
},
@@ -101,7 +101,7 @@ export const web = await TanStackStart("web", {
101101
bindings: {
102102
{{#if (eq backend "convex")}}
103103
VITE_CONVEX_URL: process.env.VITE_CONVEX_URL || "",
104-
{{else}}
104+
{{else if (ne backend "self")}}
105105
VITE_SERVER_URL: process.env.VITE_SERVER_URL || "",
106106
{{/if}}
107107
},
@@ -116,7 +116,7 @@ export const web = await Vite("web", {
116116
bindings: {
117117
{{#if (eq backend "convex")}}
118118
VITE_CONVEX_URL: process.env.VITE_CONVEX_URL || "",
119-
{{else}}
119+
{{else if (ne backend "self")}}
120120
VITE_SERVER_URL: process.env.VITE_SERVER_URL || "",
121121
{{/if}}
122122
},
@@ -130,7 +130,7 @@ export const web = await ReactRouter("web", {
130130
bindings: {
131131
{{#if (eq backend "convex")}}
132132
VITE_CONVEX_URL: process.env.VITE_CONVEX_URL || "",
133-
{{else}}
133+
{{else if (ne backend "self")}}
134134
VITE_SERVER_URL: process.env.VITE_SERVER_URL || "",
135135
{{/if}}
136136
},
@@ -145,7 +145,7 @@ export const web = await Vite("web", {
145145
bindings: {
146146
{{#if (eq backend "convex")}}
147147
VITE_CONVEX_URL: process.env.VITE_CONVEX_URL || "",
148-
{{else}}
148+
{{else if (ne backend "self")}}
149149
VITE_SERVER_URL: process.env.VITE_SERVER_URL || "",
150150
{{/if}}
151151
},

apps/web/src/app/(home)/_components/stats-section.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,7 @@ export default function StatsSection({
2323
lastUpdated: string | null;
2424
};
2525
}) {
26-
27-
// no idea why there are no types
26+
// no idea why there are no types
2827
// eslint-disable-next-line @typescript-eslint/no-explicit-any
2928
const githubRepo = useQuery((api as any).stats.getGithubRepo, {
3029
name: "AmanVarshney01/create-better-t-stack",
@@ -192,8 +191,10 @@ export default function StatsSection({
192191
<span className="font-mono text-foreground text-sm">
193192
{npmPackages?.dayOfWeekAverages
194193
? Math.round(
195-
npmPackages.dayOfWeekAverages.reduce((a: number, b: number) => a + b, 0) /
196-
7,
194+
npmPackages.dayOfWeekAverages.reduce(
195+
(a: number, b: number) => a + b,
196+
0,
197+
) / 7,
197198
)
198199
: "—"}
199200
</span>

0 commit comments

Comments
 (0)