Skip to content

Commit df3ca7f

Browse files
authored
feat(create): label Solid 2.0 as stable and preselect it (#94)
1 parent 443b022 commit df3ca7f

4 files changed

Lines changed: 20 additions & 6 deletions

File tree

‎.changeset/solid-2-stable.md‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"create-solid": minor
3+
"@solid-cli/create": minor
4+
---
5+
6+
Solid 2.0 is stable: the project picker now labels it "Solid 2.0" instead of "Solid 2.0 (RC)" and preselects it instead of SolidStart (Solid 1.x).

‎packages/create/src/index.ts‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import { readFile, writeFile } from "node:fs/promises";
2424
export { createVanilla, createStart, createLibrary, createSolidV2 };
2525

2626
const PROJECT_TYPE_LABELS: Record<ProjectType, string> = {
27-
solid: "Solid 2.0 (RC)",
27+
solid: "Solid 2.0",
2828
start: "SolidStart (Solid 1.x)",
2929
vanilla: "SolidJS + Vite (Solid 1.x)",
3030
library: "Library",
@@ -148,8 +148,7 @@ export const createSolid = (version: string) =>
148148
projectType ??= await cancelable(
149149
p.select({
150150
message: "What type of project would you like to create?",
151-
// Solid 2.0 is listed first but not preselected while core is a release candidate
152-
initialValue: "start",
151+
initialValue: "solid",
153152
options: PROJECT_TYPES.map((t) => ({
154153
value: t,
155154
label: PROJECT_TYPE_LABELS[t],

‎packages/create/src/utils/constants.ts‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,6 @@ export const START_DEVTOOLS_VERSION = "^1.0.0-next.4";
143143
export const LIBRARY_TEMPLATES = ["solid-lib-starter"] as const satisfies string[];
144144
export type LibraryTemplate = (typeof LIBRARY_TEMPLATES)[number];
145145

146-
// "solid" (Solid 2.0) is listed first, but "start" remains the preselected
147-
// default while Solid 2.0 core is a release candidate
148146
export const PROJECT_TYPES = ["solid", "start", "vanilla", "library"] as const satisfies string[];
149147
export type ProjectType = (typeof PROJECT_TYPES)[number];
150148

‎packages/create/tests/cli.test.ts‎

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
import { runCommand } from "citty";
22
import { afterEach, beforeEach, expect, it, vi } from "vitest";
33

4-
const { autocomplete } = vi.hoisted(() => ({ autocomplete: vi.fn() }));
4+
const { autocomplete, select } = vi.hoisted(() => ({ autocomplete: vi.fn(), select: vi.fn() }));
55

66
vi.mock("@clack/prompts", async (importOriginal) => ({
77
...(await importOriginal<typeof import("@clack/prompts")>()),
88
autocomplete,
9+
select,
910
}));
1011

1112
import { createSolid } from "../src";
@@ -54,3 +55,13 @@ it("uses an autocomplete prompt when selecting a template", async () => {
5455
expect(validate(undefined)).toEqual(expect.any(String));
5556
expect(validate("with-auth")).toBeUndefined();
5657
});
58+
59+
it("preselects Solid 2.0 as the project type", async () => {
60+
select.mockResolvedValueOnce(undefined);
61+
62+
await runCommand(createSolid("test"), { rawArgs: ["test-app"] });
63+
64+
const { initialValue, options } = select.mock.calls[0][0];
65+
expect(initialValue).toBe("solid");
66+
expect(options[0]).toEqual({ value: "solid", label: "Solid 2.0" });
67+
});

0 commit comments

Comments
 (0)