Skip to content

Commit 77e0cb7

Browse files
feat(cli): auto select framework according the the picked frontend in ultracite setup
1 parent b1ae473 commit 77e0cb7

File tree

1 file changed

+37
-3
lines changed

1 file changed

+37
-3
lines changed

apps/cli/src/helpers/addons/ultracite-setup.ts

Lines changed: 37 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ type UltraciteAgent =
3131
| "junie"
3232
| "augmentcode"
3333
| "kilo-code"
34-
| "goose";
34+
| "goose"
35+
| "roo-code";
3536

3637
const EDITORS = {
3738
vscode: {
@@ -94,10 +95,37 @@ const AGENTS = {
9495
goose: {
9596
label: "Goose",
9697
},
98+
"roo-code": {
99+
label: "Roo Code",
100+
},
97101
} as const;
98102

103+
function getFrameworksFromFrontend(frontend: string[]): string[] {
104+
const frameworkMap: Record<string, string> = {
105+
"tanstack-router": "react",
106+
"react-router": "react",
107+
"tanstack-start": "react",
108+
next: "next",
109+
nuxt: "vue",
110+
"native-nativewind": "react",
111+
"native-unistyles": "react",
112+
svelte: "svelte",
113+
solid: "solid",
114+
};
115+
116+
const frameworks = new Set<string>();
117+
118+
for (const f of frontend) {
119+
if (f !== "none" && frameworkMap[f]) {
120+
frameworks.add(frameworkMap[f]);
121+
}
122+
}
123+
124+
return Array.from(frameworks);
125+
}
126+
99127
export async function setupUltracite(config: ProjectConfig, hasHusky: boolean) {
100-
const { packageManager, projectDir } = config;
128+
const { packageManager, projectDir, frontend } = config;
101129

102130
try {
103131
log.info("Setting up Ultracite...");
@@ -135,7 +163,13 @@ export async function setupUltracite(config: ProjectConfig, hasHusky: boolean) {
135163
const editors = result.editors as UltraciteEditor[];
136164
const agents = result.agents as UltraciteAgent[];
137165

138-
const ultraciteArgs = ["init", "--pm", packageManager, "--frameworks", "react,next"];
166+
const frameworks = getFrameworksFromFrontend(frontend);
167+
168+
const ultraciteArgs = ["init", "--pm", packageManager];
169+
170+
if (frameworks.length > 0) {
171+
ultraciteArgs.push("--frameworks", ...frameworks);
172+
}
139173

140174
if (editors.length > 0) {
141175
ultraciteArgs.push("--editors", ...editors);

0 commit comments

Comments
 (0)