Merge pull request #799 from RooVetGit/cte/package-json-cleanup

Better organize package.json, optimize tasks.json, split extension and webview linting
This commit is contained in:
Chris Estreich 2025-02-05 12:17:44 -08:00 committed by GitHub
commit 00ec57afee
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
17 changed files with 2993 additions and 120 deletions

View file

@ -17,8 +17,7 @@
"@typescript-eslint/semi": "off", "@typescript-eslint/semi": "off",
"eqeqeq": "warn", "eqeqeq": "warn",
"no-throw-literal": "warn", "no-throw-literal": "warn",
"semi": "off", "semi": "off"
"react-hooks/exhaustive-deps": "off"
}, },
"ignorePatterns": ["out", "dist", "**/*.d.ts"] "ignorePatterns": ["out", "dist", "**/*.d.ts"]
} }

View file

@ -9,7 +9,7 @@ on:
branches: [main] branches: [main]
jobs: jobs:
compile: qa:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout code - name: Checkout code
@ -21,12 +21,8 @@ jobs:
cache: 'npm' cache: 'npm'
- name: Install dependencies - name: Install dependencies
run: npm run install:all run: npm run install:all
- name: Compile - name: Run lint, check types, and esbuild
run: npm run compile run: npm run qa
- name: Check types
run: npm run check-types
- name: Lint
run: npm run lint
unit-test: unit-test:
runs-on: ubuntu-latest runs-on: ubuntu-latest
@ -70,9 +66,9 @@ jobs:
with: with:
node-version: '18' node-version: '18'
cache: 'npm' cache: 'npm'
- name: Create env.integration file - name: Create env.e2e file
run: echo "OPENROUTER_API_KEY=${{ secrets.OPENROUTER_API_KEY }}" > .env.integration run: echo "OPENROUTER_API_KEY=${{ secrets.OPENROUTER_API_KEY }}" > .env.e2e
- name: Install dependencies - name: Install dependencies
run: npm run install:all run: npm run install:all
- name: Run integration tests - name: Run end-to-end tests
run: xvfb-run -a npm run test:integration run: xvfb-run -a npm run e2e

4
.gitignore vendored
View file

@ -1,6 +1,6 @@
dist dist
out out
out-integration out-*
node_modules node_modules
coverage/ coverage/
@ -21,4 +21,4 @@ roo-cline-*.vsix
docs/_site/ docs/_site/
# Dotenv # Dotenv
.env.integration .env.e2e

View file

@ -6,7 +6,3 @@ if [ "$branch" = "main" ]; then
fi fi
npx lint-staged npx lint-staged
npm run compile
npm run lint
npm run check-types

View file

@ -5,13 +5,14 @@ if [ "$branch" = "main" ]; then
exit 1 exit 1
fi fi
npm run compile npm run qa
# Check for new changesets # Check for new changesets.
NEW_CHANGESETS=$(find .changeset -name "*.md" ! -name "README.md" | wc -l | tr -d ' ') NEW_CHANGESETS=$(find .changeset -name "*.md" ! -name "README.md" | wc -l | tr -d ' ')
echo "Changeset files: $NEW_CHANGESETS" echo "Changeset files: $NEW_CHANGESETS"
if [ "$NEW_CHANGESETS" == "0" ]; then if [ "$NEW_CHANGESETS" == "0" ]; then
echo "-------------------------------------------------------------------------------------" echo "-------------------------------------------------------------------------------------"
echo "Changes detected. Please run 'npm run changeset' to create a changeset if applicable." echo "Changes detected. Please run 'npm run changeset' to create a changeset if applicable."
echo "-------------------------------------------------------------------------------------" echo "-------------------------------------------------------------------------------------"
fi fi

View file

