2
0
Эх сурвалжийг харах

Improve turbo task dependency declarations (#4323)

Chris Estreich 6 сар өмнө
parent
commit
73f39616c3

+ 1 - 1
.github/workflows/marketplace-publish.yml

@@ -36,7 +36,7 @@ jobs:
       - name: Package Extension
         run: |
           current_package_version=$(node -p "require('./src/package.json').version")
-          pnpm build
+          pnpm vsix
 
           # Save VSIX contents to a temporary file to avoid broken pipe issues.
           unzip -l bin/roo-cline-${current_package_version}.vsix > /tmp/roo-code-vsix-contents.txt

+ 1 - 1
.github/workflows/nightly-publish.yml

@@ -46,7 +46,7 @@ jobs:
             console.log(`🔖 Nightly version set to ${pkg.version}`);
           EOF
       - name: Build VSIX
-        run: pnpm build:nightly # Produces bin/roo-code-nightly-0.0.[count].vsix
+        run: pnpm vsix:nightly # Produces bin/roo-code-nightly-0.0.[count].vsix
       - name: Publish to VS Code Marketplace
         env:
           VSCE_PAT: ${{ secrets.VSCE_PAT }}

+ 34 - 3
MONOREPO.md

@@ -24,7 +24,7 @@ pnpm install
 If things are in good working order then you should be able to build a vsix and install it in VSCode:
 
 ```sh
-pnpm build -- --out ../bin/roo-code-main.vsix && \
+pnpm vsix -- --out ../bin/roo-code-main.vsix && \
   code --install-extension bin/roo-code-main.vsix
 ```
 
@@ -34,9 +34,40 @@ To fully stress the monorepo setup, run the following:
 pnpm clean && pnpm lint
 pnpm clean && pnpm check-types
 pnpm clean && pnpm test
-pnpm clean && pnpm bundle
 pnpm clean && pnpm build
+pnpm clean && pnpm bundle
+pnpm clean && pnpm bundle:nightly
+
 pnpm clean && pnpm npx turbo watch:bundle
 pnpm clean && pnpm npx turbo watch:tsc
-cd apps/vscode-e2e && pnpm test:ci
+
+pnpm --filter @roo-code/vscode-e2e test:ci
+
+pnpm clean && \
+  pnpm vsix -- --out ../bin/roo-code.vsix && \
+  code --install-extension bin/roo-code.vsix
+
+pnpm clean && \
+  pnpm vsix:nightly -- --out ../../../bin/roo-code-nightly.vsix && \
+  code --install-extension bin/roo-code-nightly.vsix
 ```
+
+### Turborepo
+
+Note that this excludes the `build` task for next.js apps (@roo-code/web-\*).
+
+Tasks: `build` -> `bundle` -> `vsix`
+
+build:
+
+- `@roo-code/build` [input: src, package.json, tsconfig.json | output: dist]
+- `@roo-code/types` [input: src, package.json, tsconfig.json, tsup.config.ts | output: dist]
+- `@roo-code/webview-ui` [input: src, package.json, tsconfig.json, vite.config.ts | output: ../src/webview-ui]
+
+bundle:
+
+- `roo-cline` [input: * | output: dist]
+
+vsix:
+
+- `roo-cline` [input: dist | output: bin]

+ 1 - 1
README.md

@@ -145,7 +145,7 @@ Changes to the webview will appear immediately. Changes to the core extension wi
 Alternatively you can build a .vsix and install it directly in VSCode:
 
 ```sh
-pnpm build
+pnpm vsix
 ```
 
 A `.vsix` file will appear in the `bin/` directory which can be installed with:

+ 3 - 4
apps/vscode-nightly/esbuild.mjs

@@ -48,10 +48,9 @@ async function main() {
 	console.log(`[${name}] buildDir: ${buildDir}`)
 	console.log(`[${name}] distDir: ${distDir}`)
 
-	// Clean build directory before starting new build
-	if (fs.existsSync(buildDir)) {
-		console.log(`[${name}] Cleaning build directory: ${buildDir}`)
-		fs.rmSync(buildDir, { recursive: true, force: true })
+	if (fs.existsSync(distDir)) {
+		console.log(`[${name}] Cleaning dist directory: ${distDir}`)
+		fs.rmSync(distDir, { recursive: true, force: true })
 	}
 
 	/**

+ 15 - 0
apps/vscode-nightly/turbo.json

@@ -0,0 +1,15 @@
+{
+	"$schema": "https://turbo.build/schema.json",
+	"extends": ["//"],
+	"tasks": {
+		"bundle:nightly": {
+			"dependsOn": ["^build", "@roo-code/vscode-webview#build:nightly"],
+			"outputs": ["build/**"]
+		},
+		"vsix:nightly": {
+			"dependsOn": ["bundle:nightly"],
+			"inputs": ["build/**"],
+			"outputs": ["../../../bin/**"]
+		}
+	}
+}

+ 4 - 1
apps/web-evals/next.config.ts

@@ -1,7 +1,10 @@
 import type { NextConfig } from "next"
 
 const nextConfig: NextConfig = {
-	/* config options here */
+	webpack: (config) => {
+		config.resolve.extensionAlias = { ".js": [".ts", ".tsx", ".js", ".jsx"] }
+		return config
+	},
 }
 
 export default nextConfig

+ 2 - 1
apps/web-evals/package.json

@@ -1,6 +1,7 @@
 {
 	"name": "@roo-code/web-evals",
-	"private": true,
+	"version": "0.0.0",
+	"type": "module",
 	"scripts": {
 		"lint": "next lint",
 		"check-types": "tsc -b",

+ 10 - 0
apps/web-evals/turbo.json

@@ -0,0 +1,10 @@
+{
+	"$schema": "https://turbo.build/schema.json",
+	"extends": ["//"],
+	"tasks": {
+		"build": {
+			"outputs": [".next/**"],
+			"inputs": ["src/**", "package.json", "tsconfig.json", "next.config.ts"]
+		}
+	}
+}

+ 10 - 0
apps/web-roo-code/turbo.json

@@ -0,0 +1,10 @@
+{
+	"$schema": "https://turbo.build/schema.json",
+	"extends": ["//"],
+	"tasks": {
+		"build": {
+			"outputs": [".next/**"],
+			"inputs": ["src/**", "package.json", "tsconfig.json", "next.config.ts"]
+		}
+	}
+}

+ 3 - 2
package.json

@@ -13,10 +13,11 @@
 		"check-types": "turbo check-types --log-order grouped --output-logs new-only",
 		"test": "turbo test --log-order grouped --output-logs new-only",
 		"format": "turbo format --log-order grouped --output-logs new-only",
+		"build": "turbo build --log-order grouped --output-logs new-only",
 		"bundle": "turbo bundle --log-order grouped --output-logs new-only",
 		"bundle:nightly": "turbo bundle:nightly --log-order grouped --output-logs new-only",
-		"build": "turbo vsix --log-order grouped --output-logs new-only",
-		"build:nightly": "turbo vsix:nightly --log-order grouped --output-logs new-only",
+		"vsix": "turbo vsix --log-order grouped --output-logs new-only",
+		"vsix:nightly": "turbo vsix:nightly --log-order grouped --output-logs new-only",
 		"clean": "turbo clean --log-order grouped --output-logs new-only && rimraf dist out bin .vite-port .turbo",
 		"changeset:version": "cp CHANGELOG.md src/CHANGELOG.md && changeset version && cp -vf src/CHANGELOG.md .",
 		"knip": "knip --include files",

+ 1 - 1
src/package.json

@@ -350,7 +350,7 @@
 		"publish:marketplace": "vsce publish --no-dependencies && ovsx publish --no-dependencies",
 		"watch:bundle": "pnpm bundle --watch",
 		"watch:tsc": "tsc --noEmit --watch --project tsconfig.json",
-		"clean": "rimraf README.md CHANGELOG.md LICENSE dist webview-ui out mock .turbo"
+		"clean": "rimraf README.md CHANGELOG.md LICENSE dist mock .turbo"
 	},
 	"dependencies": {
 		"@anthropic-ai/bedrock-sdk": "^0.10.2",

+ 19 - 0
src/turbo.json

@@ -0,0 +1,19 @@
+{
+	"$schema": "https://turbo.build/schema.json",
+	"extends": ["//"],
+	"tasks": {
+		"bundle": {
+			"dependsOn": ["^build", "@roo-code/vscode-webview#build"],
+			"outputs": ["dist/**"]
+		},
+		"vsix": {
+			"dependsOn": ["bundle"],
+			"inputs": ["dist/**"],
+			"outputs": ["../bin/**"]
+		},
+		"watch:bundle": {
+			"dependsOn": ["@roo-code/build#build", "@roo-code/types#build"],
+			"cache": false
+		}
+	}
+}

+ 1 - 22
turbo.json

@@ -12,28 +12,7 @@
 		},
 		"build": {
 			"outputs": ["dist/**"],
-			"inputs": ["src/**", "package.json", "tsconfig.json", "tsup.config.ts"]
-		},
-		"build:nightly": {},
-		"bundle": {
-			"dependsOn": ["^build"],
-			"cache": false
-		},
-		"bundle:nightly": {
-			"dependsOn": ["^build"],
-			"cache": false
-		},
-		"vsix": {
-			"dependsOn": ["bundle", "@roo-code/vscode-webview#build"],
-			"cache": false
-		},
-		"vsix:nightly": {
-			"dependsOn": ["bundle:nightly", "@roo-code/vscode-webview#build:nightly"],
-			"cache": false
-		},
-		"watch:bundle": {
-			"dependsOn": ["@roo-code/build#build", "@roo-code/types#build"],
-			"cache": false
+			"inputs": ["src/**", "package.json", "tsconfig.json", "tsup.config.ts", "vite.config.ts"]
 		},
 		"watch:tsc": {
 			"cache": false

+ 1 - 1
webview-ui/package.json

@@ -14,7 +14,7 @@
 		"preview": "vite preview",
 		"storybook": "storybook dev -p 6006",
 		"build-storybook": "storybook build",
-		"clean": "rimraf build tsconfig.tsbuildinfo .turbo"
+		"clean": "rimraf ../src/webview-ui/build ../apps/vscode-nightly/build/webview-ui tsconfig.tsbuildinfo .turbo"
 	},
 	"dependencies": {
 		"@radix-ui/react-alert-dialog": "^1.1.6",

+ 12 - 0
webview-ui/turbo.json

@@ -0,0 +1,12 @@
+{
+	"$schema": "https://turbo.build/schema.json",
+	"extends": ["//"],
+	"tasks": {
+		"build": {
+			"outputs": ["../src/webview-ui/**"]
+		},
+		"build:nightly": {
+			"outputs": ["../apps/vscode-nightly/build/webview-ui/**"]
+		}
+	}
+}