Skip to content

Commit bbca1c7

Browse files
committed
chore: standardize repository config
1 parent 2e032d4 commit bbca1c7

15 files changed

Lines changed: 225 additions & 144 deletions

.dumirc.ts

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,22 @@
11
import { defineConfig } from 'dumi';
2+
import path from 'path';
3+
4+
const basePath = process.env.GH_PAGES ? '/virtual-list/' : '/';
5+
const publicPath = process.env.GH_PAGES ? '/virtual-list/' : '/';
26

37
export default defineConfig({
8+
alias: {
9+
'@rc-component/virtual-list$': path.resolve('src'),
10+
'@rc-component/virtual-list/es': path.resolve('src'),
11+
'@rc-component/virtual-list/es/*': path.resolve('src'),
12+
},
13+
mfsu: false,
14+
favicons: ['https://avatars0.githubusercontent.com/u/9441414?s=200&v=4'],
415
themeConfig: {
5-
name: 'Tree',
16+
name: 'Virtual List',
17+
logo: 'https://avatars0.githubusercontent.com/u/9441414?s=200&v=4',
618
},
7-
outputPath: '.doc',
19+
outputPath: 'docs-dist',
20+
base: basePath,
21+
publicPath,
822
});

.github/FUNDING.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
github: ant-design
2+
open_collective: ant-design

.github/dependabot.yml

Lines changed: 7 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,9 @@
11
version: 2
22
updates:
3-
- package-ecosystem: npm
4-
directory: "/"
5-
schedule:
6-
interval: daily
7-
time: "21:00"
8-
open-pull-requests-limit: 10
9-
ignore:
10-
- dependency-name: np
11-
versions:
12-
- 7.2.0
13-
- 7.3.0
14-
- 7.4.0
15-
- dependency-name: "@types/react"
16-
versions:
17-
- 17.0.0
18-
- 17.0.1
19-
- 17.0.2
20-
- 17.0.3
21-
- dependency-name: "@types/jest"
22-
versions:
23-
- 26.0.20
24-
- 26.0.21
25-
- 26.0.22
26-
- dependency-name: react
27-
versions:
28-
- 16.14.0
29-
- 17.0.1
30-
- dependency-name: "@types/react-dom"
31-
versions:
32-
- 17.0.0
33-
- 17.0.1
34-
- 17.0.2
35-
- dependency-name: typescript
36-
versions:
37-
- 4.1.3
38-
- 4.1.4
39-
- 4.1.5
40-
- 4.2.2
41-
- 4.2.3
3+
- package-ecosystem: npm
4+
directory: '/'
5+
schedule:
6+
interval: weekly
7+
day: monday
8+
time: '21:00'
9+
open-pull-requests-limit: 10

.github/workflows/codeql.yml

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
name: "CodeQL"
1+
name: CodeQL
22

33
on:
44
push:
5-
branches: [ "master" ]
5+
branches: [master]
66
pull_request:
7-
branches: [ "master" ]
7+
branches: [master]
88
schedule:
9-
- cron: "48 4 * * 3"
9+
- cron: '40 12 * * 0'
1010

1111
jobs:
1212
analyze:
@@ -20,22 +20,24 @@ jobs:
2020
strategy:
2121
fail-fast: false
2222
matrix:
23-
language: [ javascript ]
23+
language: [javascript]
2424

2525
steps:
2626
- name: Checkout
27-
uses: actions/checkout@v3
27+
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0
28+
with:
29+
persist-credentials: false
2830

2931
- name: Initialize CodeQL
30-
uses: github/codeql-action/init@v2
32+
uses: github/codeql-action/init@8aad20d150bbac5944a9f9d289da16a4b0d87c1e
3133
with:
3234
languages: ${{ matrix.language }}
3335
queries: +security-and-quality
3436

3537
- name: Autobuild
36-
uses: github/codeql-action/autobuild@v2
38+
uses: github/codeql-action/autobuild@8aad20d150bbac5944a9f9d289da16a4b0d87c1e
3739

3840
- name: Perform CodeQL Analysis
39-
uses: github/codeql-action/analyze@v2
41+
uses: github/codeql-action/analyze@8aad20d150bbac5944a9f9d289da16a4b0d87c1e
4042
with:
41-
category: "/language:${{ matrix.language }}"
43+
category: '/language:${{ matrix.language }}'

.github/workflows/main.yml

Lines changed: 0 additions & 6 deletions
This file was deleted.
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
name: ✅ test
2+
3+
on:
4+
push:
5+
branches: [master]
6+
pull_request:
7+
branches: [master]
8+
9+
permissions:
10+
contents: read
11+
12+
jobs:
13+
test:
14+
uses: react-component/rc-test/.github/workflows/test-utoo.yml@main
15+
secrets: inherit

