Skip to content

Commit ab60acb

Browse files
committed
feat: support React 18, modernise package build and dependencies
1 parent 52f7017 commit ab60acb

File tree

6 files changed

+1205
-741
lines changed

6 files changed

+1205
-741
lines changed

.travis.yml

Lines changed: 0 additions & 4 deletions
This file was deleted.

package.json

Lines changed: 14 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,8 @@
55
"author": "Measured Co. <[email protected]>",
66
"license": "MIT",
77
"repository": "measuredco/react-from-json",
8-
"main": "dist/index.js",
9-
"module": "dist/index.es.js",
10-
"jsnext:main": "dist/index.es.js",
8+
"main": "./dist/index.js",
9+
"types": "./dist/index.d.ts",
1110
"engines": {
1211
"node": ">=8",
1312
"npm": ">=5"
@@ -16,8 +15,7 @@
1615
"test": "cross-env CI=1 react-scripts-ts test --env=jsdom",
1716
"test:watch": "react-scripts-ts test --env=jsdom",
1817
"cz": "git-cz",
19-
"build": "rollup -c",
20-
"start": "rollup -c -w",
18+
"build": "rm -rf dist && tsup src/index.tsx",
2119
"prepare": "yarn run build",
2220
"predeploy": "cd example && yarn install && yarn run build",
2321
"deploy": "gh-pages -d example/build",
@@ -26,35 +24,25 @@
2624
},
2725
"dependencies": {},
2826
"peerDependencies": {
29-
"prop-types": "^15.5.4",
30-
"react": "^15.0.0 || ^16.0.0",
31-
"react-dom": "^15.0.0 || ^16.0.0"
27+
"react": "^15.0.0 || ^16.0.0 || ^17.0.0 || ^18.0.0",
28+
"react-dom": "^15.0.0 || ^16.0.0 || ^17.0.0 || ^18.0.0"
3229
},
3330
"devDependencies": {
3431
"@types/jest": "^23.1.5",
35-
"@types/react": "^16.3.13",
36-
"@types/react-dom": "^16.0.5",
37-
"@types/react-test-renderer": "^16.0.2",
38-
"babel-core": "^6.26.3",
39-
"babel-runtime": "^6.26.0",
32+
"@types/react": "^18.2.45",
33+
"@types/react-dom": "^18.2.18",
34+
"@types/react-test-renderer": "^18.0.7",
4035
"commitizen": "^2.10.1",
4136
"conventional-changelog-cli": "^2.0.5",
4237
"conventional-recommended-bump": "^4.0.1",
4338
"cross-env": "^5.1.4",
4439
"gh-pages": "^1.2.0",
45-
"react": "^16.4.1",
46-
"react-dom": "^16.4.1",
47-
"react-scripts-ts": "^2.16.0",
48-
"react-test-renderer": "^16.5.2",
49-
"rollup": "^0.62.0",
50-
"rollup-plugin-babel": "^3.0.7",
51-
"rollup-plugin-commonjs": "^9.1.3",
52-
"rollup-plugin-node-resolve": "^3.3.0",
53-
"rollup-plugin-peer-deps-external": "^2.2.0",
54-
"rollup-plugin-postcss-modules": "^1.0.8",
55-
"rollup-plugin-typescript2": "^0.13.0",
56-
"rollup-plugin-url": "^1.4.0",
57-
"typescript": "^2.8.3"
40+
"react": "^18.2.0",
41+
"react-dom": "^18.2.0",
42+
"react-scripts-ts": "^3.1.0",
43+
"react-test-renderer": "^18.2.0",
44+
"tsup": "^6.7.0",
45+
"typescript": "^4.5.2"
5846
},
5947
"files": [
6048
"dist"

rollup.config.js

Lines changed: 0 additions & 39 deletions
This file was deleted.

tsconfig.json

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,25 @@
11
{
2+
"$schema": "https://json.schemastore.org/tsconfig",
3+
"display": "React Library",
24
"compilerOptions": {
3-
"outDir": "build",
4-
"module": "esnext",
5-
"target": "es5",
6-
"lib": ["es6", "dom", "es2016", "es2017"],
7-
"sourceMap": true,
8-
"allowJs": false,
9-
"jsx": "react",
5+
"composite": false,
106
"declaration": true,
11-
"moduleResolution": "node",
7+
"declarationMap": true,
8+
"esModuleInterop": true,
129
"forceConsistentCasingInFileNames": true,
13-
"noImplicitReturns": true,
14-
"noImplicitThis": true,
15-
"noImplicitAny": true,
16-
"strictNullChecks": true,
17-
"suppressImplicitAnyIndexErrors": true,
18-
"noUnusedLocals": true,
19-
"noUnusedParameters": true
20-
},
21-
"include": ["src"],
22-
"exclude": ["node_modules", "build", "dist", "example", "rollup.config.js"]
10+
"inlineSources": false,
11+
"isolatedModules": true,
12+
"moduleResolution": "node",
13+
"noUnusedLocals": false,
14+
"noUnusedParameters": false,
15+
"preserveWatchOutput": true,
16+
"skipLibCheck": true,
17+
"strict": true,
18+
"jsx": "react-jsx",
19+
"lib": ["ES2015", "DOM"],
20+
"module": "ESNext",
21+
"target": "es6",
22+
"noImplicitAny": false,
23+
"plugins": [{ "name": "typescript-plugin-css-modules" }]
24+
}
2325
}

tsup.config.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
const config = {
2+
dts: true,
3+
format: "cjs",
4+
};
5+
6+
export default config;

0 commit comments

Comments
 (0)