Skip to content

Commit 1d63958

Browse files
authored
feat: update dependencies to latest and fix configs (#19)
* feat: update dependencies to latest and fix configs This also closes several dependabot PRs closes #14, closes #15, closes #16, closes #17, closes #18 * chore: update circleci executor to node v18 and fix test This updates runner to use cimg/node:18.16.0-browsers * chore: update circleci config
1 parent e3f06cf commit 1d63958

File tree

7 files changed

+2796
-1834
lines changed

7 files changed

+2796
-1834
lines changed

.circleci/config.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,15 @@ commands:
4949
- run:
5050
name: Run Jest and Collect Coverage
5151
command: yarn test:ci
52+
environment:
53+
JEST_JUNIT_OUTPUT_DIR: ./reports/
5254

5355
- store_test_results:
54-
path: coverage
56+
path: ./reports/
5557

5658
- store_artifacts:
5759
name: Store Code Coverage Results
58-
path: coverage
60+
path: ./coverage/
5961

6062
# Command that checks out the code, installs dependencies and caches source/deps
6163
setup:
@@ -110,7 +112,7 @@ commands:
110112
executors:
111113
default:
112114
docker:
113-
- image: cimg/node:14.16.1-browsers
115+
- image: cimg/node:18.16.0-browsers
114116
environment:
115117
NODE_ENV: production
116118
NODE_OPTIONS: --max_old_space_size=8192

jest.config.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,11 @@ module.exports = {
1313
collectCoverageFrom: ['src/**/*.{ts,tsx}'],
1414
coverageDirectory: 'coverage',
1515
coveragePathIgnorePatterns: ['/node_modules/'],
16-
globals: { 'ts-jest': { babelConfig, tsconfig: resolvePath('tsconfig.json') } },
1716
preset: 'ts-jest/presets/js-with-babel',
18-
reporters: ['default', ['jest-junit', { outputDirectory: './coverage', outputName: 'junit.xml' }]],
17+
reporters: ['default', 'jest-junit'],
1918
restoreMocks: true,
2019
roots: ['<rootDir>/src'],
2120
setupFilesAfterEnv: ['@testing-library/jest-dom/extend-expect', '@testing-library/jest-dom'],
2221
testEnvironment: 'jsdom',
23-
transform: { '^.+\\.tsx?$': 'ts-jest' },
22+
transform: { '^.+\\.tsx?$': ['ts-jest', { babelConfig, tsconfig: resolvePath('tsconfig.json') }] },
2423
};

package.json

Lines changed: 31 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@rathpc/zendesk-react",
33
"description": "A minimal component based implementation to include Zendesk in your React application",
4-
"version": "0.3.0",
4+
"version": "0.4.2",
55
"private": false,
66
"license": "MIT",
77
"main": "dist/lib/index.js",
@@ -25,39 +25,40 @@
2525
"access": "public"
2626
},
2727
"devDependencies": {
28-
"@babel/core": "^7.14.6",
29-
"@babel/preset-env": "^7.14.7",
30-
"@babel/preset-react": "^7.14.5",
31-
"@babel/preset-typescript": "^7.14.5",
32-
"@testing-library/jest-dom": "^5.14.1",
33-
"@testing-library/react": "^12.0.0",
34-
"@types/jest": "^26.0.24",
35-
"@types/react": "^17.0.14",
36-
"@types/react-dom": "^17.0.9",
37-
"@types/webpack": "^5.28.0",
38-
"@typescript-eslint/eslint-plugin": "^4.28.2",
39-
"@typescript-eslint/parser": "^4.28.2",
40-
"babel-loader": "^8.2.2",
41-
"eslint": "^7.30.0",
42-
"eslint-config-prettier": "^8.3.0",
43-
"eslint-plugin-prettier": "^3.4.0",
44-
"eslint-plugin-react": "^7.24.0",
45-
"eslint-plugin-react-hooks": "^4.2.0",
46-
"jest": "^27.0.6",
47-
"jest-junit": "^13.0.0",
48-
"prettier": "^2.3.2",
49-
"rimraf": "^3.0.2",
50-
"ts-jest": "^27.0.3",
51-
"typescript": "^4.3.5",
52-
"webpack": "^5.44.0",
53-
"webpack-cli": "^4.7.2"
28+
"@babel/core": "^7.21.5",
29+
"@babel/preset-env": "^7.21.5",
30+
"@babel/preset-react": "^7.18.6",
31+
"@babel/preset-typescript": "^7.21.5",
32+
"@testing-library/jest-dom": "^5.16.5",
33+
"@testing-library/react": "^14.0.0",
34+
"@types/jest": "^29.5.1",
35+
"@types/react": "^18.2.0",
36+
"@types/react-dom": "^18.2.1",
37+
"@types/webpack": "^5.28.1",
38+
"@typescript-eslint/eslint-plugin": "^5.59.1",
39+
"@typescript-eslint/parser": "^5.59.1",
40+
"babel-loader": "^9.1.2",
41+
"eslint": "^8.39.0",
42+
"eslint-config-prettier": "^8.8.0",
43+
"eslint-plugin-prettier": "^4.2.1",
44+
"eslint-plugin-react": "^7.32.2",
45+
"eslint-plugin-react-hooks": "^4.6.0",
46+
"jest": "^29.5.0",
47+
"jest-environment-jsdom": "^29.5.0",
48+
"jest-junit": "^16.0.0",
49+
"prettier": "^2.8.8",
50+
"rimraf": "^5.0.0",
51+
"ts-jest": "^29.1.0",
52+
"typescript": "^5.0.4",
53+
"webpack": "^5.81.0",
54+
"webpack-cli": "^5.0.2"
5455
},
5556
"dependencies": {
56-
"react": ">=16.8.0",
57-
"react-dom": ">=16.8.0"
57+
"react": ">=18.0.0",
58+
"react-dom": ">=18.0.0"
5859
},
5960
"engines": {
60-
"node": ">=12"
61+
"node": ">=18"
6162
},
6263
"scripts": {
6364
"prebuild": "rimraf dist",

src/index.test.tsx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,6 @@ const mockedConsoleLog = (output: Console['log']) => consoleLogOutput.push(outpu
1616
const mockedConsoleWarn = (output: Console['warn']) => consoleWarnOutput.push(output);
1717

1818
describe('index.ts', () => {
19-
beforeAll(() => {
20-
global.window = Object.create(window);
21-
});
22-
2319
beforeEach(() => {
2420
console.warn = mockedConsoleWarn;
2521
console.log = mockedConsoleLog;

src/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { FC, useEffect } from 'react';
1+
import { useEffect } from 'react';
22

33
declare global {
44
interface Window {
@@ -26,7 +26,7 @@ interface ZendeskProps {
2626
zendeskSettings?: Record<string, unknown>;
2727
}
2828

29-
export const Zendesk: FC<ZendeskProps> = ({ defer, disabled, initCallback, zendeskKey, zendeskSettings = {} }) => {
29+
export const Zendesk = ({ defer, disabled, initCallback, zendeskKey, zendeskSettings = {} }: ZendeskProps) => {
3030
useEffect(() => {
3131
if (disabled || !zendeskKey) return;
3232

tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@
1313
"noImplicitThis": true,
1414
"outDir": "dist/lib",
1515
"removeComments": true,
16+
"skipLibCheck": true,
1617
"sourceMap": true,
1718
"strict": true,
18-
"suppressImplicitAnyIndexErrors": true,
1919
"target": "es5",
2020
"tsBuildInfoFile": ".tsbuildinfo"
2121
},

0 commit comments

Comments
 (0)