Skip to content

Commit

Permalink
React 18 support (#148)
Browse files Browse the repository at this point in the history
* Upgrade to React 18 release

* Pin peerDep React to <= 18

* Upgrade @testing-library/react

* Make react typings optional

* Enable act in jest env

* Add prettier config

* Update tests

* Remove noise caused by tests asserting failure

* Update package metadata

* Fix erroneous react dependency versions

* Update to support React 18

* Update to husky 8

* Use local dep

* Update tsconfig lib target

* 4.7.0

* Self-review

* Fix loadRootComponent typing

* Widen allowed React versions

* 5.0.0
  • Loading branch information
filoxo authored Aug 25, 2022
1 parent 0872f84 commit c2cf485
Show file tree
Hide file tree
Showing 11 changed files with 413 additions and 466 deletions.
6 changes: 3 additions & 3 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

pnpx pretty-quick --staged && pnpm run test && pnpm run lint
pnpm pretty-quick --staged && pnpm run test && pnpm run lint
1 change: 1 addition & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ const config = {
scheduler: "scheduler/cjs/scheduler-unstable_mock.development.js",
"^single-spa-react$": "<rootDir>/src/single-spa-react.js",
},
setupFiles: ["<rootDir>/jest.setup.js"],
};

export default config;
1 change: 1 addition & 0 deletions jest.setup.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
globalThis.IS_REACT_ACT_ENVIRONMENT = true;
36 changes: 21 additions & 15 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "single-spa-react",
"version": "4.6.1",
"description": "A single spa plugin for React apps",
"version": "5.0.0",
"description": "Single-spa lifecycles helper for React apps",
"main": "lib/umd/single-spa-react.js",
"module": "lib/esm/single-spa-react.js",
"type": "module",
Expand Down Expand Up @@ -36,9 +36,7 @@
"watch-build": "rollup -cw",
"format": "prettier --write .",
"check-format": "prettier --check .",
"prepublishOnly": "pinst --disable && pnpm run build",
"postpublish": "pinst --enable",
"postinstall": "husky install"
"prepare": "husky install"
},
"browserslist": [
"extends browserslist-config-single-spa"
Expand All @@ -57,9 +55,9 @@
"author": "Joel Denning",
"license": "MIT",
"bugs": {
"url": "https://github.com/joeldenning/single-spa-react/issues"
"url": "https://github.com/single-spa/single-spa-react/issues"
},
"homepage": "https://github.com/joeldenning/single-spa-react#readme",
"homepage": "https://github.com/single-spa/single-spa-react#readme",
"dependencies": {
"browserslist-config-single-spa": "^1.0.1"
},
Expand All @@ -75,24 +73,23 @@
"@rollup/plugin-commonjs": "^20.0.0",
"@rollup/plugin-node-resolve": "^13.0.4",
"@testing-library/jest-dom": "^5.14.1",
"@testing-library/react": "^13.0.0-alpha.1",
"@types/react": "^17.0.24",
"@types/react-dom": "^17.0.9",
"@testing-library/react": "^13.1.1",
"@types/react": "^18.0.0",
"@types/react-dom": "^18.0.0",
"concurrently": "^6.2.1",
"copyfiles": "^2.4.1",
"cross-env": "^7.0.3",
"dom-element-getter-helpers": "^1.1.1",
"eslint": "^7.32.0",
"eslint-config-react-important-stuff": "^3.0.0",
"husky": "^7.0.2",
"husky": "^8.0.0",
"jest": "^27.2.1",
"jest-cli": "^27.2.1",
"jest-config": "^27.2.1",
"pinst": "^2.1.6",
"prettier": "^2.4.1",
"pretty-quick": "^3.1.1",
"react": "^18.0.0-alpha-81346764b-20210714",
"react-dom": "^18.0.0-alpha-81346764b-20210714",
"react": "^18.0.0",
"react-dom": "^18.0.0",
"rimraf": "^3.0.2",
"rollup": "^2.56.3",
"rollup-plugin-terser": "^7.0.2",
Expand All @@ -104,5 +101,14 @@
"@types/react": "*",
"@types/react-dom": "*",
"react": "*"
}
},
"peerDependenciesMeta": {
"@types/react": {
"optional": true
},
"@types/react-dom": {
"optional": true
}
},
"prettier": {}
}
118 changes: 45 additions & 73 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit c2cf485

Please sign in to comment.