From 97b9b13b95584118fa10cb8827643db63ab1c369 Mon Sep 17 00:00:00 2001 From: afc163 Date: Fri, 26 Jun 2026 17:50:47 +0800 Subject: [PATCH 01/31] chore: standardize repository config --- .dumirc.ts | 20 +- .github/FUNDING.yml | 2 + .github/dependabot.yml | 53 +--- .github/workflows/codeql.yml | 22 +- .github/workflows/react-component-ci.yml | 13 +- .github/workflows/react-doctor.yml | 24 ++ .github/workflows/site-deploy.yml | 39 --- .github/workflows/surge-preview.yml | 31 +++ .gitignore | 6 +- README.md | 341 +++++------------------ docs/examples/dynaymicCSS.tsx | 4 +- docs/examples/getScrollBarSize.tsx | 2 +- docs/examples/portal.tsx | 2 +- docs/examples/styleChecker.tsx | 2 +- docs/examples/toArray.tsx | 117 ++++---- docs/index.md | 4 +- package.json | 20 +- tsconfig.json | 10 +- vercel.json | 6 + 19 files changed, 262 insertions(+), 456 deletions(-) create mode 100644 .github/FUNDING.yml create mode 100644 .github/workflows/react-doctor.yml delete mode 100644 .github/workflows/site-deploy.yml create mode 100644 .github/workflows/surge-preview.yml create mode 100644 vercel.json diff --git a/.dumirc.ts b/.dumirc.ts index 2d8caaab..f36264dd 100644 --- a/.dumirc.ts +++ b/.dumirc.ts @@ -1,21 +1,25 @@ -// more config: https://d.umijs.org/config import { defineConfig } from 'dumi'; import path from 'path'; -const basePath = process.env.GITHUB_ACTIONS ? '/util/' : '/'; -const publicPath = process.env.GITHUB_ACTIONS ? '/util/' : '/'; +const basePath = process.env.GH_PAGES ? '/util/' : '/'; +const publicPath = process.env.GH_PAGES ? '/util/' : '/'; export default defineConfig({ + alias: { + '@rc-component/util$': path.resolve('src'), + '@rc-component/util/es': path.resolve('src'), + '@rc-component/util/es/*': path.resolve('src'), + 'rc-util$': path.resolve('src'), + 'rc-util/es': path.resolve('src'), + 'rc-util/es/*': path.resolve('src'), + }, + mfsu: false, favicons: ['https://avatars0.githubusercontent.com/u/9441414?s=200&v=4'], themeConfig: { name: 'Util', logo: 'https://avatars0.githubusercontent.com/u/9441414?s=200&v=4', }, - outputPath: '.doc', - exportStatic: {}, + outputPath: 'docs-dist', base: basePath, publicPath, - alias: { - 'rc-util/es': path.resolve(__dirname, 'src'), - }, }); diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 00000000..758659af --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1,2 @@ +github: ant-design +open_collective: ant-design diff --git a/.github/dependabot.yml b/.github/dependabot.yml index f5c5b6e8..0737a7d8 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -1,48 +1,9 @@ version: 2 updates: -- package-ecosystem: npm - directory: "/" - schedule: - interval: daily - time: "21:00" - open-pull-requests-limit: 10 - ignore: - - dependency-name: eslint - versions: - - 7.18.0 - - 7.19.0 - - 7.20.0 - - 7.21.0 - - 7.22.0 - - 7.23.0 - - 7.24.0 - - dependency-name: "@types/jest" - versions: - - 26.0.20 - - 26.0.21 - - 26.0.22 - - dependency-name: react - versions: - - 17.0.1 - - dependency-name: "@types/react" - versions: - - 17.0.0 - - 17.0.1 - - 17.0.2 - - 17.0.3 - - dependency-name: "@types/react-dom" - versions: - - 17.0.0 - - 17.0.1 - - 17.0.2 - - dependency-name: react-dom - versions: - - 17.0.1 - - dependency-name: np - versions: - - 7.2.0 - - 7.3.0 - - 7.4.0 - - dependency-name: react-is - versions: - - 17.0.1 + - package-ecosystem: npm + directory: '/' + schedule: + interval: weekly + day: monday + time: '21:00' + open-pull-requests-limit: 10 diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index ecfbc108..f911ba30 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -1,12 +1,12 @@ -name: "CodeQL" +name: CodeQL on: push: - branches: [ "master" ] + branches: [master] pull_request: - branches: [ "master" ] + branches: [master] schedule: - - cron: "4 6 * * 0" + - cron: '40 12 * * 0' jobs: analyze: @@ -20,22 +20,24 @@ jobs: strategy: fail-fast: false matrix: - language: [ javascript ] + language: [javascript] steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 + with: + persist-credentials: false - name: Initialize CodeQL - uses: github/codeql-action/init@v2 + uses: github/codeql-action/init@8aad20d150bbac5944a9f9d289da16a4b0d87c1e with: languages: ${{ matrix.language }} queries: +security-and-quality - name: Autobuild - uses: github/codeql-action/autobuild@v2 + uses: github/codeql-action/autobuild@8aad20d150bbac5944a9f9d289da16a4b0d87c1e - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v2 + uses: github/codeql-action/analyze@8aad20d150bbac5944a9f9d289da16a4b0d87c1e with: - category: "/language:${{ matrix.language }}" + category: '/language:${{ matrix.language }}' diff --git a/.github/workflows/react-component-ci.yml b/.github/workflows/react-component-ci.yml index 21c24587..d91f4b47 100644 --- a/.github/workflows/react-component-ci.yml +++ b/.github/workflows/react-component-ci.yml @@ -1,6 +1,15 @@ name: ✅ test -on: [push, pull_request] + +on: + push: + branches: [master] + pull_request: + branches: [master] + +permissions: + contents: read + jobs: test: - uses: react-component/rc-test/.github/workflows/test-npm.yml@main + uses: react-component/rc-test/.github/workflows/test-utoo.yml@main secrets: inherit diff --git a/.github/workflows/react-doctor.yml b/.github/workflows/react-doctor.yml new file mode 100644 index 00000000..9e0dfb91 --- /dev/null +++ b/.github/workflows/react-doctor.yml @@ -0,0 +1,24 @@ +name: React Doctor + +on: + pull_request: + branches: [master] + +permissions: + contents: read + pull-requests: write + +concurrency: + group: react-doctor-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +jobs: + react-doctor: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 + with: + persist-credentials: false + - uses: millionco/react-doctor@0b4f4f4bd248a154e64eb508a48347f71154b3f3 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/site-deploy.yml b/.github/workflows/site-deploy.yml deleted file mode 100644 index 8d4aaff4..00000000 --- a/.github/workflows/site-deploy.yml +++ /dev/null @@ -1,39 +0,0 @@ -name: Deploy website -on: - push: - tags: - - '*' - workflow_dispatch: - -permissions: - contents: write - -jobs: - build-and-deploy: - runs-on: ubuntu-latest - steps: - - name: checkout - uses: actions/checkout@v3 - - - name: setup node - uses: actions/setup-node@v1 - with: - node-version: 20 - - - name: create package-lock.json - run: npm i --package-lock-only --ignore-scripts - - - name: Install dependencies - run: npm ci - - - name: build Docs - run: npm run build - - - name: Deploy to GitHub Pages - uses: peaceiris/actions-gh-pages@v3 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - publish_dir: ./.doc - force_orphan: true - user_name: 'github-actions[bot]' - user_email: 'github-actions[bot]@users.noreply.github.com' diff --git a/.github/workflows/surge-preview.yml b/.github/workflows/surge-preview.yml new file mode 100644 index 00000000..94109c27 --- /dev/null +++ b/.github/workflows/surge-preview.yml @@ -0,0 +1,31 @@ +name: Surge Preview + +on: + pull_request: + branches: [master] + +permissions: + contents: read + pull-requests: write + statuses: write + +concurrency: + group: surge-preview-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +jobs: + preview: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 + with: + persist-credentials: false + - uses: afc163/surge-preview@bf90a5a86111f6311ca42f0a5a0f80fb0fb03cec + with: + build: npm run build + dist: docs-dist + failOnMissingToken: false + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + NPM_CONFIG_LEGACY_PEER_DEPS: 'true' + SURGE_TOKEN: ${{ secrets.SURGE_TOKEN }} diff --git a/.gitignore b/.gitignore index 97a23476..10fdf6a4 100644 --- a/.gitignore +++ b/.gitignore @@ -30,13 +30,15 @@ pnpm-lock.yaml yarn.lock .doc bun.lockb - # umi .umi .umi-production .umi-test .env.local - .dumi/tmp .dumi/tmp-test .dumi/tmp-production +es +.dumi +docs-dist +.vercel diff --git a/README.md b/README.md index 7b8ae351..ae3e8a47 100644 --- a/README.md +++ b/README.md @@ -1,303 +1,88 @@ -# rc-util - -Common Utils For React Component. - -[![NPM version][npm-image]][npm-url] -[![npm download][download-image]][download-url] -[![build status][github-actions-image]][github-actions-url] -[![Codecov][codecov-image]][codecov-url] -[![bundle size][bundlephobia-image]][bundlephobia-url] -[![dumi][dumi-image]][dumi-url] - -[npm-image]: http://img.shields.io/npm/v/rc-util.svg?style=flat-square -[npm-url]: http://npmjs.org/package/rc-util -[travis-image]: https://img.shields.io/travis/react-component/util/master?style=flat-square -[travis-url]: https://travis-ci.com/react-component/util -[github-actions-image]: https://github.com/react-component/util/actions/workflows/react-component-ci.yml/badge.svg -[github-actions-url]: https://github.com/react-component/util/actions/workflows/react-component-ci.yml -[codecov-image]: https://img.shields.io/codecov/c/github/react-component/util/master.svg?style=flat-square -[codecov-url]: https://app.codecov.io/gh/react-component/util -[david-url]: https://david-dm.org/react-component/util -[david-image]: https://david-dm.org/react-component/util/status.svg?style=flat-square -[david-dev-url]: https://david-dm.org/react-component/util?type=dev -[david-dev-image]: https://david-dm.org/react-component/util/dev-status.svg?style=flat-square -[download-image]: https://img.shields.io/npm/dm/rc-util.svg?style=flat-square -[download-url]: https://npmjs.org/package/rc-util -[bundlephobia-url]: https://bundlephobia.com/package/rc-util -[bundlephobia-image]: https://badgen.net/bundlephobia/minzip/rc-util -[dumi-url]: https://github.com/umijs/dumi -[dumi-image]: https://img.shields.io/badge/docs%20by-dumi-blue?style=flat-square +
+

