Skip to content

Commit

Permalink
Relax peer dependencies of react@16.8.0 (#45)
Browse files Browse the repository at this point in the history
* Relax peer dependencies of react@16.8.0

* Update entry

* Fix wrapWith

* Bump to 0.1.0-0
  • Loading branch information
compulim committed Apr 1, 2024
1 parent 8f08c43 commit f647c1e
Show file tree
Hide file tree
Showing 8 changed files with 67 additions and 74 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Changed

- Bumped dependencies, by [@compulim](https://github.com/compulim), in PR [#42](https://github.com/compulim/react-chain-of-responsibility/pull/42) and [#43](https://github.com/compulim/react-chain-of-responsibility/pull/43)
- Relaxed peer dependencies requirements to `react@>=16.8.0`, by [@compulim](https://github.com/compulim) in PR [#45](https://github.com/compulim/react-chain-of-responsibility/pull/45)
- Bumped dependencies, by [@compulim](https://github.com/compulim), in PR [#42](https://github.com/compulim/react-chain-of-responsibility/pull/42), [#43](https://github.com/compulim/react-chain-of-responsibility/pull/43), and [#45](https://github.com/compulim/react-chain-of-responsibility/pull/45)
- Production dependencies
- [`@babel/runtime-corejs3@7.24.1`](https://npmjs.com/package/@babel/runtime-corejs3)
- Development dependencies
Expand All @@ -33,6 +34,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- [`eslint-plugin-react@7.34.1`](https://npmjs.com/package/eslint-plugin-react)
- [`eslint@8.57.0`](https://npmjs.com/package/eslint)
- [`prettier@3.2.5`](https://npmjs.com/package/prettier)
- [`react-wrap-with@0.1.0`](https://npmjs.com/package/react-wrap-with)
- [`typescript@5.4.3`](https://npmjs.com/package/typescript)
- Updated pull request validation to test against various React versions, in PR [#44](https://github.com/compulim/react-chain-of-responsibility/pull/44)
- Moved from JSX Runtime to JSX Classic to support testing against React 16
Expand Down
98 changes: 37 additions & 61 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-chain-of-responsibility-root",
"version": "0.0.3-0",
"version": "0.1.0-0",
"description": "",
"private": true,
"author": "William Wong (https://github.com/compulim)",
Expand Down
4 changes: 2 additions & 2 deletions packages/integration-test/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
"switch:react:16": {
"devDependencies": {
"@types/react": "^16",
"react": "16.9.0",
"react-test-renderer": "16.9.0"
"react": "16.8.0",
"react-test-renderer": "16.8.0"
}
},
"switch:react:17": {
Expand Down
6 changes: 3 additions & 3 deletions packages/pages/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
"@types/react-dom": "^16"
},
"dependencies": {
"react": "16.9.0",
"react-dom": "16.9.0"
"react": "16.8.0",
"react-dom": "16.8.0"
}
},
"switch:react:17": {
Expand Down Expand Up @@ -55,7 +55,7 @@
"@types/react": "^18.2.21",
"@types/react-dom": "^18.2.7",
"esbuild": "^0.19.2",
"react-wrap-with": "^0.0.2",
"react-wrap-with": "^0.1.0",
"typescript": "^5.2.2"
},
"dependencies": {
Expand Down
6 changes: 5 additions & 1 deletion packages/pages/src/app/decoration/Demo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,11 @@ const middleware: (typeof types.middleware)[] = [

return Next;
},
() => next => request => wrapWith(request?.has('italic') && Italic)(next(request)),
() => next => request => {
const nextValue = next(request);

return request?.has('italic') && nextValue ? wrapWith(Italic)(nextValue) : nextValue;
},
() => () => () => Plain
];

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Notes: to test changes in this file, run "jest" with "--no-cache" argument.

const run = ({ filename }) => {
const escapeStringRegexp = require('escape-string-regexp');
const fs = require('fs/promises');
const { extname } = require('path');
const typeScript = require('typescript');
Expand Down Expand Up @@ -54,8 +55,17 @@ const run = ({ filename }) => {

const expectedErrorLine = file.getFullText().split('\n')[line - 1];
const expectedError = expectedErrorLine?.replace(/\s*\/\/\s+/u, '').trim();
let expectedErrors = [expectedError];

expect(message).toEqual(expect.stringContaining(expectedError));
try {
const parsed = JSON.parse(expectedError);

if (Array.isArray(expectedErrors) && expectedErrors.every(value => typeof value === 'string')) {
expectedErrors = parsed;
}
} catch {}

expect(message).toEqual(expect.stringMatching(new RegExp(expectedErrors.map(escapeStringRegexp).join('|'))));
} else {
throw new Error(typeScript.flattenDiagnosticMessageText(messageText, '\n'));
}
Expand Down
9 changes: 5 additions & 4 deletions packages/react-chain-of-responsibility/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,9 @@
"devDependencies": {
"@testing-library/react": "^12",
"@types/react": "^16",
"react": "16.9.0",
"react-dom": "16.9.0",
"react-test-renderer": "16.9.0"
"react": "16.8.0",
"react-dom": "16.8.0",
"react-test-renderer": "16.8.0"
}
},
"switch:react:17": {
Expand Down Expand Up @@ -117,13 +117,14 @@
"@types/node": "^20.11.30",
"@types/react": "^18.2.70",
"esbuild": "^0.20.2",
"escape-string-regexp": "^5.0.0",
"jest": "^29.7.0",
"jest-environment-jsdom": "^29.7.0",
"prettier": "^3.2.5",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-test-renderer": "^18.2.0",
"react-wrap-with": "^0.0.4",
"react-wrap-with": "^0.1.0",
"typescript": "^5.4.3"
},
"peerDependencies": {
Expand Down

0 comments on commit f647c1e

Please sign in to comment.