Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/swift-pants-create.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"wrangler": patch
---

Use correctly-formatted names when displayed detected framework details
4 changes: 2 additions & 2 deletions packages/wrangler/src/__tests__/autoconfig/run.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ describe("autoconfig (deploy)", () => {
configured: false,
workerName: "my-worker",
framework: {
name: "fake",
name: "Fake",
configure: configureSpy,
} as unknown as Framework,
outputDir: "dist",
Expand All @@ -173,7 +173,7 @@ describe("autoconfig (deploy)", () => {
"
Detected Project Settings:
- Worker Name: my-worker
- Framework: fake
- Framework: Fake
- Build Command: echo 'built' > build.txt
- Output Directory: dist
Expand Down
2 changes: 1 addition & 1 deletion packages/wrangler/src/__tests__/setup.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ describe("wrangler setup", () => {

Detected Project Settings:
- Worker Name: <WORKER_NAME>
- Framework: static
- Framework: Static
- Output Directory: <cwd>/public


Expand Down
4 changes: 1 addition & 3 deletions packages/wrangler/src/autoconfig/details.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,7 @@ export async function getDetailsForAutoConfig({

const detectedFramework: Settings | undefined = buildSettings?.[0];

const framework: AutoConfigDetails["framework"] = getFramework(
detectedFramework?.framework.id
);
const framework = getFramework(detectedFramework?.framework);
const packageJsonPath = resolve(projectPath, "package.json");

let packageJson: PackageJSON | undefined;
Expand Down
2 changes: 0 additions & 2 deletions packages/wrangler/src/autoconfig/frameworks/astro.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ import type { ConfigurationOptions } from ".";
import type { RawConfig } from "@cloudflare/workers-utils";

export class Astro extends Framework {
name = "astro";

async configure({
outputDir,
dryRun,
Expand Down
20 changes: 12 additions & 8 deletions packages/wrangler/src/autoconfig/frameworks/get-framework.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
import { Astro } from "./astro";
import { Static } from "./static";
import { SvelteKit } from "./sveltekit";
import type { Framework } from ".";

export function getFramework(id: string) {
if (id === "astro") {
return new Astro();
export function getFramework(detectedFramework?: {
id: string;
name: string;
}): Framework {
switch (detectedFramework?.id) {
case "astro":
return new Astro(detectedFramework.name);
case "svelte-kit":
return new SvelteKit(detectedFramework.name);
default:
return new Static(detectedFramework?.name);
}
if (id === "svelte-kit") {
return new SvelteKit();
}

return new Static(id);
}
2 changes: 1 addition & 1 deletion packages/wrangler/src/autoconfig/frameworks/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export type ConfigurationOptions = {
dryRun: boolean;
};
export abstract class Framework {
abstract name: string;
constructor(public name: string = "Static") {}

// Override commands used to configure the project. Most frameworks should not need to do this, as their default detected build command will be sufficient
preview?: string; // default is `npm run build && wrangler dev`
Expand Down
6 changes: 0 additions & 6 deletions packages/wrangler/src/autoconfig/frameworks/static.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,6 @@ import type { ConfigurationOptions } from ".";
import type { RawConfig } from "@cloudflare/workers-utils";

export class Static extends Framework {
name: string;
constructor(name: string) {
super();
this.name = name ?? "static";
}

configure({
outputDir,
}: ConfigurationOptions): Promise<RawConfig> | RawConfig {
Expand Down
2 changes: 0 additions & 2 deletions packages/wrangler/src/autoconfig/frameworks/sveltekit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ import type { ConfigurationOptions } from ".";
import type { RawConfig } from "@cloudflare/workers-utils";

export class SvelteKit extends Framework {
name = "svelte-kit";

async configure({ dryRun }: ConfigurationOptions): Promise<RawConfig> {
const { dlx } = await getPackageManager();
if (!dryRun) {
Expand Down
3 changes: 1 addition & 2 deletions packages/wrangler/src/autoconfig/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { confirm } from "../dialogs";
import { logger } from "../logger";
import { sendMetricsEvent } from "../metrics";
import { getDevCompatibilityDate } from "../utils/compatibility-date";
import { capitalize } from "../utils/strings";
import { addWranglerToAssetsIgnore } from "./add-wrangler-assetsignore";
import { addWranglerToGitIgnore } from "./c3-vendor/add-wrangler-gitignore";
import { installWrangler } from "./c3-vendor/packages";
Expand Down Expand Up @@ -233,7 +232,7 @@ export async function buildOperationsSummary(
logger.log(
`🛠️ ${
autoConfigDetails.framework.configurationDescription ??
`Configuring project for ${capitalize(autoConfigDetails.framework.name)}`
`Configuring project for ${autoConfigDetails.framework.name}`
}`
);
logger.log("");
Expand Down
Loading