Skip to content

Commit 12dd546

Browse files
committed
refactor: migrate from CRA to Vite and improve testing
Replace Create React App with Vite build system Add ESLint configuration and improve TypeScript types Create VSCode UI component mocks for better testing Update test files with proper async handling Add Tailwind CSS integration Fix accessibility by adding ARIA roles
1 parent 4026a87 commit 12dd546

File tree

20 files changed

+11173
-16230
lines changed

20 files changed

+11173
-16230
lines changed

src/core/webview/ClineProvider.ts

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -409,15 +409,9 @@ export class ClineProvider implements vscode.WebviewViewProvider {
409409
// then convert it to a uri we can use in the webview.
410410

411411
// The CSS file from the React build output
412-
const stylesUri = getUri(webview, this.context.extensionUri, [
413-
"webview-ui",
414-
"build",
415-
"static",
416-
"css",
417-
"main.css",
418-
])
412+
const stylesUri = getUri(webview, this.context.extensionUri, ["webview-ui", "build", "assets", "index.css"])
419413
// The JS file from the React build output
420-
const scriptUri = getUri(webview, this.context.extensionUri, ["webview-ui", "build", "static", "js", "main.js"])
414+
const scriptUri = getUri(webview, this.context.extensionUri, ["webview-ui", "build", "assets", "index.js"])
421415

422416
// The codicon font from the React build output
423417
// https://github.com/microsoft/vscode-extension-samples/blob/main/webview-codicons-sample/src/extension.ts
@@ -2180,7 +2174,7 @@ export class ClineProvider implements vscode.WebviewViewProvider {
21802174
this.getGlobalState("autoApprovalEnabled") as Promise<boolean | undefined>,
21812175
this.customModesManager.getCustomModes(),
21822176
this.getGlobalState("experiments") as Promise<Record<ExperimentId, boolean> | undefined>,
2183-
this.getSecret("unboundApiKey") as Promise<string | undefined>,
2177+
this.getSecret("unboundApiKey") as Promise<string | undefined>,
21842178
this.getGlobalState("unboundModelId") as Promise<string | undefined>,
21852179
])
21862180

webview-ui/.eslintrc.json

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
{
2+
"root": true,
3+
"extends": [
4+
"eslint:recommended",
5+
"plugin:react/recommended",
6+
"plugin:@typescript-eslint/recommended",
7+
"plugin:react-hooks/recommended"
8+
],
9+
"parser": "@typescript-eslint/parser",
10+
"plugins": ["react", "@typescript-eslint", "react-hooks"],
11+
"rules": {
12+
"react/react-in-jsx-scope": "off",
13+
"@typescript-eslint/explicit-module-boundary-types": "off",
14+
"@typescript-eslint/no-explicit-any": "warn",
15+
"react/display-name": "warn",
16+
"no-case-declarations": "warn",
17+
"react/no-unescaped-entities": "warn",
18+
"react/jsx-key": "warn",
19+
"no-extra-semi": "warn",
20+
"@typescript-eslint/no-var-requires": "warn",
21+
"@typescript-eslint/no-unused-vars": [
22+
"warn",
23+
{
24+
"argsIgnorePattern": "^_",
25+
"varsIgnorePattern": "^_",
26+
"caughtErrorsIgnorePattern": "^_"
27+
}
28+
]
29+
},
30+
"settings": {
31+
"react": {
32+
"version": "detect"
33+
}
34+
},
35+
"env": {
36+
"browser": true,
37+
"es2021": true,
38+
"node": true
39+
}
40+
}

webview-ui/config-overrides.js

Lines changed: 0 additions & 22 deletions
This file was deleted.

webview-ui/index.html

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8" />
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
6+
<title>Roo Cline</title>
7+
</head>
8+
<body>
9+
<div id="root"></div>
10+
<script type="module" src="/src/index.tsx"></script>
11+
</body>
12+
</html>

0 commit comments

Comments
 (0)