Skip to content

Commit e87455e

Browse files
committed
chore: upgrade to React 17+ with v7.0.0 release
1 parent b48b0ae commit e87455e

File tree

3 files changed

+107
-22
lines changed

3 files changed

+107
-22
lines changed

.github/workflows/test.yml

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
name: Test
2+
3+
on:
4+
push:
5+
branches: [main, develop]
6+
pull_request:
7+
branches: [main, develop]
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
strategy:
13+
matrix:
14+
node-version: [16.x, 18.x, 20.x]
15+
react-version: ['17.0.2', '18.2.0', '19.0.0']
16+
17+
steps:
18+
- name: Checkout code
19+
uses: actions/checkout@v4
20+
21+
- name: Setup Node.js ${{ matrix.node-version }}
22+
uses: actions/setup-node@v4
23+
with:
24+
node-version: ${{ matrix.node-version }}
25+
cache: 'npm'
26+
27+
- name: Install dependencies
28+
run: npm ci
29+
30+
- name: Install React ${{ matrix.react-version }}
31+
run: npm install react@${{ matrix.react-version }} react-dom@${{ matrix.react-version }} --save-dev
32+
33+
- name: Run linter
34+
run: npm run lint --if-present
35+
36+
- name: Run tests
37+
run: npm test --if-present
38+
39+
- name: Build library
40+
run: npm run build
41+
42+
- name: Upload coverage
43+
uses: codecov/codecov-action@v3
44+
if: matrix.node-version == '18.x' && matrix.react-version == '18.2.0'
45+
with:
46+
files: ./coverage/lcov.info
47+
48+
type-check:
49+
runs-on: ubuntu-latest
50+
steps:
51+
- name: Checkout code
52+
uses: actions/checkout@v4
53+
54+
- name: Setup Node.js
55+
uses: actions/setup-node@v4
56+
with:
57+
node-version: 18.x
58+
cache: 'npm'
59+
60+
- name: Install dependencies
61+
run: npm ci
62+
63+
- name: Type check
64+
run: npm run type-check --if-present
65+
66+
security:
67+
runs-on: ubuntu-latest
68+
steps:
69+
- name: Checkout code
70+
uses: actions/checkout@v4
71+
72+
- name: Run npm audit
73+
run: npm audit --production
74+
continue-on-error: true

