diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index cf8ad0b..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1,13 +0,0 @@ -const base = require('@umijs/fabric/dist/eslint'); - -module.exports = { - ...base, - rules: { - ...base.rules, - 'no-template-curly-in-string': 0, - 'prefer-promise-reject-errors': 0, - 'react/no-array-index-key': 0, - 'react/sort-comp': 0, - '@typescript-eslint/no-explicit-any': 0, - }, -}; diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 0000000..758659a --- /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 5990d9c..5e6c7fa 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -1,11 +1,27 @@ -# To get started with Dependabot version updates, you'll need to specify which -# package ecosystems to update and where the package manifests are located. -# Please see the documentation for all configuration options: -# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file - version: 2 updates: - - package-ecosystem: "" # See documentation for possible values - directory: "/" # Location of package manifests + - package-ecosystem: npm + directory: '/' + schedule: + interval: weekly + day: monday + time: '21:00' + timezone: Asia/Shanghai + open-pull-requests-limit: 10 + groups: + npm-dependencies: + patterns: + - '*' + + - package-ecosystem: github-actions + directory: '/' schedule: - interval: "weekly" + interval: weekly + day: monday + time: '21:00' + timezone: Asia/Shanghai + open-pull-requests-limit: 10 + groups: + github-actions: + patterns: + - '*' diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 50d981e..6082fc6 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: "53 19 * * 0" + - cron: '36 13 * * 3' jobs: analyze: @@ -20,22 +20,24 @@ jobs: strategy: fail-fast: false matrix: - language: [ javascript ] + language: [javascript-typescript] steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v7 + 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/main.yml b/.github/workflows/main.yml index c99089b..a308097 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -11,14 +11,16 @@ jobs: runs-on: ubuntu-latest steps: - name: checkout - uses: actions/checkout@master + uses: actions/checkout@v7 + with: + persist-credentials: false - - uses: actions/setup-node@v1 + - uses: actions/setup-node@v6 with: node-version: '18' - name: cache package-lock.json - uses: actions/cache@v3 + uses: actions/cache@v5 with: path: package-temp-dir key: lock-${{ github.sha }} @@ -35,7 +37,7 @@ jobs: - name: cache node_modules id: node_modules_cache_id - uses: actions/cache@v3 + uses: actions/cache@v5 with: path: node_modules key: node_modules-${{ hashFiles('**/package-temp-dir/package-lock.json') }} @@ -48,16 +50,18 @@ jobs: runs-on: ubuntu-latest steps: - name: checkout - uses: actions/checkout@master + uses: actions/checkout@v7 + with: + persist-credentials: false - name: restore cache from package-lock.json - uses: actions/cache@v3 + uses: actions/cache@v5 with: path: package-temp-dir key: lock-${{ github.sha }} - name: restore cache from node_modules - uses: actions/cache@v3 + uses: actions/cache@v5 with: path: node_modules key: node_modules-${{ hashFiles('**/package-temp-dir/package-lock.json') }} @@ -71,16 +75,18 @@ jobs: runs-on: ubuntu-latest steps: - name: checkout - uses: actions/checkout@master + uses: actions/checkout@v7 + with: + persist-credentials: false - name: restore cache from package-lock.json - uses: actions/cache@v3 + uses: actions/cache@v5 with: path: package-temp-dir key: lock-${{ github.sha }} - name: restore cache from node_modules - uses: actions/cache@v3 + uses: actions/cache@v5 with: path: node_modules key: node_modules-${{ hashFiles('**/package-temp-dir/package-lock.json') }} @@ -94,16 +100,18 @@ jobs: runs-on: ubuntu-latest steps: - name: checkout - uses: actions/checkout@master + uses: actions/checkout@v7 + with: + persist-credentials: false - name: restore cache from package-lock.json - uses: actions/cache@v3 + uses: actions/cache@v5 with: path: package-temp-dir key: lock-${{ github.sha }} - name: restore cache from node_modules - uses: actions/cache@v3 + uses: actions/cache@v5 with: path: node_modules key: node_modules-${{ hashFiles('**/package-temp-dir/package-lock.json') }} diff --git a/.github/workflows/react-doctor.yml b/.github/workflows/react-doctor.yml new file mode 100644 index 0000000..29d6f76 --- /dev/null +++ b/.github/workflows/react-doctor.yml @@ -0,0 +1,22 @@ +name: React Doctor + +on: + pull_request: + push: + branches: [master] + +permissions: + contents: read + pull-requests: write + issues: write + statuses: write + +jobs: + react-doctor: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v7 + with: + fetch-depth: 0 + persist-credentials: false + - uses: millionco/react-doctor@0b4f4f4bd248a154e64eb508a48347f71154b3f3 diff --git a/.github/workflows/surge-preview.yml b/.github/workflows/surge-preview.yml new file mode 100644 index 0000000..ba9f1dd --- /dev/null +++ b/.github/workflows/surge-preview.yml @@ -0,0 +1,52 @@ +name: Surge Preview + +on: + pull_request: + +permissions: + contents: read + pull-requests: write + checks: write + +jobs: + preview: + runs-on: ubuntu-latest + concurrency: + group: surge-preview-${{ github.event.pull_request.number }} + cancel-in-progress: true + steps: + - uses: actions/checkout@v7 + 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: Setup utoo + if: ${{ steps.surge-token.outputs.enabled == 'true' }} + uses: utooland/setup-utoo@v1 + + - name: Build preview + if: ${{ steps.surge-token.outputs.enabled == 'true' }} + run: | + ut install + npm run build + - uses: afc163/surge-preview@bf90a5a86111f6311ca42f0a5a0f80fb0fb03cec + if: ${{ steps.surge-token.outputs.enabled == 'true' }} + env: + SURGE_TOKEN: ${{ secrets.SURGE_TOKEN }} + with: + surge_token: ${{ env.SURGE_TOKEN }} + github_token: ${{ secrets.GITHUB_TOKEN }} + dist: docs-dist + failOnError: false + setCommitStatus: false + - name: Skip Surge preview + if: ${{ steps.surge-token.outputs.enabled != 'true' }} + run: echo "SURGE_TOKEN is not configured; skip Surge preview." diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..10c0ebb --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,16 @@ +name: ✅ test + +on: + push: + branches: [master] + pull_request: + branches: [master] + +permissions: + contents: read + +jobs: + test: + uses: react-component/rc-test/.github/workflows/test-utoo.yml@main + secrets: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} diff --git a/README.md b/README.md index 1354af2..9849680 100644 --- a/README.md +++ b/README.md @@ -1,57 +1,77 @@ -# @rc-component/overflow 🐾 - -[![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-component/overflow.svg?style=flat-square -[npm-url]: http://npmjs.org/package/@rc-component/overflow -[github-actions-image]: https://github.com/react-component/overflow/workflows/CI/badge.svg -[github-actions-url]: https://github.com/react-component/overflow/actions -[codecov-image]: https://img.shields.io/codecov/c/github/react-component/overflow/master.svg?style=flat-square -[codecov-url]: https://codecov.io/gh/react-component/overflow/branch/master -[david-url]: https://david-dm.org/react-component/overflow -[david-image]: https://david-dm.org/react-component/overflow/status.svg?style=flat-square -[david-dev-url]: https://david-dm.org/react-component/overflow?type=dev -[david-dev-image]: https://david-dm.org/react-component/overflow/dev-status.svg?style=flat-square -[download-image]: https://img.shields.io/npm/dm/@rc-component/overflow.svg?style=flat-square -[download-url]: https://npmjs.org/package/@rc-component/overflow -[bundlephobia-url]: https://bundlephobia.com/result?p=@rc-component/overflow -[bundlephobia-image]: https://badgen.net/bundlephobia/minzip/@rc-component/overflow -[dumi-url]: https://github.com/umijs/dumi -[dumi-image]: https://img.shields.io/badge/docs%20by-dumi-blue?style=flat-square - -Auto collapse box when overflow - -## Live Demo - -https://overflow-react-component.vercel.app/ +
Part of the Ant Design ecosystem.
📦 Auto-collapse React layout primitive for rendering visible items and overflow indicators.
+ + +English | 简体中文
+ +## Highlights + +| Area | Support | +| ------- | ----------------------------------------------------------------------------------------- | +| Purpose | Auto-collapse React layout primitive for rendering visible items and overflow indicators. | +| Package | `@rc-component/overflow` | +| Release | `@rc-component/np` / `rc-np` | ## Install -[](https://npmjs.org/package/@rc-component/overflow) +```bash +npm install @rc-component/overflow +``` ## Usage -```ts -// TODO +```tsx | pure +import Overflow from '@rc-component/overflow'; + +export default () => ( +English | 简体中文
+ +## 亮点 + +| 方向 | 支持 | +| ---- | ------------------------------------------------- | +| 定位 | 用于自动折叠可见项与溢出项的 React 布局基础组件。 | +| 包名 | `@rc-component/overflow` | +| 发布 | `@rc-component/np` / `rc-np` | + +## 安装 + +```bash +npm install @rc-component/overflow +``` + +## 用法 + +```tsx | pure +import Overflow from '@rc-component/overflow'; + +export default () => ( +