Skip to content

Commit bde8ef2

Browse files
C3: Error when an unsupported platform is specified for a framework (#10695)
1 parent 56cc3c6 commit bde8ef2

File tree

3 files changed

+22
-0
lines changed

3 files changed

+22
-0
lines changed

.changeset/neat-pets-laugh.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"create-cloudflare": patch
3+
---
4+
5+
Error when an unsupported platform is specified for a framework

packages/create-cloudflare/e2e/tests/cli/cli.test.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -634,6 +634,19 @@ describe("Create Cloudflare CLI", () => {
634634
}
635635
});
636636
});
637+
638+
test("error when trying to create a solid app on Pages", async ({
639+
logStream,
640+
}) => {
641+
const { errors } = await runC3(
642+
["--platform=pages", "--framework=solid", "my-app"],
643+
[],
644+
logStream,
645+
);
646+
expect(errors).toMatch(
647+
/Error: The .*? framework doesn't support the "pages" platform/,
648+
);
649+
});
637650
});
638651

639652
function normalizeOutput(output: string): string {

packages/create-cloudflare/src/templates.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -529,6 +529,10 @@ export const createContext = async (
529529
}
530530

531531
frameworkConfig = frameworkConfig.platformVariants[platform];
532+
} else if (args.platform && args.platform !== frameworkConfig.platform) {
533+
throw new Error(
534+
`The ${frameworkConfig.displayName} framework doesn't support the "${args.platform}" platform`,
535+
);
532536
}
533537

534538
template = {

0 commit comments

Comments
 (0)