From ef942386333b4417f45271f37792c12c02915e13 Mon Sep 17 00:00:00 2001 From: openhands Date: Thu, 1 May 2025 15:30:39 +0000 Subject: [PATCH 1/5] Fix: Update nx.json inputs configuration to fix CI build failures --- nx.json | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/nx.json b/nx.json index 23bc166..494b158 100644 --- a/nx.json +++ b/nx.json @@ -3,6 +3,9 @@ "affected": { "defaultBase": "main" }, + "namedInputs": { + "default": ["{projectRoot}/**/*"] + }, "tasksRunnerOptions": { "default": { "runner": "nx/tasks-runners/default", @@ -21,8 +24,7 @@ "^build" ], "inputs": [ - "production", - "^production" + "{projectRoot}/src/**/*" ], "outputs": [ "{projectRoot}/dist" From ec75a7221c323872cbfccfbf6c13476c125ea6a7 Mon Sep 17 00:00:00 2001 From: openhands Date: Thu, 1 May 2025 15:57:00 +0000 Subject: [PATCH 2/5] Address review feedback: Remove namedInputs and affected blocks --- nx.json | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/nx.json b/nx.json index 494b158..837f967 100644 --- a/nx.json +++ b/nx.json @@ -1,11 +1,5 @@ { "$schema": "./node_modules/nx/schemas/nx-schema.json", - "affected": { - "defaultBase": "main" - }, - "namedInputs": { - "default": ["{projectRoot}/**/*"] - }, "tasksRunnerOptions": { "default": { "runner": "nx/tasks-runners/default", @@ -33,7 +27,7 @@ }, "lint": { "inputs": [ - "default", + "{projectRoot}/**/*", "{workspaceRoot}/.oxlintrc.js" ], "cache": true From 69d31084e92135bc00f0d0bca12d41e5abfad073 Mon Sep 17 00:00:00 2001 From: openhands Date: Thu, 1 May 2025 15:58:42 +0000 Subject: [PATCH 3/5] Add missing tsconfig.json files to fix build failures --- packages/github-to-graphite-button/tsconfig.json | 9 +++++++++ packages/graphite-to-github-button/tsconfig.json | 9 +++++++++ 2 files changed, 18 insertions(+) create mode 100644 packages/github-to-graphite-button/tsconfig.json create mode 100644 packages/graphite-to-github-button/tsconfig.json diff --git a/packages/github-to-graphite-button/tsconfig.json b/packages/github-to-graphite-button/tsconfig.json new file mode 100644 index 0000000..33034f9 --- /dev/null +++ b/packages/github-to-graphite-button/tsconfig.json @@ -0,0 +1,9 @@ +{ + "extends": "../../tsconfig.base.json", + "compilerOptions": { + "outDir": "./dist", + "rootDir": "./src" + }, + "include": ["src/**/*"], + "exclude": ["node_modules", "dist"] +} \ No newline at end of file diff --git a/packages/graphite-to-github-button/tsconfig.json b/packages/graphite-to-github-button/tsconfig.json new file mode 100644 index 0000000..33034f9 --- /dev/null +++ b/packages/graphite-to-github-button/tsconfig.json @@ -0,0 +1,9 @@ +{ + "extends": "../../tsconfig.base.json", + "compilerOptions": { + "outDir": "./dist", + "rootDir": "./src" + }, + "include": ["src/**/*"], + "exclude": ["node_modules", "dist"] +} \ No newline at end of file From 8b16cd9fae2556119524bea0587f9988d16155aa Mon Sep 17 00:00:00 2001 From: openhands Date: Thu, 1 May 2025 16:01:09 +0000 Subject: [PATCH 4/5] Fix TypeScript errors in button scripts --- packages/github-to-graphite-button/src/index.ts | 9 ++++++--- packages/graphite-to-github-button/src/index.ts | 9 ++++++--- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/packages/github-to-graphite-button/src/index.ts b/packages/github-to-graphite-button/src/index.ts index 41d5ea4..ca2e493 100644 --- a/packages/github-to-graphite-button/src/index.ts +++ b/packages/github-to-graphite-button/src/index.ts @@ -16,8 +16,11 @@ const PATH_REGEX = /^\/([^\/]+)\/([^\/]+)\/pull\/([^\/]+).*$/; const SELECTOR = '[class^="gh-header-actions"]'; -const addButton = (toolbar) => { - const [_, org, repo, pr] = window.location.pathname.match(PATH_REGEX); +const addButton = (toolbar: HTMLElement) => { + const match = window.location.pathname.match(PATH_REGEX); + if (!match) return; + + const [_, org, repo, pr] = match; const graphiteLink = `https://app.graphite.dev/github/pr/${org}/${repo}/${pr}/`; if (document.getElementById("graphiteLink") != null) { @@ -42,7 +45,7 @@ const toolbarObserver = new MutationObserver((_, observer) => { } }); -let lastPathname; +let lastPathname: string | undefined; const routeChangeObserver = new MutationObserver(() => { const { pathname } = window.location; diff --git a/packages/graphite-to-github-button/src/index.ts b/packages/graphite-to-github-button/src/index.ts index 5ca7400..d52be0c 100644 --- a/packages/graphite-to-github-button/src/index.ts +++ b/packages/graphite-to-github-button/src/index.ts @@ -16,8 +16,11 @@ const PATH_REGEX = /^\/github\/pr\/([^\/]+)\/([^\/]+)\/([^\/]+).*$/; const SELECTOR = '[class^="PullRequestTitleBar_container_"] > div:nth-child(1) > div:nth-child(2)'; -const addButton = (toolbar) => { - const [_, org, repo, pr] = window.location.pathname.match(PATH_REGEX); +const addButton = (toolbar: HTMLElement) => { + const match = window.location.pathname.match(PATH_REGEX); + if (!match) return; + + const [_, org, repo, pr] = match; const gitHubLink = `https://github.com/${org}/${repo}/pull/${pr}`; if (document.getElementById("gitHubLink") != null) { @@ -45,7 +48,7 @@ const toolbarObserver = new MutationObserver((_, observer) => { } }); -let lastPathname; +let lastPathname: string | undefined; const routeChangeObserver = new MutationObserver(() => { const { pathname } = window.location; From cfb831178bf58fa9191502d96c6136ed30ad0328 Mon Sep 17 00:00:00 2001 From: openhands Date: Thu, 1 May 2025 16:02:35 +0000 Subject: [PATCH 5/5] Fix Element to HTMLElement type casting --- packages/github-to-graphite-button/src/index.ts | 2 +- packages/graphite-to-github-button/src/index.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/github-to-graphite-button/src/index.ts b/packages/github-to-graphite-button/src/index.ts index ca2e493..7f60b2f 100644 --- a/packages/github-to-graphite-button/src/index.ts +++ b/packages/github-to-graphite-button/src/index.ts @@ -38,7 +38,7 @@ const addButton = (toolbar: HTMLElement) => { }; const toolbarObserver = new MutationObserver((_, observer) => { - const toolbar = document.querySelector(SELECTOR); + const toolbar = document.querySelector(SELECTOR) as HTMLElement; if (toolbar) { observer.disconnect(); addButton(toolbar); diff --git a/packages/graphite-to-github-button/src/index.ts b/packages/graphite-to-github-button/src/index.ts index d52be0c..cdcdbff 100644 --- a/packages/graphite-to-github-button/src/index.ts +++ b/packages/graphite-to-github-button/src/index.ts @@ -41,7 +41,7 @@ const addButton = (toolbar: HTMLElement) => { }; const toolbarObserver = new MutationObserver((_, observer) => { - const toolbar = document.querySelector(SELECTOR); + const toolbar = document.querySelector(SELECTOR) as HTMLElement; if (toolbar) { observer.disconnect(); addButton(toolbar);