Skip to content

Commit

Permalink
Bump dependencies (#70)
Browse files Browse the repository at this point in the history
* Bump dependencies

* Add bump dependencies entry

* Fix ESLint

---------

Co-authored-by: @compulim <@compulim>
Co-authored-by: William Wong <[email protected]>
  • Loading branch information
compulim-workflow-bot[bot] and compulim authored Oct 13, 2024
1 parent c34f7d6 commit 329c3e1
Show file tree
Hide file tree
Showing 16 changed files with 2,129 additions and 1,581 deletions.
35 changes: 29 additions & 6 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Removed

- 💢 Removed named exports, please import the defaults instead
- Use `import { createChainOfResponsibility } from 'react-chain-of-responsibility'` instead
- `import { createChainOfResponsibilityForFluentUI } from 'react-chain-of-responsibility/fluentUI'` for Fluent UI renderer function

### Added

- Support nested provider of same type, by [@compulim](https://github.com/compulim) in PR [#64](https://github.com/compulim/react-chain-of-responsibility/pull/64)
Expand Down Expand Up @@ -54,6 +48,34 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- [`[email protected]`](https://npmjs.com/package/typescript/v/5.5.2)
- Added [ESLint import/export syntax](https://npmjs.com/package/eslint-plugin-import), in PR [#68](https://github.com/compulim/react-chain-of-responsibility/pull/68)
- Added [`publint`](https://npmjs.com/package/publint), in PR [#68](https://github.com/compulim/react-chain-of-responsibility/pull/68)
- Bumped dependencies, in PR [#70](https://github.com/compulim/react-chain-of-responsibility/pull/70)
- Development dependencies
- [`@babel/[email protected]`](https://npmjs.com/package/@babel/preset-env/v/7.25.8)
- [`@babel/[email protected]`](https://npmjs.com/package/@babel/preset-react/v/7.25.7)
- [`@babel/[email protected]`](https://npmjs.com/package/@babel/preset-typescript/v/7.25.7)
- [`@fluentui/[email protected]`](https://npmjs.com/package/@fluentui/react/v/8.121.4)
- [`@testing-library/[email protected]`](https://npmjs.com/package/@testing-library/dom/v/10.4.0)
- [`@testing-library/[email protected]`](https://npmjs.com/package/@testing-library/react/v/16.0.1)
- [`@tsconfig/[email protected]`](https://npmjs.com/package/@tsconfig/recommended/v/1.0.7)
- [`@types/[email protected]`](https://npmjs.com/package/@types/jest/v/29.5.13)
- [`@types/[email protected]`](https://npmjs.com/package/@types/node/v/22.7.5)
- [`@types/[email protected]`](https://npmjs.com/package/@types/react/v/18.3.11)
- [`@types/[email protected]`](https://npmjs.com/package/@types/react-dom/v/18.3.1)
- [`@typescript-eslint/[email protected]`](https://npmjs.com/package/@typescript-eslint/eslint-plugin/v/8.8.1)
- [`@typescript-eslint/[email protected]`](https://npmjs.com/package/@typescript-eslint/parser/v/8.8.1)
- [`[email protected]`](https://npmjs.com/package/esbuild/v/0.24.0)
- [`[email protected]`](https://npmjs.com/package/eslint/v/9.12.0)
- [`[email protected]`](https://npmjs.com/package/eslint-plugin-prettier/v/5.2.1)
- [`[email protected]`](https://npmjs.com/package/eslint-plugin-react/v/7.37.1)
- [`[email protected]`](https://npmjs.com/package/prettier/v/3.3.3)
- [`[email protected]`](https://npmjs.com/package/tsup/v/8.3.0)
- [`[email protected]`](https://npmjs.com/package/typescript/v/5.6.3)

### Removed

- 💢 Removed named exports, please import the defaults instead
- Use `import { createChainOfResponsibility } from 'react-chain-of-responsibility'` instead
- `import { createChainOfResponsibilityForFluentUI } from 'react-chain-of-responsibility/fluentUI'` for Fluent UI renderer function

## [0.1.0] - 2024-04-01

Expand Down Expand Up @@ -155,6 +177,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- [`[email protected]`](https://npmjs.com/package/prettier)
- [`[email protected]`](https://npmjs.com/package/typescript)

[Unreleased]: https://github.com/compulim/react-chain-of-responsibility/compare/v0.1.0...HEAD
[0.1.0]: https://github.com/compulim/react-chain-of-responsibility/compare/v0.0.2...v0.1.0
[0.0.2]: https://github.com/compulim/react-chain-of-responsibility/compare/v0.0.1...v0.0.2
[0.0.1]: https://github.com/compulim/react-chain-of-responsibility/releases/tag/v0.0.1
3,551 changes: 2,036 additions & 1,515 deletions package-lock.json

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@
"test": "npm run test --if-present --workspaces"
},
"devDependencies": {
"@typescript-eslint/eslint-plugin": "^7.4.0",
"@typescript-eslint/parser": "^7.4.0",
"eslint": "^8.57.0",
"@typescript-eslint/eslint-plugin": "^8.8.1",
"@typescript-eslint/parser": "^8.8.1",
"eslint": "^9.12.0",
"eslint-import-resolver-node": "^0.3.9",
"eslint-import-resolver-typescript": "^3.6.3",
"eslint-plugin-import": "^2.31.0",
"eslint-plugin-prettier": "^5.1.3",
"eslint-plugin-react": "^7.34.1",
"prettier": "^3.2.5"
"eslint-plugin-prettier": "^5.2.1",
"eslint-plugin-react": "^7.37.1",
"prettier": "^3.3.3"
}
}
10 changes: 5 additions & 5 deletions packages/integration-test/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,15 @@
}
},
"devDependencies": {
"@babel/preset-env": "^7.24.7",
"@babel/preset-react": "^7.24.7",
"@types/jest": "^29.5.12",
"@types/react": "^18.3.3",
"@babel/preset-env": "^7.25.8",
"@babel/preset-react": "^7.25.7",
"@types/jest": "^29.5.13",
"@types/react": "^18.3.11",
"jest": "^29.7.0",
"jest-environment-jsdom": "^29.7.0",
"react": "^18.3.1",
"react-test-renderer": "^18.3.1",
"typescript": "^5.5.2"
"typescript": "^5.6.3"
},
"dependencies": {
"react-chain-of-responsibility": "^0.0.0-0"
Expand Down
10 changes: 5 additions & 5 deletions packages/pages/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,13 @@
}
},
"devDependencies": {
"@fluentui/react": "^8.119.0",
"@fluentui/react": "^8.121.4",
"@tsconfig/strictest": "^2.0.5",
"@types/react": "^18.3.3",
"@types/react-dom": "^18.3.0",
"esbuild": "^0.21.5",
"@types/react": "^18.3.11",
"@types/react-dom": "^18.3.1",
"esbuild": "^0.24.0",
"react-wrap-with": "^0.1.0",
"typescript": "^5.5.2"
"typescript": "^5.6.3"
},
"dependencies": {
"react": "^18.3.1",
Expand Down
4 changes: 2 additions & 2 deletions packages/pages/src/app/decoration/Demo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ import { wrapWith } from 'react-wrap-with';

type Props = { children?: ReactNode };

const { Provider, Proxy, types } = createChainOfResponsibility<Set<string> | undefined, Props>();
const { Provider, Proxy, types: _types } = createChainOfResponsibility<Set<string> | undefined, Props>();

const Bold = ({ children }: Props) => <strong>{children}</strong>;
const Italic = ({ children }: Props) => <i>{children}</i>;
const Plain = ({ children }: Props) => <>{children}</>;

const middleware: (typeof types.middleware)[] = [
const middleware: (typeof _types.middleware)[] = [
() => next => request => {
const Next = next(request);

Expand Down
4 changes: 2 additions & 2 deletions packages/pages/src/app/fluentButton/Demo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ import React, { Fragment } from 'react';
import { createChainOfResponsibilityForFluentUI } from 'react-chain-of-responsibility/fluentUI';

// Creates a <Provider> to contain all elements.
const { Provider, types, useBuildRenderFunction } = createChainOfResponsibilityForFluentUI<IButtonProps>();
const { Provider, types: _types, useBuildRenderFunction } = createChainOfResponsibilityForFluentUI<IButtonProps>();

// List of subcomponents.
const Banana = () => <Fragment>🍌</Fragment>;
const Orange = () => <Fragment>🍊</Fragment>;

// Constructs an array of middleware to handle the request and return corresponding subcomponents.
// Fallback to `defaultRender` of `IRenderFunction` is handled by the hook.
const middleware: (typeof types.middleware)[] = [
const middleware: (typeof _types.middleware)[] = [
() => next => props => (props?.iconProps?.iconName === 'Banana' ? Banana : next(props)),
() => next => props => (props?.iconProps?.iconName === 'Orange' ? Orange : next(props))
];
Expand Down
12 changes: 8 additions & 4 deletions packages/pages/src/app/fluentDetailsList/Demo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@ initializeIcons();

const cellClassName = mergeStyles({ paddingBottom: 4, paddingLeft: 12, paddingTop: 4 });

const { Provider, types, useBuildRenderFunction } = createChainOfResponsibilityForFluentUI<IDetailsColumnFieldProps>();
const {
Provider,
types: _types,
useBuildRenderFunction
} = createChainOfResponsibilityForFluentUI<IDetailsColumnFieldProps>();

const COLUMNS: IColumn[] = [
{ fieldName: 'name', key: 'name', minWidth: 0, name: 'Fruit' },
Expand All @@ -30,7 +34,7 @@ const ITEMS: Item[] = [
{ name: 'Orange', canClick: true, rating: 3.5 }
];

const decorateFieldWithLink: typeof types.middleware = () => next => request => {
const decorateFieldWithLink: typeof _types.middleware = () => next => request => {
const NextComponent = next(request);

if (request?.column.fieldName === 'name' && request?.item.canClick) {
Expand All @@ -49,7 +53,7 @@ const decorateFieldWithLink: typeof types.middleware = () => next => request =>
const ItemRating = ({ item }: { item: Item }) =>
item.rating ? <Rating className={cellClassName} rating={item.rating} readOnly={true} /> : null;

const decorateFieldWithRating: typeof types.middleware = () => next => request => {
const decorateFieldWithRating: typeof _types.middleware = () => next => request => {
if (request?.column.fieldName === 'rating') {
if (request?.item.rating) {
return ItemRating;
Expand All @@ -76,7 +80,7 @@ const Inner = () => {
const Demo = () => {
const [shouldDecorateNameColumn, setShouldDecorateNameColumn] = useState(true);
const [shouldDecorateRatingColumn, setShouldDecorateRatingColumn] = useState(true);
const middleware = useMemo<readonly (typeof types.middleware)[]>(() => {
const middleware = useMemo<readonly (typeof _types.middleware)[]>(() => {
const middleware = [];

shouldDecorateNameColumn && middleware.push(decorateFieldWithLink);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export default function isInternalLink(href: string, internalHosts: string[]): b
if (internalHosts.includes(url.host)) {
return true;
}
} catch (error) {}
} catch {}

return false;
}
6 changes: 3 additions & 3 deletions packages/pages/src/app/rowCounter/Demo.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { Fragment, useCallback, useMemo, useState, type FormEventHandler } from 'react';
import { createChainOfResponsibility } from 'react-chain-of-responsibility';

const { Provider, types, useBuildComponentCallback } = createChainOfResponsibility<number>();
const { Provider, types: _types, useBuildComponentCallback } = createChainOfResponsibility<number>();

type Props = { items: number[] };

Expand Down Expand Up @@ -37,8 +37,8 @@ const Demo = () => {
({ currentTarget: { checked } }) => setEvenOnly(checked),
[setEvenOnly]
);
const middleware = useMemo<(typeof types.middleware)[]>(() => {
const middleware: (typeof types.middleware)[] = [];
const middleware = useMemo<(typeof _types.middleware)[]>(() => {
const middleware: (typeof _types.middleware)[] = [];

evenOnly &&
middleware.push(() => next => value => {
Expand Down
4 changes: 2 additions & 2 deletions packages/pages/src/app/simple/Demo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ import { createChainOfResponsibility } from 'react-chain-of-responsibility';

type Props = { children?: ReactNode };

const { Provider, Proxy, types } = createChainOfResponsibility<string | undefined, Props>();
const { Provider, Proxy, types: _types } = createChainOfResponsibility<string | undefined, Props>();

const Bold = ({ children }: Props) => <strong>{children}</strong>;
const Italic = ({ children }: Props) => <i>{children}</i>;
const Plain = ({ children }: Props) => <>{children}</>;

const middleware: (typeof types.middleware)[] = [
const middleware: (typeof _types.middleware)[] = [
() => next => request => (request === 'bold' ? Bold : next(request)),
() => next => request => (request === 'italic' ? Italic : next(request)),
() => () => () => Plain
Expand Down
28 changes: 14 additions & 14 deletions packages/react-chain-of-responsibility/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -85,29 +85,29 @@
}
},
"devDependencies": {
"@babel/preset-env": "^7.24.7",
"@babel/preset-react": "^7.24.7",
"@babel/preset-typescript": "^7.24.7",
"@fluentui/react": "^8.119.0",
"@testing-library/dom": "^10.2.0",
"@testing-library/react": "^16.0.0",
"@tsconfig/recommended": "^1.0.6",
"@babel/preset-env": "^7.25.8",
"@babel/preset-react": "^7.25.7",
"@babel/preset-typescript": "^7.25.7",
"@fluentui/react": "^8.121.4",
"@testing-library/dom": "^10.4.0",
"@testing-library/react": "^16.0.1",
"@tsconfig/recommended": "^1.0.7",
"@tsconfig/strictest": "^2.0.5",
"@types/jest": "^29.5.12",
"@types/node": "^20.14.9",
"@types/react": "^18.3.3",
"esbuild": "^0.21.5",
"@types/jest": "^29.5.13",
"@types/node": "^22.7.5",
"@types/react": "^18.3.11",
"esbuild": "^0.24.0",
"escape-string-regexp": "^5.0.0",
"jest": "^29.7.0",
"jest-environment-jsdom": "^29.7.0",
"prettier": "^3.3.2",
"prettier": "^3.3.3",
"publint": "^0.2.11",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-test-renderer": "^18.3.1",
"react-wrap-with": "^0.1.0",
"tsup": "^8.1.0",
"typescript": "^5.5.2"
"tsup": "^8.3.0",
"typescript": "^5.6.3"
},
"peerDependencies": {
"react": ">=16.8.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ type Props = { children?: never };

test('two providers of chain of responsibility nested should render', () => {
// GIVEN: One chain of responsibility.
const { Provider, Proxy, types } = createChainOfResponsibility<undefined, Props, number>();
const { Provider, Proxy, types: _types } = createChainOfResponsibility<undefined, Props, number>();

const middleware1: readonly (typeof types.middleware)[] = Object.freeze([
const middleware1: readonly (typeof _types.middleware)[] = Object.freeze([
init => next => request => {
const Next = next(request);

Expand All @@ -23,7 +23,7 @@ test('two providers of chain of responsibility nested should render', () => {
);
}
]);
const middleware2: readonly (typeof types.middleware)[] = Object.freeze([
const middleware2: readonly (typeof _types.middleware)[] = Object.freeze([
init => next => request => {
const Next = next(request);

Expand Down Expand Up @@ -51,8 +51,8 @@ test('two providers of chain of responsibility nested should render', () => {
middleware1,
middleware2
}: {
middleware1: readonly (typeof types.middleware)[];
middleware2?: readonly (typeof types.middleware)[] | undefined;
middleware1: readonly (typeof _types.middleware)[];
middleware2?: readonly (typeof _types.middleware)[] | undefined;
}) => (
<Provider init={1} middleware={middleware1}>
{middleware2 ? (
Expand All @@ -71,7 +71,7 @@ test('two providers of chain of responsibility nested should render', () => {
expect(result.container).toHaveProperty('textContent', 'First2 Second2 Third1 End');

// WHEN: First middleware is updated.
const middleware3: readonly (typeof types.middleware)[] = Object.freeze([
const middleware3: readonly (typeof _types.middleware)[] = Object.freeze([
init => next => request => {
const Next = next(request);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ function isInternalLink(href: string, internalHosts: string[]) {
if (internalHosts.includes(url.host)) {
return true;
}
} catch (error) {}
} catch {}

return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ import createChainOfResponsibility from './createChainOfResponsibility';

test('constructing middleware using all typings from "types" should render', () => {
// GIVEN: A chain of responsibility which specify init, props, and request.
const { Provider, Proxy, types } = createChainOfResponsibility<string, { className: string }, string>();
const { Provider, Proxy, types: _types } = createChainOfResponsibility<string, { className: string }, string>();

const middleware: (typeof types.middleware)[] = [
(init: typeof types.init) => next => (request: typeof types.request) =>
const middleware: (typeof _types.middleware)[] = [
(init: typeof _types.init) => next => (request: typeof _types.request) =>
request === 'hello'
? ({ className }: typeof types.props) => <span className={className}>{init}</span>
? ({ className }: typeof _types.props) => <span className={className}>{init}</span>
: next(request)
];

Expand All @@ -32,10 +32,10 @@ test('constructing middleware using all typings from "types" should render', ()

test('constructing middleware with minimal typings should render', () => {
// GIVEN: A chain of responsibility which specify init, props, and request.
const { Provider, Proxy, types } = createChainOfResponsibility<void, Record<string, never>, void>();
const { Provider, Proxy, types: _types } = createChainOfResponsibility<void, Record<string, never>, void>();

const middleware: (typeof types.middleware)[] = [
(_init: typeof types.init) => _next => (_request: typeof types.request) => (_props: typeof types.props) => (
const middleware: (typeof _types.middleware)[] = [
(_init: typeof _types.init) => _next => (_request: typeof _types.request) => (_props: typeof _types.props) => (
<span>Hello, World!</span>
)
];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ type Props = { value?: number };

test('useBuildRenderFunction should call getKey() for computing "key" attribute', () => {
// GIVEN: A middleware.
const { Provider, types, useBuildRenderFunction } = createChainOfResponsibilityForFluentUI<Props>();
const { Provider, types: _types, useBuildRenderFunction } = createChainOfResponsibilityForFluentUI<Props>();

const keys: (null | number | string | undefined)[] = [];
const getKey = jest.fn(() => 'a');
Expand All @@ -26,7 +26,7 @@ test('useBuildRenderFunction should call getKey() for computing "key" attribute'
};

const App = () => {
const middleware = useMemo<(typeof types.middleware)[]>(
const middleware = useMemo<(typeof _types.middleware)[]>(
() => [
() =>
() =>
Expand Down

0 comments on commit 329c3e1

Please sign in to comment.