@ -5,8 +5,8 @@
import { defineConfig } from '@vscode/test-cli'; import { defineConfig } from '@vscode/test-cli';
export default defineConfig({ export default defineConfig({
label: 'integrationTest', label: 'e2e',
files: 'out-integration/test/**/*.test.js', files: 'out-e2e/test/**/*.test.js',
workspaceFolder: '.', workspaceFolder: '.',
mocha: { mocha: {
ui: 'tdd', ui: 'tdd',

2
.vscode/launch.json vendored
View file

@ -13,7 +13,7 @@
"args": ["--extensionDevelopmentPath=${workspaceFolder}"], "args": ["--extensionDevelopmentPath=${workspaceFolder}"],
"sourceMaps": true, "sourceMaps": true,
"outFiles": ["${workspaceFolder}/dist/**/*.js"], "outFiles": ["${workspaceFolder}/dist/**/*.js"],
"preLaunchTask": "debug-mode", "preLaunchTask": "${defaultBuildTask}",
"env": { "env": {
"NODE_ENV": "development", "NODE_ENV": "development",
"VSCODE_DEBUG_MODE": "true" "VSCODE_DEBUG_MODE": "true"

51
.vscode/tasks.json vendored
View file

@ -3,42 +3,15 @@
{ {
"version": "2.0.0", "version": "2.0.0",
"tasks": [ "tasks": [
{
"label": "compile",
"type": "npm",
"script": "compile",
"group": {
"kind": "build",
"isDefault": true
},
"presentation": {
"reveal": "silent",
"panel": "shared"
},
"problemMatcher": ["$tsc", "$eslint-stylish"]
},
{ {
"label": "watch", "label": "watch",
"dependsOn": ["npm: build:webview", "npm: watch:tsc", "npm: watch:esbuild"], "dependsOn": ["npm: dev", "npm: watch:tsc", "npm: watch:esbuild"],
"presentation": { "presentation": {
"reveal": "never" "reveal": "never"
}, },
"group": { "group": {
"kind": "build", "kind": "build",
"isDefault": false "isDefault": true
}
},
{
"label": "debug-mode",
"dependsOn": ["compile", "npm: dev"],
"group": {
"kind": "build",
"isDefault": false
},
"dependsOrder": "parallel",
"presentation": {
"reveal": "always",
"panel": "new"
} }
}, },
{ {
@ -59,20 +32,8 @@
}, },
"isBackground": true, "isBackground": true,
"presentation": { "presentation": {
"group": "watch", "group": "webview-ui",
"reveal": "never" "reveal": "always"
}
},
{
"label": "npm: build:webview",
"type": "npm",
"script": "build:webview",
"group": "build",
"problemMatcher": [],
"isBackground": true,
"presentation": {
"group": "watch",
"reveal": "never"
} }
}, },
{ {
@ -84,7 +45,7 @@
"isBackground": true, "isBackground": true,
"presentation": { "presentation": {
"group": "watch", "group": "watch",
"reveal": "never" "reveal": "always"
} }
}, },
{ {
@ -96,7 +57,7 @@
"isBackground": true, "isBackground": true,
"presentation": { "presentation": {
"group": "watch", "group": "watch",
"reveal": "never" "reveal": "always"
} }
} }
] ]

18
package-lock.json generated
View file

@ -56,6 +56,7 @@
"@changesets/cli": "^2.27.10", "@changesets/cli": "^2.27.10",
"@changesets/types": "^6.0.0", "@changesets/types": "^6.0.0",
"@dotenvx/dotenvx": "^1.34.0", "@dotenvx/dotenvx": "^1.34.0",
"@types/debug": "^4.1.12",
"@types/diff": "^5.2.1", "@types/diff": "^5.2.1",
"@types/diff-match-patch": "^1.0.36", "@types/diff-match-patch": "^1.0.36",
"@types/jest": "^29.5.14", "@types/jest": "^29.5.14",
@ -5895,6 +5896,16 @@
"resolved": "https://registry.npmjs.org/@types/clone-deep/-/clone-deep-4.0.4.tgz", "resolved": "https://registry.npmjs.org/@types/clone-deep/-/clone-deep-4.0.4.tgz",
"integrity": "sha512-vXh6JuuaAha6sqEbJueYdh5zNBPPgG1OYumuz2UvLvriN6ABHDSW8ludREGWJb1MLIzbwZn4q4zUbUCerJTJfA==" "integrity": "sha512-vXh6JuuaAha6sqEbJueYdh5zNBPPgG1OYumuz2UvLvriN6ABHDSW8ludREGWJb1MLIzbwZn4q4zUbUCerJTJfA=="
}, },
"node_modules/@types/debug": {
"version": "4.1.12",
"resolved": "https://registry.npmjs.org/@types/debug/-/debug-4.1.12.tgz",
"integrity": "sha512-vIChWdVG3LG1SMxEvI/AK+FWJthlrqlTu7fbrlywTkkaONwk/UAGaULXRlf8vkzFBLVm0zkMdCquhL5aOjhXPQ==",
"dev": true,
"license": "MIT",
"dependencies": {
"@types/ms": "*"
}
},
"node_modules/@types/diff": { "node_modules/@types/diff": {
"version": "5.2.3", "version": "5.2.3",
"resolved": "https://registry.npmjs.org/@types/diff/-/diff-5.2.3.tgz", "resolved": "https://registry.npmjs.org/@types/diff/-/diff-5.2.3.tgz",
@ -5957,6 +5968,13 @@
"integrity": "sha512-xPyYSz1cMPnJQhl0CLMH68j3gprKZaTjG3s5Vi+fDgx+uhG9NOXwbVt52eFS8ECyXhyKcjDLCBEqBExKuiZb7Q==", "integrity": "sha512-xPyYSz1cMPnJQhl0CLMH68j3gprKZaTjG3s5Vi+fDgx+uhG9NOXwbVt52eFS8ECyXhyKcjDLCBEqBExKuiZb7Q==",
"dev": true "dev": true
}, },
"node_modules/@types/ms": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/@types/ms/-/ms-2.1.0.tgz",
"integrity": "sha512-GsCCIZDE/p3i96vtEqx+7dBUGXrc7zeSK3wwPHIaRThS+9OhWIXRqzs4d6k1SVU8g91DrNRWxWUGhp5KXQb2VA==",
"dev": true,
"license": "MIT"
},
"node_modules/@types/node": { "node_modules/@types/node": {
"version": "20.17.9", "version": "20.17.9",
"resolved": "https://registry.npmjs.org/@types/node/-/node-20.17.9.tgz", "resolved": "https://registry.npmjs.org/@types/node/-/node-20.17.9.tgz",

View file

@ -217,55 +217,34 @@
} }
}, },
"scripts": { "scripts": {
"build": "npm run build:webview && npm run vsix",
"build:webview": "cd webview-ui && npm run build",
"changeset": "changeset",
"check-types": "tsc --noEmit",
"compile": "tsc -p . --outDir out && node esbuild.js",
"compile:integration": "tsc -p tsconfig.integration.json",
"install:all": "npm install && cd webview-ui && npm install",
"lint": "eslint src --ext ts && npm run lint --prefix webview-ui",
"package": "npm run build:webview && npm run check-types && npm run lint && node esbuild.js --production",
"pretest": "npm run compile && npm run compile:integration",
"dev": "cd webview-ui && npm run dev",
"test": "jest && npm run test:webview",
"test:webview": "cd webview-ui && npm run test",
"test:integration": "npm run build && npm run compile:integration && npx dotenvx run -f .env.integration -- vscode-test",
"prepare": "husky", "prepare": "husky",
"publish:marketplace": "vsce publish && ovsx publish", "install:all": "npm run install:extension && npm run install:webview",
"publish": "npm run build && changeset publish && npm install --package-lock-only", "install:extension": "npm install",
"version-packages": "changeset version && npm install --package-lock-only", "install:webview": "cd webview-ui && npm install",
"lint": "npm-run-all -l -p lint:*",
"lint:extension": "eslint src --ext ts",
"lint:webview": "cd webview-ui && npm run lint",
"check-types": "npm-run-all -l -p check-types:*",
"check-types:extension": "tsc --noEmit",
"check-types:webview": "cd webview-ui && npm run check-types",
"test": "npm-run-all -l -s test:*",
"test:extension": "jest",
"test:webview": "cd webview-ui && npm run test",
"build": "npm-run-all -l -s build:webview build:extension",
"build:extension": "mkdir -p bin && npx vsce package --out bin",
"build:webview": "cd webview-ui && npm run build",
"dev": "cd webview-ui && npm run dev",
"qa": "npm-run-all -l -p lint check-types && node esbuild.js",
"e2e": "npm run build && tsc -p tsconfig.e2e.json && npx dotenvx run -f .env.e2e -- vscode-test",
"vscode:prepublish": "npm run package", "vscode:prepublish": "npm run package",
"vsix": "mkdir -p bin && npx vsce package --out bin",
"watch": "npm-run-all -p watch:*", "watch": "npm-run-all -p watch:*",
"watch:esbuild": "node esbuild.js --watch", "watch:esbuild": "node esbuild.js --watch",
"watch:tsc": "tsc --noEmit --watch --project tsconfig.json", "watch:tsc": "tsc --noEmit --watch --project tsconfig.json",
"watch-tests": "tsc -p . -w --outDir out" "package": "npm-run-all -l -p lint check-types && node esbuild.js --production",
}, "changeset": "changeset",
"devDependencies": { "version-packages": "changeset version && npm install --package-lock-only",
"@changesets/cli": "^2.27.10", "publish": "npm run build && changeset publish && npm install --package-lock-only",
"@changesets/types": "^6.0.0", "publish:marketplace": "vsce publish && ovsx publish"
"@dotenvx/dotenvx": "^1.34.0",
"@types/diff": "^5.2.1",
"@types/diff-match-patch": "^1.0.36",
"@types/jest": "^29.5.14",
"@types/mocha": "^10.0.7",
"@types/node": "20.x",
"@types/string-similarity": "^4.0.2",
"@typescript-eslint/eslint-plugin": "^7.14.1",
"@typescript-eslint/parser": "^7.11.0",
"@vscode/test-cli": "^0.0.9",
"@vscode/test-electron": "^2.4.0",
"esbuild": "^0.24.0",
"eslint": "^8.57.0",
"husky": "^9.1.7",
"jest": "^29.7.0",
"jest-simple-dot-reporter": "^1.0.5",
"lint-staged": "^15.2.11",
"npm-run-all": "^4.1.5",
"prettier": "^3.4.2",
"ts-jest": "^29.2.5",
"typescript": "^5.4.5"
}, },
"dependencies": { "dependencies": {
"@anthropic-ai/bedrock-sdk": "^0.10.2", "@anthropic-ai/bedrock-sdk": "^0.10.2",
@ -312,13 +291,41 @@
"web-tree-sitter": "^0.22.6", "web-tree-sitter": "^0.22.6",
"zod": "^3.23.8" "zod": "^3.23.8"
}, },
"devDependencies": {
"@changesets/cli": "^2.27.10",
"@changesets/types": "^6.0.0",
"@dotenvx/dotenvx": "^1.34.0",
"@types/debug": "^4.1.12",
"@types/diff": "^5.2.1",
"@types/diff-match-patch": "^1.0.36",
"@types/jest": "^29.5.14",
"@types/mocha": "^10.0.7",
"@types/node": "20.x",
"@types/string-similarity": "^4.0.2",
"@typescript-eslint/eslint-plugin": "^7.14.1",
"@typescript-eslint/parser": "^7.11.0",
"@vscode/test-cli": "^0.0.9",
"@vscode/test-electron": "^2.4.0",
"esbuild": "^0.24.0",
"eslint": "^8.57.0",
"husky": "^9.1.7",
"jest": "^29.7.0",
"jest-simple-dot-reporter": "^1.0.5",
"lint-staged": "^15.2.11",
"npm-run-all": "^4.1.5",
"prettier": "^3.4.2",
"ts-jest": "^29.2.5",
"typescript": "^5.4.5"
},
"lint-staged": { "lint-staged": {
"*.{js,jsx,ts,tsx,json,css,md}": [ "*.{js,jsx,ts,tsx,json,css,md}": [
"prettier --write" "prettier --write"
], ],
"src/**/*.{ts,tsx}": [ "src/**/*.{ts,tsx}": [
"prettier --write", "npx eslint -c .eslintrc.json --max-warnings=0 --fix"
"npx eslint -c .eslintrc.json --fix" ],
"webview-ui/**/*.{ts,tsx}": [
"npx eslint -c webview-ui/.eslintrc.json --max-warnings=0 --fix"
] ]
} }
} }

View file

@ -10,8 +10,8 @@
"skipLibCheck": true, "skipLibCheck": true,
"useUnknownInCatchVariables": false, "useUnknownInCatchVariables": false,
"rootDir": "src", "rootDir": "src",
"outDir": "out-integration" "outDir": "out-e2e"
}, },
"include": ["**/*.ts"], "include": ["**/*.ts"],
"exclude": [".vscode-test", "benchmark", "dist", "**/node_modules/**", "out", "out-integration", "webview-ui"] "exclude": [".vscode-test", "benchmark", "dist", "**/node_modules/**", "out", "out-e2e", "webview-ui"]
} }

