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

This commit is contained in:
Chris Estreich 2025-05-28 22:23:12 -07:00 committed by GitHub
parent d4c00e58ed
commit 9d9880a74b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 30 additions and 12 deletions

View file

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

View file

@ -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"
@ -67,6 +67,11 @@ describe("generatePackageJson", () => {
group: "navigation@6",
when: "activeWebviewPanelId == roo-cline.TabPanelProvider",
},
{
command: "roo-cline.accountButtonClicked",
group: "navigation@6",
when: "activeWebviewPanelId == roo-cline.TabPanelProvider && config.roo-cline.rooCodeCloudEnabled",
},
],
},
submenus: [
@ -175,6 +180,11 @@ describe("generatePackageJson", () => {
group: "navigation@6",
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: [

View file

@ -213,12 +213,12 @@ function transformArrayRecord<T>(obj: Record<string, any[]>, from: string, to: s
return Object.entries(obj).reduce(
(acc, [key, ary]) => ({
...acc,
[key.replace(from, to)]: ary.map((item) => {
[key.replaceAll(from, to)]: ary.map((item) => {
const transformedItem = { ...item }
for (const prop of props) {
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
function transformArray<T>(arr: any[], from: string, to: string, idProp: string): T[] {
return arr.map(({ [idProp]: id, ...rest }) => ({
[idProp]: id.replace(from, to),
[idProp]: id.replaceAll(from, to),
...rest,
}))
}
@ -242,7 +242,7 @@ function transformRecord<T>(obj: Record<string, any>, from: string, to: string):
return Object.entries(obj).reduce(
(acc, [key, value]) => ({
...acc,
[key.replace(from, to)]: value,
[key.replaceAll(from, to)]: value,
}),
{} as T,
)

View file

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

View file

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

View file

@ -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"

View file

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

View file

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

View file

@ -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"

View file

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