package.json

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-infinite-scroll-component",
3-
"version": "6.1.1",
3+
"version": "7.0.0",
44
"description": "An Infinite Scroll component in react.",
55
"source": "src/index.tsx",
66
"main": "dist/index.js",
@@ -39,7 +39,8 @@
3939
},
4040
"homepage": "https://github.com/ankeetmaini/react-infinite-scroll-component#readme",
4141
"peerDependencies": {
42-
"react": ">=16.0.0"
42+
"react": "^17.0.0 || ^18.0.0 || ^19.0.0",
43+
"react-dom": "^17.0.0 || ^18.0.0 || ^19.0.0"
4344
},
4445
"devDependencies": {
4546
"@babel/core": "^7.6.2",
@@ -50,8 +51,8 @@
5051
"@storybook/react": "^5.2.1",
5152
"@testing-library/react": "^9.2.0",
5253
"@types/jest": "^24.0.18",
53-
"@types/react": "^16.9.2",
54-
"@types/react-dom": "^16.9.1",
54+
"@types/react": "^18.2.0",
55+
"@types/react-dom": "^18.2.0",
5556
"@types/storybook__react": "^4.0.2",
5657
"@types/throttle-debounce": "^2.1.0",
5758
"@typescript-eslint/eslint-plugin": "^2.3.2",
@@ -65,19 +66,22 @@
6566
"jest": "^24.9.0",
6667
"lint-staged": ">=8",
6768
"prettier": "1.18.2",
68-
"react": "^16.10.1",
69+
"react": "^18.2.0",
6970
"react-docgen-typescript-loader": "^3.2.1",
70-
"react-dom": "^16.10.1",
71+
"react-dom": "^18.2.0",
7172
"rimraf": "^3.0.0",
7273
"rollup": "^1.26.3",
7374
"rollup-plugin-node-resolve": "^5.2.0",
7475
"rollup-plugin-typescript2": "^0.25.2",
7576
"ts-jest": "^24.1.0",
76-
"typescript": "^3.7.2"
77+
"typescript": "^5.0.0"
7778
},
7879
"dependencies": {
7980
"throttle-debounce": "^2.1.0"
8081
},
82+
"engines": {
83+
"node": ">=14.0.0"
84+
},
8185
"husky": {
8286
"hooks": {
8387
"pre-commit": "yarn run ts-check && lint-staged"

tsconfig.json

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,29 @@
11
{
22
"compilerOptions": {
33
/* Basic Options */
4-
"target": "es5" /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017','ES2018' or 'ESNEXT'. */,
5-
"module": "ES2015" /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */,
6-
// "lib": [], /* Specify library files to be included in the compilation. */
4+
"target": "ES2020" /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017','ES2018' or 'ESNEXT'. */,
5+
"module": "ESNext" /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */,
6+
"lib": [
7+
"ES2020",
8+
"DOM"
9+
], /* Specify library files to be included in the compilation. */
710
// "allowJs": true, /* Allow javascript files to be compiled. */
811
// "checkJs": true, /* Report errors in .js files. */
9-
"jsx": "react" /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */,
12+
"jsx": "react-jsx" /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */,
13+
"jsxImportSource": "react",
1014
"declaration": true /* Generates corresponding '.d.ts' file. */,
1115
"declarationDir": "./dist",
12-
// "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */
13-
// "sourceMap": true, /* Generates corresponding '.map' file. */
16+
"declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */
17+
"sourceMap": true, /* Generates corresponding '.map' file. */
1418
// "outFile": "./", /* Concatenate and emit output to single file. */
15-
// "outDir": "./", /* Redirect output structure to the directory. */
19+
"outDir": "./dist", /* Redirect output structure to the directory. */
1620
// "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
1721
// "composite": true, /* Enable project compilation */
1822
// "removeComments": true, /* Do not emit comments to output. */
1923
// "noEmit": true, /* Do not emit outputs. */
2024
// "importHelpers": true, /* Import emit helpers from 'tslib'. */
2125
// "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */
22-
// "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */
23-
26+
"isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */
2427
/* Strict Type-Checking Options */
2528
"strict": true /* Enable all strict type-checking options. */,
2629
"noImplicitAny": true /* Raise error on expressions and declarations with an implied 'any' type. */,
@@ -30,13 +33,11 @@
3033
"strictPropertyInitialization": true /* Enable strict checking of property initialization in classes. */,
3134
"noImplicitThis": true /* Raise error on 'this' expressions with an implied 'any' type. */,
3235
"alwaysStrict": true /* Parse in strict mode and emit "use strict" for each source file. */,
33-
3436
/* Additional Checks */
3537
"noUnusedLocals": true /* Report errors on unused locals. */,
3638
"noUnusedParameters": true /* Report errors on unused parameters. */,
3739
"noImplicitReturns": true /* Report error when not all code paths in function return a value. */,
3840
"noFallthroughCasesInSwitch": true /* Report errors for fallthrough cases in switch statement. */,
39-
4041
/* Module Resolution Options */
4142
"moduleResolution": "node" /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */,
4243
// "baseUrl": "./", /* Base directory to resolve non-absolute module names. */
@@ -45,15 +46,15 @@
4546
// "typeRoots": [], /* List of folders to include type definitions from. */
4647
// "types": [], /* Type declaration files to be included in compilation. */
4748
// "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */
48-
"esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
49+
"esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */,
50+
"skipLibCheck": true,
51+
"forceConsistentCasingInFileNames": true,
4952
// "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */
50-
5153
/* Source Map Options */
5254
// "sourceRoot": "", /* Specify the location where debugger should locate TypeScript files instead of source locations. */
5355
// "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
5456
// "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */
5557
// "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */
56-
5758
/* Experimental Options */
5859
// "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */
5960
// "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */
@@ -63,5 +64,11 @@
6364
"lint-staged.config.js",
6465
"jest.config.js",
6566
"rollup.config.js"
67+
],
68+
"exclude": [
69+
"node_modules",
70+
"dist",
71+
"**/*.test.ts",
72+
"**/*.test.tsx"
6673
]
67-
}
74+
}

0 commit comments

Comments
 (0)