View file

@ -0,0 +1,3 @@
{
"extends": "react-app"
}

File diff suppressed because it is too large Load diff

View file

@ -4,11 +4,12 @@
"private": true, "private": true,
"type": "module", "type": "module",
"scripts": { "scripts": {
"lint": "eslint src --ext ts,tsx",
"check-types": "tsc --noEmit",
"test": "jest",
"dev": "vite", "dev": "vite",
"build": "tsc -b && vite build", "build": "tsc -b && vite build",
"preview": "vite preview", "preview": "vite preview",
"lint": "eslint src --ext ts,tsx",
"test": "jest",
"storybook": "storybook dev -p 6006", "storybook": "storybook dev -p 6006",
"build-storybook": "storybook build" "build-storybook": "storybook build"
}, },
@ -58,6 +59,7 @@
"@typescript-eslint/parser": "^6.21.0", "@typescript-eslint/parser": "^6.21.0",
"@vitejs/plugin-react": "^4.3.4", "@vitejs/plugin-react": "^4.3.4",
"eslint": "^8.57.0", "eslint": "^8.57.0",
"eslint-config-react-app": "^7.0.1",
"eslint-plugin-react": "^7.33.2", "eslint-plugin-react": "^7.33.2",
"eslint-plugin-react-hooks": "^4.6.0", "eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-storybook": "^0.11.2", "eslint-plugin-storybook": "^0.11.2",

View file

@ -238,6 +238,7 @@ const ChatTextArea = forwardRef<HTMLTextAreaElement, ChatTextAreaProps>(
}, 0) }, 0)
} }
}, },
// eslint-disable-next-line react-hooks/exhaustive-deps
[setInputValue, cursorPosition], [setInputValue, cursorPosition],
) )

View file

@ -192,6 +192,7 @@ const PromptsView = ({ onDone }: PromptsViewProps) => {
setNewModeRoleDefinition("") setNewModeRoleDefinition("")
setNewModeCustomInstructions("") setNewModeCustomInstructions("")
setNewModeGroups(availableGroups) setNewModeGroups(availableGroups)
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [newModeName, newModeSlug, newModeRoleDefinition, newModeCustomInstructions, newModeGroups, updateCustomMode]) }, [newModeName, newModeSlug, newModeRoleDefinition, newModeCustomInstructions, newModeGroups, updateCustomMode])
const isNameOrSlugTaken = useCallback( const isNameOrSlugTaken = useCallback(