.github/workflows/react-doctor.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: React Doctor
2+
3+
on:
4+
pull_request:
5+
branches: [master]
6+
7+
permissions:
8+
contents: read
9+
pull-requests: write
10+
11+
concurrency:
12+
group: react-doctor-${{ github.event.pull_request.number || github.ref }}
13+
cancel-in-progress: true
14+
15+
jobs:
16+
react-doctor:
17+
runs-on: ubuntu-latest
18+
steps:
19+
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0
20+
with:
21+
persist-credentials: false
22+
- uses: millionco/react-doctor@0b4f4f4bd248a154e64eb508a48347f71154b3f3
23+
with:
24+
github-token: ${{ secrets.GITHUB_TOKEN }}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Surge Preview
2+
3+
on:
4+
pull_request:
5+
branches: [master]
6+
7+
permissions:
8+
contents: read
9+
pull-requests: write
10+
statuses: write
11+
12+
concurrency:
13+
group: surge-preview-${{ github.event.pull_request.number || github.ref }}
14+
cancel-in-progress: true
15+
16+
jobs:
17+
preview:
18+
runs-on: ubuntu-latest
19+
steps:
20+
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0
21+
with:
22+
persist-credentials: false
23+
- uses: afc163/surge-preview@bf90a5a86111f6311ca42f0a5a0f80fb0fb03cec
24+
with:
25+
build: npm run build
26+
dist: docs-dist
27+
failOnMissingToken: false
28+
env:
29+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
30+
SURGE_TOKEN: ${{ secrets.SURGE_TOKEN }}

.gitignore

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,14 @@ pnpm-lock.yaml
1111
!tests/__mocks__/rc-util/lib
1212
!tests/__mocks__/@rc-component/util/lib
1313
bun.lockb
14-
1514
# umi
1615
.umi
1716
.umi-production
1817
.umi-test
1918
.env.local
20-
21-
.dumi
19+
.dumi
20+
lib
21+
es
22+
coverage
23+
docs-dist
24+
.vercel

README.md

Lines changed: 82 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -1,79 +1,98 @@
1-
# @rc-component/virtual-list
2-
3-
React Virtual List Component which works with animation.
4-
5-
[![NPM version][npm-image]][npm-url]
6-
[![npm download][download-image]][download-url]
7-
[![build status][github-actions-image]][github-actions-url]
8-
[![Codecov][codecov-image]][codecov-url]
9-
[![bundle size][bundlephobia-image]][bundlephobia-url]
10-
[![dumi][dumi-image]][dumi-url]
11-
12-
[npm-image]: https://img.shields.io/npm/v/@rc-component/virtual-list.svg?style=flat-square
13-
[npm-url]: https://npmjs.org/package/@rc-component/virtual-list
14-
[travis-image]: https://img.shields.io/travis/react-component/virtual-list/master?style=flat-square
15-
[travis-url]: https://travis-ci.com/react-component/virtual-list
16-
[github-actions-image]: https://github.com/react-component/virtual-list/actions/workflows/main.yml/badge.svg
17-
[github-actions-url]: https://github.com/react-component/virtual-list/actions/workflows/main.yml
18-
[codecov-image]: https://img.shields.io/codecov/c/github/react-component/virtual-list/master.svg?style=flat-square
19-
[codecov-url]: https://app.codecov.io/gh/react-component/virtual-list
20-
[david-url]: https://david-dm.org/react-component/virtual-list
21-
[david-image]: https://david-dm.org/react-component/virtual-list/status.svg?style=flat-square
22-
[david-dev-url]: https://david-dm.org/react-component/virtual-list?type=dev
23-
[david-dev-image]: https://david-dm.org/react-component/virtual-list/dev-status.svg?style=flat-square
24-
[download-image]: https://img.shields.io/npm/dm/@rc-component/virtual-list.svg?style=flat-square
25-
[download-url]: https://npmjs.org/package/@rc-component/virtual-list
26-
[bundlephobia-url]: https://bundlephobia.com/package/@rc-component/virtual-list
27-
[bundlephobia-image]: https://badgen.net/bundlephobia/minzip/@rc-component/virtual-list
28-
[dumi-url]: https://github.com/umijs/dumi
29-
[dumi-image]: https://img.shields.io/badge/docs%20by-dumi-blue?style=flat-square
30-
31-
## Online Preview
32-
33-
https://virtual-list-react-component.vercel.app/
1+
<div align="center">
2+
<h1>@rc-component/virtual-list</h1>
3+
<p>📜 Virtual scrolling list component for React.</p>
4+
<p>
5+
<a href="https://ant.design">
6+
<img width="32" height="32" src="https://gw.alipayobjects.com/zos/bmw-prod/ae669a89-0c24-40ff-a91d-2b83497170f6.svg" alt="Ant Design" />
7+
</a>
8+
</p>
9+
<p>Part of the <a href="https://ant.design">Ant Design</a> ecosystem.</p>
10+
<p>
11+
<a href="https://www.npmjs.com/package/@rc-component/virtual-list"><img src="https://img.shields.io/npm/v/@rc-component/virtual-list.svg?style=flat-square" alt="npm version" /></a>
12+
<a href="https://www.npmjs.com/package/@rc-component/virtual-list"><img src="https://img.shields.io/npm/dm/@rc-component/virtual-list.svg?style=flat-square" alt="npm downloads" /></a>
13+
<a href="https://github.com/react-component/virtual-list/actions/workflows/react-component-ci.yml"><img src="https://github.com/react-component/virtual-list/actions/workflows/react-component-ci.yml/badge.svg" alt="CI" /></a>
14+
<a href="https://app.codecov.io/gh/react-component/virtual-list"><img src="https://img.shields.io/codecov/c/github/react-component/virtual-list/master.svg?style=flat-square" alt="Codecov" /></a>
15+
<a href="https://bundlephobia.com/package/@rc-component/virtual-list"><img src="https://badgen.net/bundlephobia/minzip/@rc-component/virtual-list" alt="bundle size" /></a>
16+
<a href="https://github.com/umijs/dumi"><img src="https://img.shields.io/badge/docs%20by-dumi-blue?style=flat-square" alt="dumi" /></a>
17+
</p>
18+
</div>
19+
20+
## Highlights
21+
22+
- Built for React and maintained by the rc-component team.
23+
- Used by Ant Design and other React component libraries.
24+
- Ships TypeScript declarations with both ES module and CommonJS outputs.
25+
- Keeps examples, tests, and preview builds aligned with the package source.
3426

