Skip to content

Commit 80d8b91

Browse files
chore(deps): update @primer/react to v38 (#2324)
* chore(deps): update @primer/react to v38 * temp comment out all sx Signed-off-by: Adam Setch <adam.setch@outlook.com> * vibe fixing Signed-off-by: Adam Setch <adam.setch@outlook.com> * replace sx with tailwind or primer components Signed-off-by: Adam Setch <adam.setch@outlook.com> * replace sx with tailwind or primer components Signed-off-by: Adam Setch <adam.setch@outlook.com> * use @primer test helper Signed-off-by: Adam Setch <adam.setch@outlook.com> * pin deps Signed-off-by: Adam Setch <adam.setch@outlook.com> * Merge branch 'main' into renovate/primer-react-38.x Signed-off-by: Adam Setch <adam.setch@outlook.com> * Merge branch 'main' into renovate/primer-react-38.x Signed-off-by: Adam Setch <adam.setch@outlook.com> * Merge branch 'main' into renovate/primer-react-38.x Signed-off-by: Adam Setch <adam.setch@outlook.com> * fix tooltip Signed-off-by: Adam Setch <adam.setch@outlook.com> * fix lint Signed-off-by: Adam Setch <adam.setch@outlook.com> * bump @primer Signed-off-by: Adam Setch <adam.setch@outlook.com> * simplify babel use for primer Signed-off-by: Adam Setch <adam.setch@outlook.com> * simplify babel use for primer Signed-off-by: Adam Setch <adam.setch@outlook.com> * simplify babel use for primer Signed-off-by: Adam Setch <adam.setch@outlook.com> --------- Signed-off-by: Adam Setch <adam.setch@outlook.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Adam Setch <adam.setch@outlook.com>
1 parent 6fae78b commit 80d8b91

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+1859
-1079
lines changed

babel.config.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
module.exports = {
2+
presets: [
3+
[
4+
'@babel/preset-env',
5+
{
6+
targets: { node: 'current' },
7+
// Ensure ESM in node_modules is converted to CommonJS for Jest
8+
modules: 'commonjs',
9+
},
10+
],
11+
],
12+
};

jest.config.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,17 @@ const config: Config = {
66
testEnvironment: 'jsdom',
77
collectCoverage: true,
88
collectCoverageFrom: ['src/**/*', '!**/__snapshots__/**'],
9+
// Use ts-jest for TS/TSX and babel-jest only for plain JS/ESM (no JSX handled there)
10+
transform: {
11+
'^.+\\.(ts|tsx)$': ['ts-jest', { tsconfig: { jsx: 'react-jsx' } }],
12+
'^.+\\.(js|mjs)$': 'babel-jest',
13+
},
14+
// Allow transforming specific ESM packages in node_modules that ship untranspiled ESM.
15+
// @primer/* libraries rely on lit and @lit-labs/react internally for some components.
16+
// We also include GitHub web components that ship ESM-only builds.
17+
transformIgnorePatterns: [
18+
'node_modules/(?!(?:@primer/react|@primer/primitives|@primer/octicons-react|@lit-labs/react|lit|@github/relative-time-element|@github/tab-container-element)/)',
19+
],
920
moduleNameMapper: {
1021
// Force CommonJS build for http adapter to be available.
1122
// via https://github.com/axios/axios/issues/5101#issuecomment-1276572468

package.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,13 +74,15 @@
7474
"react-router-dom": "7.9.5"
7575
},
7676
"devDependencies": {
77+
"@babel/core": "7.28.5",
78+
"@babel/preset-env": "7.28.5",
7779
"@biomejs/biome": "2.3.4",
7880
"@discordapp/twemoji": "16.0.1",
7981
"@electron/notarize": "3.1.1",
8082
"@primer/css": "22.0.2",
8183
"@primer/octicons-react": "19.20.0",
8284
"@primer/primitives": "11.3.0",
83-
"@primer/react": "37.31.0",
85+
"@primer/react": "38.1.0",
8486
"@tailwindcss/postcss": "4.1.17",
8587
"@testing-library/jest-dom": "6.9.1",
8688
"@testing-library/react": "16.3.0",
@@ -91,8 +93,8 @@
9193
"@types/react-dom": "19.2.2",
9294
"@types/react-router-dom": "5.3.3",
9395
"@types/semver": "7.7.1",
94-
"identity-obj-proxy": "3.0.0",
9596
"axios": "1.13.2",
97+
"babel-jest": "30.2.0",
9698
"clsx": "2.1.1",
9799
"concurrently": "9.2.1",
98100
"copy-webpack-plugin": "13.0.1",
@@ -105,6 +107,7 @@
105107
"graphql-tag": "2.12.6",
106108
"html-webpack-plugin": "5.6.4",
107109
"husky": "9.1.7",
110+
"identity-obj-proxy": "3.0.0",
108111
"jest": "30.2.0",
109112
"jest-environment-jsdom": "30.2.0",
110113
"mini-css-extract-plugin": "2.9.4",

pnpm-lock.yaml

Lines changed: 1370 additions & 444 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/renderer/__helpers__/jest.setup.ts

Lines changed: 9 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
11
import '@testing-library/jest-dom';
22

3-
import { TextEncoder } from 'node:util';
3+
/**
4+
* Primer React testing helpers (per docs)
5+
* - https://primer.style/product/getting-started/react/#testing
6+
* - https://github.com/primer/react/blob/main/packages/react/src/utils/test-helpers.tsx
7+
*/
8+
import '@primer/react/test-helpers';
49

510
/**
611
* Gitify context bridge API
712
*/
8-
window.gitify = {
13+
globalThis.gitify = {
914
app: {
1015
version: jest.fn().mockResolvedValue('v0.0.1'),
1116
hide: jest.fn(),
@@ -44,39 +49,9 @@ window.gitify = {
4449
process.env.OAUTH_CLIENT_ID = 'FAKE_CLIENT_ID_123';
4550
process.env.OAUTH_CLIENT_SECRET = 'FAKE_CLIENT_SECRET_123';
4651

47-
/**
48-
* Primer (@primer/react) Setup - START
49-
*
50-
* Borrowed from https://github.com/primer/react/blob/main/packages/react/src/utils/test-helpers.tsx
51-
*/
52-
53-
// JSDOM doesn't mock ResizeObserver
54-
global.ResizeObserver = jest.fn().mockImplementation(() => {
55-
return {
56-
observe: jest.fn(),
57-
disconnect: jest.fn(),
58-
unobserve: jest.fn(),
59-
};
60-
});
61-
62-
// @ts-expect-error only declare properties used internally
63-
global.CSS = {
64-
escape: jest.fn(),
65-
supports: jest.fn().mockImplementation(() => {
66-
return false;
67-
}),
68-
};
69-
70-
// prevent ReferenceError: TextEncoder is not defined
71-
global.TextEncoder = TextEncoder;
72-
73-
/**
74-
* Primer (@primer/react) Setup - END
75-
*/
76-
77-
window.HTMLMediaElement.prototype.play = jest.fn();
52+
globalThis.HTMLMediaElement.prototype.play = jest.fn();
7853

79-
window.matchMedia = (query: string): MediaQueryList => ({
54+
globalThis.matchMedia = (query: string): MediaQueryList => ({
8055
matches: false,
8156
media: query,
8257
onchange: null,

src/renderer/components/Sidebar.tsx

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,9 @@ export const Sidebar: FC = () => {
6565
fetchNotifications();
6666
};
6767

68-
const sidebarButtonStyle = { color: 'white' };
69-
7068
return (
7169
<Stack
72-
className="fixed left-sidebar -ml-sidebar w-sidebar h-full bg-gitify-sidebar text-white"
70+
className="fixed left-sidebar -ml-sidebar w-sidebar h-full bg-gitify-sidebar [&_svg]:text-white"
7371
direction="vertical"
7472
justify="space-between"
7573
>
@@ -98,7 +96,6 @@ export const Sidebar: FC = () => {
9896
icon={BellIcon}
9997
onClick={() => openGitHubNotifications(primaryAccountHostname)}
10098
size="small"
101-
sx={sidebarButtonStyle}
10299
tooltipDirection="e"
103100
unsafeDisableTooltip={false}
104101
variant={hasNotifications ? 'primary' : 'invisible'}
@@ -112,7 +109,6 @@ export const Sidebar: FC = () => {
112109
icon={FilterIcon}
113110
onClick={() => toggleFilters()}
114111
size="small"
115-
sx={sidebarButtonStyle}
116112
tooltipDirection="e"
117113
unsafeDisableTooltip={false}
118114
variant={hasActiveFilters(settings) ? 'primary' : 'invisible'}
@@ -125,7 +121,6 @@ export const Sidebar: FC = () => {
125121
icon={IssueOpenedIcon}
126122
onClick={() => openGitHubIssues(primaryAccountHostname)}
127123
size="small"
128-
sx={sidebarButtonStyle}
129124
tooltipDirection="e"
130125
unsafeDisableTooltip={false}
131126
variant="invisible"
@@ -137,7 +132,6 @@ export const Sidebar: FC = () => {
137132
icon={GitPullRequestIcon}
138133
onClick={() => openGitHubPulls(primaryAccountHostname)}
139134
size="small"
140-
sx={sidebarButtonStyle}
141135
tooltipDirection="e"
142136
unsafeDisableTooltip={false}
143137
variant="invisible"
@@ -161,7 +155,6 @@ export const Sidebar: FC = () => {
161155
loading={status === 'loading'}
162156
onClick={() => refreshNotifications()}
163157
size="small"
164-
sx={sidebarButtonStyle}
165158
tooltipDirection="e"
166159
unsafeDisableTooltip={false}
167160
variant="invisible"
@@ -173,7 +166,6 @@ export const Sidebar: FC = () => {
173166
icon={GearIcon}
174167
onClick={() => toggleSettings()}
175168
size="small"
176-
sx={sidebarButtonStyle}
177169
tooltipDirection="e"
178170
unsafeDisableTooltip={false}
179171
variant="invisible"
@@ -188,7 +180,6 @@ export const Sidebar: FC = () => {
188180
icon={XCircleIcon}
189181
onClick={() => quitApp()}
190182
size="small"
191-
sx={sidebarButtonStyle}
192183
tooltipDirection="e"
193184
unsafeDisableTooltip={false}
194185
variant="invisible"

0 commit comments

Comments
 (0)