Просмотр исходного кода

Fix Roo Code Nightly package.json generation (#4098)

Chris Estreich 7 месяцев назад
Родитель
Сommit
9d9880a74b

+ 1 - 1
packages/build/package.json

@@ -8,7 +8,7 @@
 	"scripts": {
 	"scripts": {
 		"lint": "eslint src --ext=ts --max-warnings=0",
 		"lint": "eslint src --ext=ts --max-warnings=0",
 		"check-types": "tsc --noEmit",
 		"check-types": "tsc --noEmit",
-		"test": "vitest --globals --run",
+		"test": "vitest run",
 		"build": "tsc",
 		"build": "tsc",
 		"clean": "rimraf dist .turbo"
 		"clean": "rimraf dist .turbo"
 	},
 	},

+ 11 - 1
packages/build/src/__tests__/index.test.ts

@@ -1,4 +1,4 @@
-// npx vitest --globals run src/__tests__/index.test.ts
+// npx vitest run src/__tests__/index.test.ts
 
 
 import { generatePackageJson } from "../index.js"
 import { generatePackageJson } from "../index.js"
 
 
@@ -67,6 +67,11 @@ describe("generatePackageJson", () => {
 								group: "navigation@6",
 								group: "navigation@6",
 								when: "activeWebviewPanelId == roo-cline.TabPanelProvider",
 								when: "activeWebviewPanelId == roo-cline.TabPanelProvider",
 							},
 							},
+							{
+								command: "roo-cline.accountButtonClicked",
+								group: "navigation@6",
+								when: "activeWebviewPanelId == roo-cline.TabPanelProvider && config.roo-cline.rooCodeCloudEnabled",
+							},
 						],
 						],
 					},
 					},
 					submenus: [
 					submenus: [
@@ -175,6 +180,11 @@ describe("generatePackageJson", () => {
 							group: "navigation@6",
 							group: "navigation@6",
 							when: "activeWebviewPanelId == roo-code-nightly.TabPanelProvider",
 							when: "activeWebviewPanelId == roo-code-nightly.TabPanelProvider",
 						},
 						},
+						{
+							command: "roo-code-nightly.accountButtonClicked",
+							group: "navigation@6",
+							when: "activeWebviewPanelId == roo-code-nightly.TabPanelProvider && config.roo-code-nightly.rooCodeCloudEnabled",
+						},
 					],
 					],
 				},
 				},
 				submenus: [
 				submenus: [

+ 4 - 4
packages/build/src/esbuild.ts

@@ -213,12 +213,12 @@ function transformArrayRecord<T>(obj: Record<string, any[]>, from: string, to: s
 	return Object.entries(obj).reduce(
 	return Object.entries(obj).reduce(
 		(acc, [key, ary]) => ({
 		(acc, [key, ary]) => ({
 			...acc,
 			...acc,
-			[key.replace(from, to)]: ary.map((item) => {
+			[key.replaceAll(from, to)]: ary.map((item) => {
 				const transformedItem = { ...item }
 				const transformedItem = { ...item }
 
 
 				for (const prop of props) {
 				for (const prop of props) {
 					if (prop in item && typeof item[prop] === "string") {
 					if (prop in item && typeof item[prop] === "string") {
-						transformedItem[prop] = item[prop].replace(from, to)
+						transformedItem[prop] = item[prop].replaceAll(from, to)
 					}
 					}
 				}
 				}
 
 
@@ -232,7 +232,7 @@ function transformArrayRecord<T>(obj: Record<string, any[]>, from: string, to: s
 // eslint-disable-next-line @typescript-eslint/no-explicit-any
 // eslint-disable-next-line @typescript-eslint/no-explicit-any
 function transformArray<T>(arr: any[], from: string, to: string, idProp: string): T[] {
 function transformArray<T>(arr: any[], from: string, to: string, idProp: string): T[] {
 	return arr.map(({ [idProp]: id, ...rest }) => ({
 	return arr.map(({ [idProp]: id, ...rest }) => ({
-		[idProp]: id.replace(from, to),
+		[idProp]: id.replaceAll(from, to),
 		...rest,
 		...rest,
 	}))
 	}))
 }
 }
@@ -242,7 +242,7 @@ function transformRecord<T>(obj: Record<string, any>, from: string, to: string):
 	return Object.entries(obj).reduce(
 	return Object.entries(obj).reduce(
 		(acc, [key, value]) => ({
 		(acc, [key, value]) => ({
 			...acc,
 			...acc,
-			[key.replace(from, to)]: value,
+			[key.replaceAll(from, to)]: value,
 		}),
 		}),
 		{} as T,
 		{} as T,
 	)
 	)

+ 8 - 0
packages/build/vitest.config.ts

@@ -0,0 +1,8 @@
+import { defineConfig } from "vitest/config"
+
+export default defineConfig({
+	test: {
+		globals: true,
+		environment: "node",
+	},
+})

+ 1 - 1
packages/cloud/package.json

@@ -7,7 +7,7 @@
 	"scripts": {
 	"scripts": {
 		"lint": "eslint src --ext=ts --max-warnings=0",
 		"lint": "eslint src --ext=ts --max-warnings=0",
 		"check-types": "tsc --noEmit",
 		"check-types": "tsc --noEmit",
-		"test": "vitest --globals --run",
+		"test": "vitest run",
 		"clean": "rimraf dist .turbo"
 		"clean": "rimraf dist .turbo"
 	},
 	},
 	"dependencies": {
 	"dependencies": {

+ 1 - 1
packages/cloud/src/__tests__/RefreshTimer.test.ts

@@ -1,4 +1,4 @@
-// npx vitest run --globals src/__tests__/RefreshTimer.test.ts
+// npx vitest run src/__tests__/RefreshTimer.test.ts
 
 
 import { Mock } from "vitest"
 import { Mock } from "vitest"
 
 

+ 1 - 1
packages/telemetry/package.json

@@ -7,7 +7,7 @@
 	"scripts": {
 	"scripts": {
 		"lint": "eslint src --ext=ts --max-warnings=0",
 		"lint": "eslint src --ext=ts --max-warnings=0",
 		"check-types": "tsc --noEmit",
 		"check-types": "tsc --noEmit",
-		"test": "vitest --globals --run",
+		"test": "vitest run",
 		"clean": "rimraf dist .turbo"
 		"clean": "rimraf dist .turbo"
 	},
 	},
 	"dependencies": {
 	"dependencies": {

+ 1 - 1
packages/types/package.json

@@ -16,7 +16,7 @@
 	"scripts": {
 	"scripts": {
 		"lint": "eslint src --ext=ts --max-warnings=0",
 		"lint": "eslint src --ext=ts --max-warnings=0",
 		"check-types": "tsc --noEmit",
 		"check-types": "tsc --noEmit",
-		"test": "vitest --globals --run",
+		"test": "vitest run",
 		"build": "tsup",
 		"build": "tsup",
 		"npm:publish:test": "tsup --outDir npm/dist && cd npm && npm publish --dry-run",
 		"npm:publish:test": "tsup --outDir npm/dist && cd npm && npm publish --dry-run",
 		"npm:publish": "tsup --outDir npm/dist && cd npm && npm publish",
 		"npm:publish": "tsup --outDir npm/dist && cd npm && npm publish",

+ 1 - 1
src/api/providers/fetchers/__tests__/openrouter.spec.ts

@@ -1,4 +1,4 @@
-// npx vitest run --globals api/providers/fetchers/__tests__/openrouter.spec.ts
+// npx vitest run api/providers/fetchers/__tests__/openrouter.spec.ts
 
 
 import * as path from "path"
 import * as path from "path"
 
 

+ 1 - 1
src/package.json

@@ -342,7 +342,7 @@
 		"lint": "eslint . --ext=ts --max-warnings=0",
 		"lint": "eslint . --ext=ts --max-warnings=0",
 		"check-types": "tsc --noEmit",
 		"check-types": "tsc --noEmit",
 		"pretest": "turbo run bundle --cwd ..",
 		"pretest": "turbo run bundle --cwd ..",
-		"test": "jest -w=40% && vitest run --globals",
+		"test": "jest -w=40% && vitest run",
 		"format": "prettier --write .",
 		"format": "prettier --write .",
 		"bundle": "node esbuild.mjs",
 		"bundle": "node esbuild.mjs",
 		"vscode:prepublish": "pnpm bundle --production",
 		"vscode:prepublish": "pnpm bundle --production",