35-
## Development
27+
## Install
3628

3729
```bash
38-
npm install
39-
npm start
40-
open http://localhost:8000/
30+
npm install @rc-component/virtual-list
4131
```
4232

43-
## Feature
33+
## Usage
34+
35+
```tsx
36+
import List from '@rc-component/virtual-list';
4437

45-
- Support react.js
46-
- Support animation
47-
- Support IE11+
38+
const data = Array.from({ length: 1000 }).map((_, index) => ({
39+
id: index,
40+
label: `Item ${index}`,
41+
}));
4842

49-
## Install
43+
export default () => (
44+
<List data={data} height={240} itemHeight={32} itemKey="id">
45+
{(item) => <div>{item.label}</div>}
46+
</List>
47+
);
48+
```
5049

51-
[![@rc-component/virtual-list](https://nodei.co/npm/@rc-component/virtual-list.png)](https://npmjs.org/package/@rc-component/virtual-list)
50+
## Examples
5251

53-
## Usage
52+
Run the local dumi site to explore the examples:
5453

55-
```tsx
56-
import List from '@rc-component/virtual-list';
54+
```bash
55+
npm install
56+
npm start
57+
```
58+
59+
## API
60+
61+
### List
62+
63+
| Prop | Description | Type | Default |
64+
| ---------- | ---------------------------------------------------------------------------------------------------------------------- | -------------------------------------- | ------- |
65+
| children | Render function for each item. The third argument contains measuring props used by legacy browser compatibility paths. | `(item, index, props) => ReactElement` | - |
66+
| component | Custom list container element. | `string` \| `ComponentType` | `div` |
67+
| data | Items rendered by the virtual list. | `T[]` | - |
68+
| disabled | Disable scroll position checks, usually while coordinating animation. | `boolean` | `false` |
69+
| fullHeight | Whether the holder should keep full height. | `boolean` | `true` |
70+
| height | Visible list height. | `number` | - |
71+
| itemHeight | Minimum item height used to calculate the virtual range. | `number` | - |
72+
| itemKey | Key field or key getter for items. | `string` \| `(item) => React.Key` | - |
73+
| onScroll | Called when the list scrolls. | `React.UIEventHandler<HTMLElement>` | - |
74+
| styles | Custom scrollbar part styles. | `object` | - |
75+
| virtual | Enable virtual rendering. | `boolean` | `true` |
76+
77+
## Development
5778

58-
<List data={[0, 1, 2]} height={200} itemHeight={30} itemKey="id">
59-
{(index) => <div>{index}</div>}
60-
</List>;
79+
```bash
80+
npm install
81+
npm start
82+
npm test
83+
npm run tsc
84+
npm run compile
85+
npm run build
6186
```
6287

63-
# API
88+
## Release
6489

65-
## List
90+
The release flow is handled by `@rc-component/np` from the `prepublishOnly` script:
91+
92+
```bash
93+
npm publish
94+
```
6695

67-
| Prop | Description | Type | Default |
68-
| ---------- | ------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------- |
69-
| children | Render props of item | (item, index, props) => ReactElement | - |
70-
| component | Customize List dom element | string \| Component | div |
71-
| data | Data list | Array | - |
72-
| disabled | Disable scroll check. Usually used on animation control | boolean | false |
73-
| height | List height | number | - |
74-
| itemHeight | Item minimum height | number | - |
75-
| itemKey | Match key with item | string | - |
76-
| styles | style | { horizontalScrollBar?: React.CSSProperties; horizontalScrollBarThumb?: React.CSSProperties; verticalScrollBar?: React.CSSProperties; verticalScrollBarThumb?: React.CSSProperties; } | - |
96+
## License
7797

78-
`children` provides additional `props` argument to support IE 11 scroll shaking.
79-
It will set `style` to `visibility: hidden` when measuring. You can ignore this if no requirement on IE.
98+
@rc-component/virtual-list is released under the MIT license.

0 commit comments

Comments
 (0)