@rc-component/util

+

🛠️ Shared React utilities for rc-component packages.

+

+ + Ant Design + +

+

Part of the Ant Design ecosystem.

+

+ npm version + npm downloads + CI + Codecov + bundle size + dumi +

+
+ +## Highlights + +- Built for React and maintained by the rc-component team. +- Used by Ant Design and other React component libraries. +- Ships TypeScript declarations with both ES module and CommonJS outputs. +- Keeps examples, tests, and preview builds aligned with the package source. + +> This package was historically published as `rc-util`. Prefer the scoped package for new code. ## Install -[![rc-util](https://nodei.co/npm/rc-util.png)](https://npmjs.org/package/rc-util) - -## API - -### createChainedFunction - -> (...functions): Function - -Create a function which will call all the functions with it's arguments from left to right. - -```jsx|pure -import createChainedFunction from 'rc-util/lib/createChainedFunction'; -``` - -### deprecated - -> (prop: string, instead: string, component: string): void - -Log an error message to warn developers that `prop` is deprecated. - -```jsx|pure -import deprecated from 'rc-util/lib/deprecated'; -``` - -### getContainerRenderMixin - -> (config: Object): Object - -To generate a mixin which will render specific component into specific container automatically. - -```jsx|pure -import getContainerRenderMixin from 'rc-util/lib/getContainerRenderMixin'; -``` - -Fields in `config` and their meanings. - -| Field | Type | Description | Default | -| ------------- | ---------------------------- | -------------------------------------------------------------------------- | ------- | -| autoMount | boolean | Whether to render component into container automatically | true | -| autoDestroy | boolean | Whether to remove container automatically while the component is unmounted | true | -| isVisible | (instance): boolean | A function to get current visibility of the component | - | -| isForceRender | (instance): boolean | A function to determine whether to render popup even it's not visible | - | -| getComponent | (instance, extra): ReactNode | A function to get the component which will be rendered into container | - | -| getContainer | (instance): HTMLElement | A function to get the container | | - -### Portal - -Render children to the specific container; - -```jsx|pure -import Portal from 'rc-util/lib/Portal'; -``` - -Props: - -| Prop | Type | Description | Default | -| ------------ | --------------- | ------------------------------- | ------- | -| children | ReactChildren | Content render to the container | - | -| getContainer | (): HTMLElement | A function to get the container | - | - -### getScrollBarSize - -> (fresh?: boolean): number - -Get the width of scrollbar. - -```jsx|pure -import getScrollBarSize from 'rc-util/lib/getScrollBarSize'; -``` - -### guid - -> (): string - -To generate a global unique id across current application. - -```jsx|pure -import guid from 'rc-util/lib/guid'; -``` - -### pickAttrs - -> (props: Object): Object - -Pick valid HTML attributes and events from props. - -```jsx|pure -import pickAttrs from 'rc-util/lib/pickAttrs'; -``` - -### warn - -> (msg: string): void - -A shallow wrapper of `console.warn`. - -```jsx|pure -import warn from 'rc-util/lib/warn'; -``` - -### warning - -> (valid: boolean, msg: string): void - -A shallow wrapper of [warning](https://github.com/BerkeleyTrue/warning), but only warning once for the same message. - -```jsx|pure -import warning, { noteOnce } from 'rc-util/lib/warning'; - -warning(false, '[antd Component] test hello world'); - -// Low level note -noteOnce(false, '[antd Component] test hello world'); -``` - -### Children - -A collection of functions to operate React elements' children. - -#### Children/mapSelf - -> (children): children - -Return a shallow copy of children. - -```jsx|pure -import mapSelf from 'rc-util/lib/Children/mapSelf'; +```bash +npm install @rc-component/util ``` -#### Children/toArray - -> (children: ReactNode[]): ReactNode[] +## Usage -Convert children into an array. - -```jsx|pure -import toArray from 'rc-util/lib/Children/toArray'; +```tsx | pure +import { useEvent, useLayoutEffect, warning } from '@rc-component/util'; +import raf from '@rc-component/util/es/raf'; +import Portal from '@rc-component/util/es/Portal'; ``` -### Dom - -A collection of functions to operate DOM elements. +## Examples -#### Dom/addEventlistener +Run the local dumi site to explore the examples: -> (target: ReactNode, eventType: string, listener: Function): { remove: Function } - -A shallow wrapper of [add-dom-event-listener](https://github.com/yiminghe/add-dom-event-listener). - -```jsx|pure -import addEventlistener from 'rc-util/lib/Dom/addEventlistener'; +```bash +npm install +npm start ``` -#### Dom/canUseDom - -> (): boolean - -Check if DOM is available. - -```jsx|pure -import canUseDom from 'rc-util/lib/Dom/canUseDom'; -``` - -#### Dom/class - -A collection of functions to operate DOM nodes' class name. - -- `hasClass(node: HTMLElement, className: string): boolean` -- `addClass(node: HTMLElement, className: string): void` -- `removeClass(node: HTMLElement, className: string): void` - -```jsx|pure -import cssClass from 'rc-util/lib/Dom/class; -``` - -#### Dom/contains - -> (root: HTMLElement, node: HTMLElement): boolean - -Check if node is equal to root or in the subtree of root. - -```jsx|pure -import contains from 'rc-util/lib/Dom/contains'; -``` - -#### Dom/css - -A collection of functions to get or set css styles. - -- `get(node: HTMLElement, name?: string): any` -- `set(node: HTMLElement, name?: string, value: any) | set(node, object)` -- `getOuterWidth(el: HTMLElement): number` -- `getOuterHeight(el: HTMLElement): number` -- `getDocSize(): { width: number, height: number }` -- `getClientSize(): { width: number, height: number }` -- `getScroll(): { scrollLeft: number, scrollTop: number }` -- `getOffset(node: HTMLElement): { left: number, top: number }` - -```jsx|pure -import css from 'rc-util/lib/Dom/css'; -``` - -#### Dom/focus - -A collection of functions to operate focus status of DOM node. - -- `saveLastFocusNode(): void` -- `clearLastFocusNode(): void` -- `backLastFocusNode(): void` -- `getFocusNodeList(node: HTMLElement): HTMLElement[]` get a list of focusable nodes from the subtree of node. -- `limitTabRange(node: HTMLElement, e: Event): void` - -```jsx|pure -import focus from 'rc-util/lib/Dom/focus'; -``` - -#### Dom/support - -> { animation: boolean | Object, transition: boolean | Object } - -A flag to tell whether current environment supports `animationend` or `transitionend`. +## API -```jsx|pure -import support from 'rc-util/lib/Dom/support'; -``` +The package exposes small, focused helpers used across rc-component and Ant Design packages. Import the public entry when possible, and use subpath imports for specialized DOM, React, or test helpers. -### KeyCode +| Area | Examples | +| --------------- | ---------------------------------------------------------------------------------- | +| React hooks | `useEvent`, `useLayoutEffect`, `useMergedState`, `useState` helpers | +| React utilities | `Children/toArray`, `composeRef`, `pickAttrs`, `Portal` | +| DOM utilities | `Dom/canUseDom`, `Dom/contains`, `Dom/dynamicCSS`, `Dom/focus`, `getScrollBarSize` | +| Async helpers | `raf`, `raf.cancel` | +| Warnings | `warning`, `noteOnce`, `resetWarned` | +| Tests | `test/domHook` for DOM prototype spies | -> Enum +Examples in `docs/examples` cover the commonly used subpath helpers. -Enum of KeyCode, please check the [definition](https://github.com/react-component/util/blob/master/src/KeyCode.ts) of it. +## Development -```jsx|pure -import KeyCode from 'rc-util/lib/KeyCode'; +```bash +npm install +npm start +npm test +npm run tsc +npm run compile +npm run build ``` -#### KeyCode.isTextModifyingKeyEvent - -> (e: Event): boolean - -Whether text and modified key is entered at the same time. - -#### KeyCode.isCharacterKey - -> (keyCode: KeyCode): boolean - -Whether character is entered. - -### ScrollLocker - -> ScrollLocker<{lock: (options: {container: HTMLElement}) => void, unLock: () => void}> - -improve shake when page scroll bar hidden. - -`ScrollLocker` change body style, and add a class `ant-scrolling-effect` when called, so if you page look abnormal, please check this; - -```js -import ScrollLocker from 'rc-util/lib/Dom/scrollLocker'; - -const scrollLocker = new ScrollLocker(); +## Release -// lock -scrollLocker.lock() +The release flow is handled by `@rc-component/np` from the `prepublishOnly` script: -// unLock -scrollLocker.unLock() +```bash +npm publish ``` ## License -[MIT](/LICENSE) +@rc-component/util is released under the MIT license. diff --git a/docs/examples/dynaymicCSS.tsx b/docs/examples/dynaymicCSS.tsx index d77f14ee..3b6d3d43 100644 --- a/docs/examples/dynaymicCSS.tsx +++ b/docs/examples/dynaymicCSS.tsx @@ -1,5 +1,5 @@ -import type { Prepend } from 'rc-util/es/Dom/dynamicCSS'; -import { removeCSS, updateCSS } from 'rc-util/es/Dom/dynamicCSS'; +import type { Prepend } from '@rc-component/util/es/Dom/dynamicCSS'; +import { removeCSS, updateCSS } from '@rc-component/util/es/Dom/dynamicCSS'; import React from 'react'; function injectStyle(id: number, prepend?: Prepend, priority?: number) { diff --git a/docs/examples/getScrollBarSize.tsx b/docs/examples/getScrollBarSize.tsx index b6988f6f..5abedc5e 100644 --- a/docs/examples/getScrollBarSize.tsx +++ b/docs/examples/getScrollBarSize.tsx @@ -1,6 +1,6 @@ import getScrollBarSize, { getTargetScrollBarSize, -} from 'rc-util/es/getScrollBarSize'; +} from '@rc-component/util/es/getScrollBarSize'; import React from 'react'; const cssText = ` diff --git a/docs/examples/portal.tsx b/docs/examples/portal.tsx index 50b30c3a..42573088 100644 --- a/docs/examples/portal.tsx +++ b/docs/examples/portal.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import PortalWrapper from 'rc-util/es/PortalWrapper'; +import PortalWrapper from '@rc-component/util/es/PortalWrapper'; const Demo: React.FC = () => { const divRef = React.useRef(null); diff --git a/docs/examples/styleChecker.tsx b/docs/examples/styleChecker.tsx index 2544d2aa..89515a5d 100644 --- a/docs/examples/styleChecker.tsx +++ b/docs/examples/styleChecker.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import { isStyleSupport } from 'rc-util/es/Dom/styleChecker'; +import { isStyleSupport } from '@rc-component/util/es/Dom/styleChecker'; export default () => { const supportFlex = isStyleSupport('flex'); diff --git a/docs/examples/toArray.tsx b/docs/examples/toArray.tsx index 647ae274..4efe9cd7 100644 --- a/docs/examples/toArray.tsx +++ b/docs/examples/toArray.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import toArray, { type Option } from 'rc-util/es/Children/toArray'; +import toArray, { type Option } from '@rc-component/util/es/Children/toArray'; const initialState = { 'no-children': false, @@ -8,45 +8,56 @@ const initialState = { 'nested-children': false, 'array-of-children': false, 'is-falsy': false, - 'fragment': false, -} as const + fragment: false, +} as const; -type Action = keyof typeof initialState +type Action = keyof typeof initialState; -const Wrapper = ({ children, ...options }: { children?: React.ReactNode } & Option) => { +const Wrapper = ({ + children, + ...options +}: { children?: React.ReactNode } & Option) => { window.console.log(toArray(children, options)); return children as any; }; -const DemoBox = React.memo(({ children, name }: { children?: any, name: Action }) => { - const [keepEmpty, setkeepEmpty] = React.useState(false); - const [show, setShow] = React.useState(false) - return ( - - - -
- {show && React.cloneElement(children, { keepEmpty })} -
-
- ) -}) +const DemoBox = React.memo( + ({ children, name }: { children?: any; name: Action }) => { + const [keepEmpty, setkeepEmpty] = React.useState(false); + const [show, setShow] = React.useState(false); + return ( + + + +
+ {show && React.cloneElement(children, { keepEmpty })} +
+
+ ); + }, +); const App = () => ( <> -

Press F12 to open the console (Click Clear Console)

+

+ Press F12 to open the console (Click Clear Console) +

@@ -59,42 +70,42 @@ const App = () => ( - +

1

2
- +
    - {Array.from({ length: 5 }, (_, i) =>
  • {i}
  • )} + {Array.from({ length: 5 }, (_, i) => ( +
  • {i}
  • + ))}
- - { + + {[ [ [ - [ - 111, - 222, - 333 - ], - 444, - 555 + 111, + 222, + 333, ], - 666, - 777 - ] - } + 444, + 555, + ], + 666, + 777, + ]} - + {null} {undefined} {false} @@ -106,18 +117,16 @@ const App = () => ( - + - A - + A + - B + B ); - - -export default App; \ No newline at end of file +export default App; diff --git a/docs/index.md b/docs/index.md index e531e8ca..cec78020 100644 --- a/docs/index.md +++ b/docs/index.md @@ -1,7 +1,5 @@ --- -hero: - title: rc-util - description: Common Utils For React Component +title: '@rc-component/util' --- diff --git a/package.json b/package.json index d64a82f6..66a79e04 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@rc-component/util", "version": "1.11.1", - "description": "Common Utils For React Component", + "description": "Shared React utilities for rc-component packages.", "keywords": [ "react", "util" @@ -22,14 +22,19 @@ "es" ], "scripts": { - "build": "dumi build", + "build": "npm run compile && npm run docs:build", "compile": "father build", - "coverage": "npm test -- --coverage", - "lint": "eslint src/ --ext .tsx,.ts & eslint tests/ --ext .tsx,.ts", - "prepare": "husky install", + "coverage": "rc-test --coverage", + "docs:build": "dumi build", + "docs:deploy": "gh-pages -d docs-dist", + "deploy": "npm run gh-pages", + "gh-pages": "cross-env GH_PAGES=1 npm run compile && npm run docs:build && npm run docs:deploy", + "lint": "eslint src/ tests/ docs/examples/ --ext .tsx,.ts,.jsx,.js", "prepublishOnly": "npm run compile && rc-np", + "prettier": "prettier --write --ignore-unknown .", "start": "dumi dev", - "test": "rc-test" + "test": "rc-test", + "tsc": "tsc --noEmit" }, "lint-staged": { "**/*.{js,jsx,tsx,ts,md,json}": [ @@ -68,7 +73,8 @@ "react-19": "npm:react@19.0.0", "react-dom": "^18.0.0", "react-dom-19": "npm:react-dom@19.0.0", - "typescript": "^5.3.2" + "typescript": "^5.3.2", + "gh-pages": "^6.3.0" }, "peerDependencies": { "react": ">=18.0.0", diff --git a/tsconfig.json b/tsconfig.json index 7ab37155..35ae87d6 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -9,9 +9,15 @@ "esModuleInterop": true, "paths": { "@/*": ["src/*"], - "@@/*": ["src/.dumi/*"], + "@@/*": [".dumi/tmp/*"], + "@rc-component/util": ["src/index.ts"], + "@rc-component/util/es": ["src"], + "@rc-component/util/es/*": ["src/*"], "rc-util": ["src/index.ts"], + "rc-util/es": ["src"], "rc-util/es/*": ["src/*"] } - } + }, + "include": [".dumirc.ts", "src", "tests", "docs/examples"], + "exclude": ["docs-dist", "lib", "es"] } diff --git a/vercel.json b/vercel.json new file mode 100644 index 00000000..d3115dec --- /dev/null +++ b/vercel.json @@ -0,0 +1,6 @@ +{ + "framework": "umijs", + "installCommand": "npm install --legacy-peer-deps", + "buildCommand": "npm run build", + "outputDirectory": "docs-dist" +} From f89eb65ff8f69e2ed6ead2817e006486bd303df0 Mon Sep 17 00:00:00 2001 From: afc163 Date: Fri, 26 Jun 2026 18:03:02 +0800 Subject: [PATCH 02/31] chore: address review feedback --- .dumirc.ts | 10 ++++----- .github/workflows/react-component-ci.yml | 2 +- .github/workflows/surge-preview.yml | 2 ++ .gitignore | 1 - README.md | 14 ++++++------ docs/examples/portal.tsx | 27 ++++++++++++++++-------- docs/examples/toArray.tsx | 4 ++-- 7 files changed, 35 insertions(+), 25 deletions(-) diff --git a/.dumirc.ts b/.dumirc.ts index f36264dd..74320d24 100644 --- a/.dumirc.ts +++ b/.dumirc.ts @@ -6,12 +6,10 @@ const publicPath = process.env.GH_PAGES ? '/util/' : '/'; export default defineConfig({ alias: { - '@rc-component/util$': path.resolve('src'), - '@rc-component/util/es': path.resolve('src'), - '@rc-component/util/es/*': path.resolve('src'), - 'rc-util$': path.resolve('src'), - 'rc-util/es': path.resolve('src'), - 'rc-util/es/*': path.resolve('src'), + '@rc-component/util$': path.resolve(__dirname, 'src'), + '@rc-component/util/es': path.resolve(__dirname, 'src'), + 'rc-util$': path.resolve(__dirname, 'src'), + 'rc-util/es': path.resolve(__dirname, 'src'), }, mfsu: false, favicons: ['https://avatars0.githubusercontent.com/u/9441414?s=200&v=4'], diff --git a/.github/workflows/react-component-ci.yml b/.github/workflows/react-component-ci.yml index d91f4b47..a33292ef 100644 --- a/.github/workflows/react-component-ci.yml +++ b/.github/workflows/react-component-ci.yml @@ -11,5 +11,5 @@ permissions: jobs: test: - uses: react-component/rc-test/.github/workflows/test-utoo.yml@main + uses: react-component/rc-test/.github/workflows/test-utoo.yml@b8ebddc81ef706b50faff0242ab34ad8ecdd9a59 secrets: inherit diff --git a/.github/workflows/surge-preview.yml b/.github/workflows/surge-preview.yml index 94109c27..609a314a 100644 --- a/.github/workflows/surge-preview.yml +++ b/.github/workflows/surge-preview.yml @@ -20,6 +20,8 @@ jobs: - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 with: persist-credentials: false + - name: Install dependencies + run: npm install --legacy-peer-deps --ignore-scripts --no-audit --loglevel=warn - uses: afc163/surge-preview@bf90a5a86111f6311ca42f0a5a0f80fb0fb03cec with: build: npm run build diff --git a/.gitignore b/.gitignore index 10fdf6a4..32dd1191 100644 --- a/.gitignore +++ b/.gitignore @@ -39,6 +39,5 @@ bun.lockb .dumi/tmp-test .dumi/tmp-production es -.dumi docs-dist .vercel diff --git a/README.md b/README.md index ae3e8a47..825f5b0b 100644 --- a/README.md +++ b/README.md @@ -35,9 +35,13 @@ npm install @rc-component/util ## Usage ```tsx | pure -import { useEvent, useLayoutEffect, warning } from '@rc-component/util'; -import raf from '@rc-component/util/es/raf'; -import Portal from '@rc-component/util/es/Portal'; +import { + Portal, + raf, + useEvent, + useLayoutEffect, + warning, +} from '@rc-component/util'; ``` ## Examples @@ -70,14 +74,12 @@ Examples in `docs/examples` cover the commonly used subpath helpers. npm install npm start npm test -npm run tsc -npm run compile npm run build ``` ## Release -The release flow is handled by `@rc-component/np` from the `prepublishOnly` script: +The `prepublishOnly` script runs `npm run compile` and then `rc-np` from `@rc-component/np`: ```bash npm publish diff --git a/docs/examples/portal.tsx b/docs/examples/portal.tsx index 42573088..fc7b2cde 100644 --- a/docs/examples/portal.tsx +++ b/docs/examples/portal.tsx @@ -1,24 +1,33 @@ import React from 'react'; -import PortalWrapper from '@rc-component/util/es/PortalWrapper'; +import { Portal } from '@rc-component/util'; const Demo: React.FC = () => { const divRef = React.useRef(null); - const outerRef = React.useRef(null); + const [container, setContainer] = React.useState(null); React.useEffect(() => { console.log('>>>', divRef.current); }, []); - function getRef() { - return outerRef.current; - } + React.useEffect(() => { + const element = document.createElement('div'); + element.style.backgroundColor = 'red'; + element.style.height = '20px'; + document.body.appendChild(element); + setContainer(element); + + return () => { + element.remove(); + }; + }, []); return ( <> - - {() =>
2333
} -
-
+ {container && ( + container}> +
2333
+
+ )} ); }; diff --git a/docs/examples/toArray.tsx b/docs/examples/toArray.tsx index 4efe9cd7..0d10112e 100644 --- a/docs/examples/toArray.tsx +++ b/docs/examples/toArray.tsx @@ -55,9 +55,9 @@ const DemoBox = React.memo( const App = () => ( <> -

+ From a526879ca76375f6c3be5907291f3c125ce02f56 Mon Sep 17 00:00:00 2001 From: afc163 Date: Fri, 26 Jun 2026 18:08:58 +0800 Subject: [PATCH 03/31] chore: fix surge preview inputs --- .github/workflows/surge-preview.yml | 6 +++--- docs/examples/portal.tsx | 4 ---- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/.github/workflows/surge-preview.yml b/.github/workflows/surge-preview.yml index 609a314a..6ae656d0 100644 --- a/.github/workflows/surge-preview.yml +++ b/.github/workflows/surge-preview.yml @@ -26,8 +26,8 @@ jobs: with: build: npm run build dist: docs-dist - failOnMissingToken: false + failOnError: false + github_token: ${{ secrets.GITHUB_TOKEN }} + surge_token: ${{ secrets.SURGE_TOKEN }} env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} NPM_CONFIG_LEGACY_PEER_DEPS: 'true' - SURGE_TOKEN: ${{ secrets.SURGE_TOKEN }} diff --git a/docs/examples/portal.tsx b/docs/examples/portal.tsx index fc7b2cde..9f5b2b34 100644 --- a/docs/examples/portal.tsx +++ b/docs/examples/portal.tsx @@ -5,10 +5,6 @@ const Demo: React.FC = () => { const divRef = React.useRef(null); const [container, setContainer] = React.useState(null); - React.useEffect(() => { - console.log('>>>', divRef.current); - }, []); - React.useEffect(() => { const element = document.createElement('div'); element.style.backgroundColor = 'red'; From e8378497b83c45bf3af5c8286c976f1cf328635e Mon Sep 17 00:00:00 2001 From: afc163 Date: Sat, 27 Jun 2026 01:27:35 +0800 Subject: [PATCH 04/31] chore: address AI review feedback --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 66a79e04..9efe0107 100644 --- a/package.json +++ b/package.json @@ -28,7 +28,7 @@ "docs:build": "dumi build", "docs:deploy": "gh-pages -d docs-dist", "deploy": "npm run gh-pages", - "gh-pages": "cross-env GH_PAGES=1 npm run compile && npm run docs:build && npm run docs:deploy", + "gh-pages": "npm run compile && cross-env GH_PAGES=1 npm run docs:build && npm run docs:deploy", "lint": "eslint src/ tests/ docs/examples/ --ext .tsx,.ts,.jsx,.js", "prepublishOnly": "npm run compile && rc-np", "prettier": "prettier --write --ignore-unknown .", From b144c832d22c91f3679b11de81eb4c7ac352db28 Mon Sep 17 00:00:00 2001 From: afc163 Date: Sat, 27 Jun 2026 01:56:51 +0800 Subject: [PATCH 05/31] docs: standardize README release details --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 825f5b0b..47a8366a 100644 --- a/README.md +++ b/README.md @@ -79,12 +79,12 @@ npm run build ## Release -The `prepublishOnly` script runs `npm run compile` and then `rc-np` from `@rc-component/np`: - ```bash -npm publish +npm run prepublishOnly ``` +The release flow is handled by `@rc-component/np` through the `rc-np` command after the package build. + ## License -@rc-component/util is released under the MIT license. +@rc-component/util is released under the [MIT](./LICENSE) license. From cad7eb02028565a0c7d673d694ea3a34df50df5d Mon Sep 17 00:00:00 2001 From: afc163 Date: Sat, 27 Jun 2026 02:17:45 +0800 Subject: [PATCH 06/31] docs: clarify Ant Design ecosystem note --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 47a8366a..1580e700 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ Ant Design

-

Part of the Ant Design ecosystem.

+

Part of the Ant Design ecosystem.

npm version npm downloads From 6a9f6602d666411de64ee07bbe0b23ec4e6c17f9 Mon Sep 17 00:00:00 2001 From: afc163 Date: Sat, 27 Jun 2026 13:04:06 +0800 Subject: [PATCH 07/31] docs: refine README usage and ecosystem note --- README.md | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 1580e700..a896f37f 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,7 @@

@rc-component/util

+

Part of the Ant Design ecosystem.

🛠️ Shared React utilities for rc-component packages.

-

- - Ant Design - -

-

Part of the Ant Design ecosystem.

npm version npm downloads @@ -17,6 +12,7 @@

+ ## Highlights - Built for React and maintained by the rc-component team. From 692a7c4abdb32e831f34ad1c81c3b40e4df2c629 Mon Sep 17 00:00:00 2001 From: afc163 Date: Sat, 27 Jun 2026 13:22:22 +0800 Subject: [PATCH 08/31] ci: isolate surge preview token --- .github/workflows/surge-preview.yml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/surge-preview.yml b/.github/workflows/surge-preview.yml index 6ae656d0..0e18579a 100644 --- a/.github/workflows/surge-preview.yml +++ b/.github/workflows/surge-preview.yml @@ -22,12 +22,17 @@ jobs: persist-credentials: false - name: Install dependencies run: npm install --legacy-peer-deps --ignore-scripts --no-audit --loglevel=warn + - name: Build preview + if: ${{ secrets.SURGE_TOKEN != '' }} + run: npm run build - uses: afc163/surge-preview@bf90a5a86111f6311ca42f0a5a0f80fb0fb03cec + if: ${{ secrets.SURGE_TOKEN != '' }} + env: + SURGE_TOKEN: ${{ secrets.SURGE_TOKEN }} with: - build: npm run build dist: docs-dist failOnError: false github_token: ${{ secrets.GITHUB_TOKEN }} - surge_token: ${{ secrets.SURGE_TOKEN }} + surge_token: ${{ env.SURGE_TOKEN }} env: NPM_CONFIG_LEGACY_PEER_DEPS: 'true' From 6ebb6a5855edf68302e42dffcc639e9d8d781333 Mon Sep 17 00:00:00 2001 From: afc163 Date: Sat, 27 Jun 2026 22:20:42 +0800 Subject: [PATCH 09/31] docs: add Chinese README --- README.md | 2 ++ README.zh-CN.md | 88 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 90 insertions(+) create mode 100644 README.zh-CN.md diff --git a/README.md b/README.md index a896f37f..35e023c1 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,8 @@

+

English | 简体中文

+ ## Highlights diff --git a/README.zh-CN.md b/README.zh-CN.md new file mode 100644 index 00000000..84089013 --- /dev/null +++ b/README.zh-CN.md @@ -0,0 +1,88 @@ +
+

@rc-component/util

+

Ant Design 生态的一部分。

+

🧰 rc-component 共享工具集合,包含 DOM、React 和测试辅助能力。

+

+ npm version + npm downloads + CI + Codecov + bundle size + dumi +

+
+ +

English | 简体中文

+ + +## 特性 + +- Built for React and maintained by the rc-component team. +- 被 Ant Design 使用和其他 React 组件库使用。 +- 提供 TypeScript declarations with both ES module and CommonJS outputs. +- 保留 examples, tests, and preview builds aligned with the package source. + +> This package was historically published as `rc-util`. Prefer the scoped package for new code. + +## 安装 + +```bash +npm install @rc-component/util +``` + +## 使用 + +```tsx | pure +import { + Portal, + raf, + useEvent, + useLayoutEffect, + warning, +} from '@rc-component/util'; +``` + +## 示例 + +Run the local dumi site to explore the examples: + +```bash +npm install +npm start +``` + +## API + +The package exposes small, focused helpers used across rc-component and Ant Design packages. Import the public entry when possible, and use subpath imports for specialized DOM, React, or test helpers. + +| 范围 | Examples | +| --------------- | ---------------------------------------------------------------------------------- | +| React hooks | `useEvent`, `useLayoutEffect`, `useMergedState`, `useState` helpers | +| React utilities | `Children/toArray`, `composeRef`, `pickAttrs`, `Portal` | +| DOM utilities | `Dom/canUseDom`, `Dom/contains`, `Dom/dynamicCSS`, `Dom/focus`, `getScrollBarSize` | +| Async helpers | `raf`, `raf.cancel` | +| Warnings | `warning`, `noteOnce`, `resetWarned` | +| Tests | `test/domHook` for DOM prototype spies | + +Examples in `docs/examples` cover the commonly used subpath helpers. + +## 本地开发 + +```bash +npm install +npm start +npm test +npm run build +``` + +## 发布 + +```bash +npm run prepublishOnly +``` + +The release flow is handled by `@rc-component/np` through the `rc-np` command after the package build. + +## 许可证 + +@rc-component/util is released under the [MIT](./LICENSE) license. From 01f46000d6f416316add67ad3a1f13205b21144f Mon Sep 17 00:00:00 2001 From: afc163 Date: Sat, 27 Jun 2026 22:35:16 +0800 Subject: [PATCH 10/31] docs: add Ant Design logo to README --- README.md | 1 + README.zh-CN.md | 1 + 2 files changed, 2 insertions(+) diff --git a/README.md b/README.md index 35e023c1..41723828 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@

@rc-component/util

Part of the Ant Design ecosystem.

+ Ant Design

🛠️ Shared React utilities for rc-component packages.

npm version diff --git a/README.zh-CN.md b/README.zh-CN.md index 84089013..272b19d0 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -1,6 +1,7 @@

@rc-component/util

Ant Design 生态的一部分。

+ Ant Design

🧰 rc-component 共享工具集合,包含 DOM、React 和测试辅助能力。

npm version From d70dee382ae1405770703246701ba19f8a3dc492 Mon Sep 17 00:00:00 2001 From: afc163 Date: Sat, 27 Jun 2026 23:04:29 +0800 Subject: [PATCH 11/31] docs: refine bilingual README branding --- README.md | 3 +-- README.zh-CN.md | 23 +++++++++++------------ 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 41723828..c24954a5 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,6 @@

@rc-component/util

-

Part of the Ant Design ecosystem.

- Ant Design +

Ant Design Part of the Ant Design ecosystem.

🛠️ Shared React utilities for rc-component packages.

npm version diff --git a/README.zh-CN.md b/README.zh-CN.md index 272b19d0..14c58e3d 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -1,8 +1,7 @@

@rc-component/util

-

Ant Design 生态的一部分。

- Ant Design -

🧰 rc-component 共享工具集合,包含 DOM、React 和测试辅助能力。

+

Ant Design Ant Design 生态的一部分。

+

🛠️ rc-component 共享工具集合,包含 DOM、React 和测试辅助能力。

npm version npm downloads @@ -18,12 +17,12 @@ ## 特性 -- Built for React and maintained by the rc-component team. +- 面向 React 构建,并由 rc-component 团队维护。 - 被 Ant Design 使用和其他 React 组件库使用。 -- 提供 TypeScript declarations with both ES module and CommonJS outputs. -- 保留 examples, tests, and preview builds aligned with the package source. +- 提供 TypeScript 类型声明,同时输出 ES module 和 CommonJS 产物。 +- 示例、测试和预览构建与包源码保持一致。 -> This package was historically published as `rc-util`. Prefer the scoped package for new code. +> 该包历史上曾以 `rc-util` 发布。新代码推荐使用带 scope 的包名。 ## 安装 @@ -45,7 +44,7 @@ import { ## 示例 -Run the local dumi site to explore the examples: +运行本地 dumi 站点查看示例: ```bash npm install @@ -54,7 +53,7 @@ npm start ## API -The package exposes small, focused helpers used across rc-component and Ant Design packages. Import the public entry when possible, and use subpath imports for specialized DOM, React, or test helpers. +该包提供在 rc-component 和 Ant Design 包中复用的小型聚焦工具。优先导入公开入口;针对 DOM、React 或测试辅助能力,可使用子路径导入。 | 范围 | Examples | | --------------- | ---------------------------------------------------------------------------------- | @@ -65,7 +64,7 @@ The package exposes small, focused helpers used across rc-component and Ant Desi | Warnings | `warning`, `noteOnce`, `resetWarned` | | Tests | `test/domHook` for DOM prototype spies | -Examples in `docs/examples` cover the commonly used subpath helpers. +`docs/examples` 中的示例覆盖了常用的子路径辅助工具。 ## 本地开发 @@ -82,8 +81,8 @@ npm run build npm run prepublishOnly ``` -The release flow is handled by `@rc-component/np` through the `rc-np` command after the package build. +包构建完成后,发布流程由 `@rc-component/np` 通过 `rc-np` 命令处理。 ## 许可证 -@rc-component/util is released under the [MIT](./LICENSE) license. +@rc-component/util 基于 [MIT](./LICENSE) 许可证发布。 From aa3bbaf556eed934549da4381382dec8f15676da Mon Sep 17 00:00:00 2001 From: afc163 Date: Sun, 28 Jun 2026 01:28:46 +0800 Subject: [PATCH 12/31] chore: standardize rc tooling and docs --- .dumirc.ts | 2 +- README.md | 4 +++- README.zh-CN.md | 4 +++- package.json | 40 ++++++++++++++++++++-------------------- tsconfig.json | 48 +++++++++++++++++++++++++++++++++++++----------- 5 files changed, 64 insertions(+), 34 deletions(-) diff --git a/.dumirc.ts b/.dumirc.ts index 74320d24..d5d1c9f8 100644 --- a/.dumirc.ts +++ b/.dumirc.ts @@ -2,7 +2,7 @@ import { defineConfig } from 'dumi'; import path from 'path'; const basePath = process.env.GH_PAGES ? '/util/' : '/'; -const publicPath = process.env.GH_PAGES ? '/util/' : '/'; +const publicPath = basePath; export default defineConfig({ alias: { diff --git a/README.md b/README.md index c24954a5..64a2aa10 100644 --- a/README.md +++ b/README.md @@ -44,13 +44,15 @@ import { ## Examples -Run the local dumi site to explore the examples: +Run the local dumi site: ```bash npm install npm start ``` +Then open `http://localhost:8000`. + ## API The package exposes small, focused helpers used across rc-component and Ant Design packages. Import the public entry when possible, and use subpath imports for specialized DOM, React, or test helpers. diff --git a/README.zh-CN.md b/README.zh-CN.md index 14c58e3d..9027a7dc 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -44,13 +44,15 @@ import { ## 示例 -运行本地 dumi 站点查看示例: +运行本地 dumi 站点: ```bash npm install npm start ``` +然后打开 `http://localhost:8000`。 + ## API 该包提供在 rc-component 和 Ant Design 包中复用的小型聚焦工具。优先导入公开入口;针对 DOM、React 或测试辅助能力,可使用子路径导入。 diff --git a/package.json b/package.json index 9efe0107..4db0b1b7 100644 --- a/package.json +++ b/package.json @@ -48,32 +48,32 @@ }, "devDependencies": { "@rc-component/father-plugin": "^2.2.0", - "@rc-component/np": "^1.0.3", - "@testing-library/react": "^16.0.0", - "@types/jest": "^30.0.0", - "@types/node": "^25.0.3", - "@types/react": "^19.2.7", - "@types/react-dom": "^19.2.2", + "@rc-component/np": "^1.0.4", + "@testing-library/react": "^15.0.7", + "@types/jest": "^29.5.14", + "@types/node": "^26.0.1", + "@types/react": "^18.3.31", + "@types/react-dom": "^18.3.7", "@types/react-is": "^19.0.0", "@types/responselike": "^1.0.0", - "@types/warning": "^3.0.0", - "@umijs/fabric": "^3.0.0", + "@types/warning": "^3.0.4", + "@umijs/fabric": "^4.0.1", "cross-env": "^10.1.0", - "dumi": "^2.1.3", - "eslint": "^8.54.0", - "eslint-plugin-jest": "^29.0.1", + "dumi": "^2.4.35", + "eslint": "^8.57.1", + "eslint-plugin-jest": "^27.9.0", "eslint-plugin-unicorn": "^56.0.1", - "father": "^4.1.3", - "glob": "^13.0.0", - "husky": "^9.1.6", - "lint-staged": "^17.0.3", - "prettier": "^3.3.2", - "rc-test": "^7.0.14", - "react": "^18.0.0", + "father": "^4.6.23", + "glob": "^13.0.6", + "husky": "^9.1.7", + "lint-staged": "^16.4.0", + "prettier": "^3.9.0", + "rc-test": "^7.1.3", + "react": "^18.3.1", "react-19": "npm:react@19.0.0", - "react-dom": "^18.0.0", + "react-dom": "^18.3.1", "react-dom-19": "npm:react-dom@19.0.0", - "typescript": "^5.3.2", + "typescript": "^5.9.3", "gh-pages": "^6.3.0" }, "peerDependencies": { diff --git a/tsconfig.json b/tsconfig.json index 35ae87d6..478fe6c5 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -8,16 +8,42 @@ "skipLibCheck": true, "esModuleInterop": true, "paths": { - "@/*": ["src/*"], - "@@/*": [".dumi/tmp/*"], - "@rc-component/util": ["src/index.ts"], - "@rc-component/util/es": ["src"], - "@rc-component/util/es/*": ["src/*"], - "rc-util": ["src/index.ts"], - "rc-util/es": ["src"], - "rc-util/es/*": ["src/*"] - } + "@/*": [ + "src/*" + ], + "@@/*": [ + ".dumi/tmp/*" + ], + "@rc-component/util": [ + "src/index.ts" + ], + "@rc-component/util/es": [ + "src" + ], + "@rc-component/util/es/*": [ + "src/*" + ], + "rc-util": [ + "src/index.ts" + ], + "rc-util/es": [ + "src" + ], + "rc-util/es/*": [ + "src/*" + ] + }, + "ignoreDeprecations": "5.0" }, - "include": [".dumirc.ts", "src", "tests", "docs/examples"], - "exclude": ["docs-dist", "lib", "es"] + "include": [ + ".dumirc.ts", + "src", + "tests", + "docs/examples" + ], + "exclude": [ + "docs-dist", + "lib", + "es" + ] } From 5a6c6fe737eaca664702b265f0081371f2a3e567 Mon Sep 17 00:00:00 2001 From: afc163 Date: Sun, 28 Jun 2026 02:01:10 +0800 Subject: [PATCH 13/31] chore: address standardization review comments --- .github/workflows/surge-preview.yml | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/.github/workflows/surge-preview.yml b/.github/workflows/surge-preview.yml index 0e18579a..79b27274 100644 --- a/.github/workflows/surge-preview.yml +++ b/.github/workflows/surge-preview.yml @@ -20,13 +20,23 @@ jobs: - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 with: persist-credentials: false + - name: Check Surge token + id: surge-token + env: + SURGE_TOKEN: ${{ secrets.SURGE_TOKEN }} + run: | + if [ -n "$SURGE_TOKEN" ]; then + echo "enabled=true" >> "$GITHUB_OUTPUT" + else + echo "enabled=false" >> "$GITHUB_OUTPUT" + fi - name: Install dependencies run: npm install --legacy-peer-deps --ignore-scripts --no-audit --loglevel=warn - name: Build preview - if: ${{ secrets.SURGE_TOKEN != '' }} + if: ${{ steps.surge-token.outputs.enabled == 'true' }} run: npm run build - uses: afc163/surge-preview@bf90a5a86111f6311ca42f0a5a0f80fb0fb03cec - if: ${{ secrets.SURGE_TOKEN != '' }} + if: ${{ steps.surge-token.outputs.enabled == 'true' }} env: SURGE_TOKEN: ${{ secrets.SURGE_TOKEN }} with: From 0873b3ec4b6310de4504a7f92eaaf0965b8495c3 Mon Sep 17 00:00:00 2001 From: afc163 Date: Sun, 28 Jun 2026 02:10:35 +0800 Subject: [PATCH 14/31] chore: include father config in type checks --- tsconfig.json | 1 + 1 file changed, 1 insertion(+) diff --git a/tsconfig.json b/tsconfig.json index 478fe6c5..391c4119 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -36,6 +36,7 @@ "ignoreDeprecations": "5.0" }, "include": [ + ".fatherrc.ts", ".dumirc.ts", "src", "tests", From 0ac6877961fc8341aab6fdd343feedfe3af3ab6f Mon Sep 17 00:00:00 2001 From: afc163 Date: Sun, 28 Jun 2026 12:25:03 +0800 Subject: [PATCH 15/31] ci: update GitHub Actions versions --- .github/workflows/codeql.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index f911ba30..cff935e0 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -29,15 +29,15 @@ jobs: persist-credentials: false - name: Initialize CodeQL - uses: github/codeql-action/init@8aad20d150bbac5944a9f9d289da16a4b0d87c1e + uses: github/codeql-action/init@a0853c24544627f65ddf259abe73b1d18a591444 with: languages: ${{ matrix.language }} queries: +security-and-quality - name: Autobuild - uses: github/codeql-action/autobuild@8aad20d150bbac5944a9f9d289da16a4b0d87c1e + uses: github/codeql-action/autobuild@a0853c24544627f65ddf259abe73b1d18a591444 - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@8aad20d150bbac5944a9f9d289da16a4b0d87c1e + uses: github/codeql-action/analyze@a0853c24544627f65ddf259abe73b1d18a591444 with: category: '/language:${{ matrix.language }}' From 45749c987be56af1e7be14416fa65edc7d5fd5cc Mon Sep 17 00:00:00 2001 From: afc163 Date: Sun, 28 Jun 2026 12:30:34 +0800 Subject: [PATCH 16/31] ci: use resolvable CodeQL action ref --- .github/workflows/codeql.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index cff935e0..f911ba30 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -29,15 +29,15 @@ jobs: persist-credentials: false - name: Initialize CodeQL - uses: github/codeql-action/init@a0853c24544627f65ddf259abe73b1d18a591444 + uses: github/codeql-action/init@8aad20d150bbac5944a9f9d289da16a4b0d87c1e with: languages: ${{ matrix.language }} queries: +security-and-quality - name: Autobuild - uses: github/codeql-action/autobuild@a0853c24544627f65ddf259abe73b1d18a591444 + uses: github/codeql-action/autobuild@8aad20d150bbac5944a9f9d289da16a4b0d87c1e - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@a0853c24544627f65ddf259abe73b1d18a591444 + uses: github/codeql-action/analyze@8aad20d150bbac5944a9f9d289da16a4b0d87c1e with: category: '/language:${{ matrix.language }}' From 6226c0b8d989dd3d70c791acc57ccae38c869729 Mon Sep 17 00:00:00 2001 From: afc163 Date: Sun, 28 Jun 2026 12:40:52 +0800 Subject: [PATCH 17/31] ci: fix surge preview env --- .github/workflows/surge-preview.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/surge-preview.yml b/.github/workflows/surge-preview.yml index 79b27274..40deb9d9 100644 --- a/.github/workflows/surge-preview.yml +++ b/.github/workflows/surge-preview.yml @@ -39,10 +39,9 @@ jobs: if: ${{ steps.surge-token.outputs.enabled == 'true' }} env: SURGE_TOKEN: ${{ secrets.SURGE_TOKEN }} + NPM_CONFIG_LEGACY_PEER_DEPS: 'true' with: dist: docs-dist failOnError: false github_token: ${{ secrets.GITHUB_TOKEN }} surge_token: ${{ env.SURGE_TOKEN }} - env: - NPM_CONFIG_LEGACY_PEER_DEPS: 'true' From d1775f8088ac55afe486564f9835170631f43869 Mon Sep 17 00:00:00 2001 From: afc163 Date: Sun, 28 Jun 2026 13:47:16 +0800 Subject: [PATCH 18/31] ci: use test-utoo workflow from main --- .github/workflows/react-component-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/react-component-ci.yml b/.github/workflows/react-component-ci.yml index a33292ef..d91f4b47 100644 --- a/.github/workflows/react-component-ci.yml +++ b/.github/workflows/react-component-ci.yml @@ -11,5 +11,5 @@ permissions: jobs: test: - uses: react-component/rc-test/.github/workflows/test-utoo.yml@b8ebddc81ef706b50faff0242ab34ad8ecdd9a59 + uses: react-component/rc-test/.github/workflows/test-utoo.yml@main secrets: inherit From 1d27e6fe6f96f5dedc315f9846e3bd24b412382b Mon Sep 17 00:00:00 2001 From: afc163 Date: Sun, 28 Jun 2026 14:03:47 +0800 Subject: [PATCH 19/31] ci: use actions checkout v7 --- .github/workflows/codeql.yml | 2 +- .github/workflows/react-doctor.yml | 2 +- .github/workflows/surge-preview.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index f911ba30..4ddf3594 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -24,7 +24,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 + uses: actions/checkout@v7 with: persist-credentials: false diff --git a/.github/workflows/react-doctor.yml b/.github/workflows/react-doctor.yml index 9e0dfb91..56430b6e 100644 --- a/.github/workflows/react-doctor.yml +++ b/.github/workflows/react-doctor.yml @@ -16,7 +16,7 @@ jobs: react-doctor: runs-on: ubuntu-latest steps: - - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 + - uses: actions/checkout@v7 with: persist-credentials: false - uses: millionco/react-doctor@0b4f4f4bd248a154e64eb508a48347f71154b3f3 diff --git a/.github/workflows/surge-preview.yml b/.github/workflows/surge-preview.yml index 40deb9d9..93f9d3d0 100644 --- a/.github/workflows/surge-preview.yml +++ b/.github/workflows/surge-preview.yml @@ -17,7 +17,7 @@ jobs: preview: runs-on: ubuntu-latest steps: - - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 + - uses: actions/checkout@v7 with: persist-credentials: false - name: Check Surge token From df0290645c9bd89278332433954afd7c2ccb2005 Mon Sep 17 00:00:00 2001 From: afc163 Date: Sun, 28 Jun 2026 14:32:43 +0800 Subject: [PATCH 20/31] chore: standardize package metadata --- package.json | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 4db0b1b7..dc548205 100644 --- a/package.json +++ b/package.json @@ -6,13 +6,13 @@ "react", "util" ], - "homepage": "https://github.com/react-component/util", + "homepage": "https://react-component.github.io/util", "bugs": { - "url": "https://github.com/react-component/util/issues" + "url": "https://github.com/react-component/util/issues" }, "repository": { "type": "git", - "url": "git@github.com:react-component/util.git" + "url": "https://github.com/react-component/util.git" }, "license": "MIT", "main": "./lib/index", @@ -79,5 +79,8 @@ "peerDependencies": { "react": ">=18.0.0", "react-dom": ">=18.0.0" + }, + "publishConfig": { + "access": "public" } } From fbeaa02e45dbcec13be63d7968aebc0c520c6039 Mon Sep 17 00:00:00 2001 From: afc163 Date: Sun, 28 Jun 2026 14:39:05 +0800 Subject: [PATCH 21/31] ci: standardize dependabot updates --- .github/dependabot.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 0737a7d8..3b730ef9 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -6,4 +6,14 @@ updates: interval: weekly day: monday time: '21:00' + timezone: Asia/Shanghai + open-pull-requests-limit: 10 + + - package-ecosystem: github-actions + directory: '/' + schedule: + interval: weekly + day: monday + time: '21:00' + timezone: Asia/Shanghai open-pull-requests-limit: 10 From 28a431cf7a53922d5266c1087f2a378b2034b5cc Mon Sep 17 00:00:00 2001 From: afc163 Date: Sun, 28 Jun 2026 16:29:15 +0800 Subject: [PATCH 22/31] docs: fix Chinese README API names --- README.zh-CN.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.zh-CN.md b/README.zh-CN.md index 9027a7dc..15f85360 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -57,7 +57,7 @@ npm start 该包提供在 rc-component 和 Ant Design 包中复用的小型聚焦工具。优先导入公开入口;针对 DOM、React 或测试辅助能力,可使用子路径导入。 -| 范围 | Examples | +| 范围 | 示例 | | --------------- | ---------------------------------------------------------------------------------- | | React hooks | `useEvent`, `useLayoutEffect`, `useMergedState`, `useState` helpers | | React utilities | `Children/toArray`, `composeRef`, `pickAttrs`, `Portal` | From f4e2774304833ef8f1935335ddf1d6a7bdd186a1 Mon Sep 17 00:00:00 2001 From: afc163 Date: Sun, 28 Jun 2026 16:53:32 +0800 Subject: [PATCH 23/31] docs: localize Chinese README descriptions --- README.zh-CN.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.zh-CN.md b/README.zh-CN.md index 15f85360..b98899aa 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -64,7 +64,7 @@ npm start | DOM utilities | `Dom/canUseDom`, `Dom/contains`, `Dom/dynamicCSS`, `Dom/focus`, `getScrollBarSize` | | Async helpers | `raf`, `raf.cancel` | | Warnings | `warning`, `noteOnce`, `resetWarned` | -| Tests | `test/domHook` for DOM prototype spies | +| Tests | `test/domHook` 用于 DOM 原型 spy | `docs/examples` 中的示例覆盖了常用的子路径辅助工具。 From 64f0b5fbbba079487d1f68f87637187abf50f8d8 Mon Sep 17 00:00:00 2001 From: afc163 Date: Sun, 28 Jun 2026 17:17:11 +0800 Subject: [PATCH 24/31] chore: refine preview workflow ignores --- .github/workflows/surge-preview.yml | 1 + .prettierignore | 14 ++++++++++++++ 2 files changed, 15 insertions(+) create mode 100644 .prettierignore diff --git a/.github/workflows/surge-preview.yml b/.github/workflows/surge-preview.yml index 93f9d3d0..0a721ebf 100644 --- a/.github/workflows/surge-preview.yml +++ b/.github/workflows/surge-preview.yml @@ -31,6 +31,7 @@ jobs: echo "enabled=false" >> "$GITHUB_OUTPUT" fi - name: Install dependencies + if: ${{ steps.surge-token.outputs.enabled == 'true' }} run: npm install --legacy-peer-deps --ignore-scripts --no-audit --loglevel=warn - name: Build preview if: ${{ steps.surge-token.outputs.enabled == 'true' }} diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 00000000..c466d872 --- /dev/null +++ b/.prettierignore @@ -0,0 +1,14 @@ +node_modules +coverage +docs-dist +dist +es +lib +.dumi/tmp +.dumi/tmp-production +.vercel +package-lock.json +pnpm-lock.yaml +yarn.lock +bun.lockb +*.log From 986c4f6d4fd6ae4cf03216baceee1751263628f1 Mon Sep 17 00:00:00 2001 From: afc163 Date: Sun, 28 Jun 2026 19:14:40 +0800 Subject: [PATCH 25/31] docs: polish Chinese README wording --- README.zh-CN.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/README.zh-CN.md b/README.zh-CN.md index b98899aa..7b192a0d 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -59,12 +59,12 @@ npm start | 范围 | 示例 | | --------------- | ---------------------------------------------------------------------------------- | -| React hooks | `useEvent`, `useLayoutEffect`, `useMergedState`, `useState` helpers | -| React utilities | `Children/toArray`, `composeRef`, `pickAttrs`, `Portal` | -| DOM utilities | `Dom/canUseDom`, `Dom/contains`, `Dom/dynamicCSS`, `Dom/focus`, `getScrollBarSize` | -| Async helpers | `raf`, `raf.cancel` | -| Warnings | `warning`, `noteOnce`, `resetWarned` | -| Tests | `test/domHook` 用于 DOM 原型 spy | +| React hooks | `useEvent`, `useLayoutEffect`, `useMergedState`, `useState` 辅助方法 | +| React 工具 | `Children/toArray`, `composeRef`, `pickAttrs`, `Portal` | +| DOM 工具 | `Dom/canUseDom`, `Dom/contains`, `Dom/dynamicCSS`, `Dom/focus`, `getScrollBarSize` | +| 异步辅助方法 | `raf`, `raf.cancel` | +| 警告工具 | `warning`, `noteOnce`, `resetWarned` | +| 测试工具 | `test/domHook` 用于 DOM 原型 spy | `docs/examples` 中的示例覆盖了常用的子路径辅助工具。 From 90cbf5be61ab076625899a89786438ea53f0f003 Mon Sep 17 00:00:00 2001 From: afc163 Date: Sun, 28 Jun 2026 19:40:00 +0800 Subject: [PATCH 26/31] docs: document dumi dev server port --- README.md | 2 ++ README.zh-CN.md | 2 ++ 2 files changed, 4 insertions(+) diff --git a/README.md b/README.md index 64a2aa10..8116d83d 100644 --- a/README.md +++ b/README.md @@ -77,6 +77,8 @@ npm test npm run build ``` +The dumi site runs at `http://localhost:8000` by default. + ## Release ```bash diff --git a/README.zh-CN.md b/README.zh-CN.md index 7b192a0d..2884afd8 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -77,6 +77,8 @@ npm test npm run build ``` +dumi 站点默认运行在 `http://localhost:8000`。 + ## 发布 ```bash From 8a2bd0569997a741178a031666049c3a4258ef02 Mon Sep 17 00:00:00 2001 From: afc163 Date: Sun, 28 Jun 2026 19:59:44 +0800 Subject: [PATCH 27/31] chore: standardize husky configuration --- .husky/pre-commit | 3 --- package.json | 8 +++----- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/.husky/pre-commit b/.husky/pre-commit index d24fdfc6..2312dc58 100755 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -1,4 +1 @@ -#!/usr/bin/env sh -. "$(dirname -- "$0")/_/husky.sh" - npx lint-staged diff --git a/package.json b/package.json index dc548205..dbecc679 100644 --- a/package.json +++ b/package.json @@ -34,13 +34,11 @@ "prettier": "prettier --write --ignore-unknown .", "start": "dumi dev", "test": "rc-test", - "tsc": "tsc --noEmit" + "tsc": "tsc --noEmit", + "prepare": "husky" }, "lint-staged": { - "**/*.{js,jsx,tsx,ts,md,json}": [ - "prettier --write", - "git add" - ] + "*": "prettier --write --ignore-unknown" }, "dependencies": { "is-mobile": "^5.0.0", From 4e3dd544931549f74dc8695e63ec454a9e18b6e3 Mon Sep 17 00:00:00 2001 From: afc163 Date: Sun, 28 Jun 2026 20:33:50 +0800 Subject: [PATCH 28/31] chore: standardize package type entry --- package.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index dbecc679..0e98b6bb 100644 --- a/package.json +++ b/package.json @@ -80,5 +80,6 @@ }, "publishConfig": { "access": "public" - } + }, + "types": "./es/index.d.ts" } From 391962d6f60786347be55bce41cd164bad580a3b Mon Sep 17 00:00:00 2001 From: afc163 Date: Sun, 28 Jun 2026 21:02:03 +0800 Subject: [PATCH 29/31] docs: normalize readme badges --- README.md | 13 +++++++------ README.zh-CN.md | 13 +++++++------ 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 8116d83d..ee0e3e66 100644 --- a/README.md +++ b/README.md @@ -2,13 +2,14 @@

@rc-component/util

Ant Design Part of the Ant Design ecosystem.

🛠️ Shared React utilities for rc-component packages.

+

- npm version - npm downloads - CI - Codecov - bundle size - dumi + NPM version + npm downloads + build status + Codecov + bundle size + dumi

diff --git a/README.zh-CN.md b/README.zh-CN.md index 2884afd8..0b3e6dbc 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -2,13 +2,14 @@

@rc-component/util

Ant Design Ant Design 生态的一部分。

🛠️ rc-component 共享工具集合,包含 DOM、React 和测试辅助能力。

+

- npm version - npm downloads - CI - Codecov - bundle size - dumi + NPM version + npm downloads + build status + Codecov + bundle size + dumi

From e31753f5860699e3f6aaab77fa1072d1d87bd181 Mon Sep 17 00:00:00 2001 From: afc163 Date: Sun, 28 Jun 2026 21:21:52 +0800 Subject: [PATCH 30/31] ci: limit reusable workflow secrets --- .github/workflows/react-component-ci.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/react-component-ci.yml b/.github/workflows/react-component-ci.yml index d91f4b47..958b6753 100644 --- a/.github/workflows/react-component-ci.yml +++ b/.github/workflows/react-component-ci.yml @@ -12,4 +12,6 @@ permissions: jobs: test: uses: react-component/rc-test/.github/workflows/test-utoo.yml@main - secrets: inherit + secrets: + + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} From 2708a4669bc2af12075545e4357d1c6a759f65e8 Mon Sep 17 00:00:00 2001 From: afc163 Date: Sun, 28 Jun 2026 21:30:39 +0800 Subject: [PATCH 31/31] ci: restore reusable workflow compatibility --- .github/workflows/react-component-ci.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/react-component-ci.yml b/.github/workflows/react-component-ci.yml index 958b6753..d91f4b47 100644 --- a/.github/workflows/react-component-ci.yml +++ b/.github/workflows/react-component-ci.yml @@ -12,6 +12,4 @@ permissions: jobs: test: uses: react-component/rc-test/.github/workflows/test-utoo.yml@main - secrets: - - CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + secrets: inherit