Skip to content

Commit 95f8266

Browse files
authored
chore: standardize repository maintenance (#55)
* chore: standardize repository maintenance * chore: align reusable test workflow * chore: address review feedback * chore: set up utoo for preview builds * chore: use npm install for vercel preview * chore: align maintenance dependencies * chore: fix upgraded test tooling * docs: align Chinese README language switch * fix: preserve React peer dependency range * chore: fix upgraded tooling checks * chore: align TypeScript 6 tooling checks * docs: use npm install in README * chore: migrate to native eslint flat config * chore: address review comments
1 parent 3648da4 commit 95f8266

15 files changed

Lines changed: 404 additions & 90 deletions

.eslintrc.js

Lines changed: 0 additions & 11 deletions
This file was deleted.

.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: 25 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,27 @@
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: "@types/jest"
11-
versions:
12-
- 26.0.20
13-
- 26.0.21
14-
- 26.0.22
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/react-dom"
22-
versions:
23-
- 17.0.0
24-
- 17.0.1
25-
- 17.0.2
26-
- dependency-name: np
27-
versions:
28-
- 7.2.0
29-
- 7.3.0
30-
- 7.4.0
3+
- package-ecosystem: npm
4+
directory: '/'
5+
schedule:
6+
interval: weekly
7+
day: monday
8+
time: '21:00'
9+
timezone: Asia/Shanghai
10+
open-pull-requests-limit: 10
11+
groups:
12+
npm-dependencies:
13+
patterns:
14+
- '*'
15+
16+
- package-ecosystem: github-actions
17+
directory: '/'
18+
schedule:
19+
interval: weekly
20+
day: monday
21+
time: '21:00'
22+
timezone: Asia/Shanghai
23+
open-pull-requests-limit: 10
24+
groups:
25+
github-actions:
26+
patterns:
27+
- '*'

.github/workflows/main.yml

Lines changed: 0 additions & 6 deletions
This file was deleted.

.github/workflows/react-doctor.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: React Doctor
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches: [master]
7+
8+
permissions:
9+
contents: read
10+
pull-requests: write
11+
issues: write
12+
statuses: write
13+
14+
jobs:
15+
react-doctor:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/checkout@v7
19+
with:
20+
fetch-depth: 0
21+
persist-credentials: false
22+
- uses: millionco/react-doctor@0b4f4f4bd248a154e64eb508a48347f71154b3f3
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Surge Preview
2+
3+
on:
4+
pull_request:
5+
6+
permissions:
7+
contents: read
8+
pull-requests: write
9+
checks: write
10+
11+
jobs:
12+
preview:
13+
runs-on: ubuntu-latest
14+
concurrency:
15+
group: surge-preview-${{ github.event.pull_request.number }}
16+
cancel-in-progress: true
17+
steps:
18+
- uses: actions/checkout@v7
19+
with:
20+
persist-credentials: false
21+
- name: Check Surge token
22+
id: surge-token
23+
env:
24+
SURGE_TOKEN: ${{ secrets.SURGE_TOKEN }}
25+
run: |
26+
if [ -n "$SURGE_TOKEN" ]; then
27+
echo "enabled=true" >> "$GITHUB_OUTPUT"
28+
else
29+
echo "enabled=false" >> "$GITHUB_OUTPUT"
30+
fi
31+
- name: Setup utoo
32+
if: ${{ steps.surge-token.outputs.enabled == 'true' }}
33+
uses: utooland/setup-utoo@v1
34+
35+
- name: Build preview
36+
if: ${{ steps.surge-token.outputs.enabled == 'true' }}
37+
run: |
38+
ut install
39+
npm run build
40+
- uses: afc163/surge-preview@bf90a5a86111f6311ca42f0a5a0f80fb0fb03cec
41+
if: ${{ steps.surge-token.outputs.enabled == 'true' }}
42+
env:
43+
SURGE_TOKEN: ${{ secrets.SURGE_TOKEN }}
44+
with:
45+
surge_token: ${{ env.SURGE_TOKEN }}
46+
github_token: ${{ secrets.GITHUB_TOKEN }}
47+
dist: docs-dist
48+
failOnError: false
49+
setCommitStatus: false
50+
- name: Skip Surge preview
51+
if: ${{ steps.surge-token.outputs.enabled != 'true' }}
52+
run: echo "SURGE_TOKEN is not configured; skip Surge preview."

.github/workflows/test.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
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:
16+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

README.md

Lines changed: 61 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,71 @@
1-
# @rc-component/context
1+
<div align="center">
2+
<h1>@rc-component/context</h1>
3+
<p><sub><a href="https://ant.design"><img alt="Ant Design" height="14" src="https://gw.alipayobjects.com/zos/rmsportal/KDpgvguMpGfqaHPjicRK.svg" style="vertical-align: -0.125em;" /></a> Part of the Ant Design ecosystem.</sub></p>
4+
<p>🔁 Performant React context selector utilities for rc-component packages.</p>
25

3-
---
6+
<p>
7+
<a href="https://npmjs.org/package/@rc-component/context"><img alt="NPM version" src="https://img.shields.io/npm/v/@rc-component/context.svg?style=flat-square"></a>
8+
<a href="https://npmjs.org/package/@rc-component/context"><img alt="npm downloads" src="https://img.shields.io/npm/dm/@rc-component/context.svg?style=flat-square"></a>
9+
<a href="https://github.com/react-component/context/actions/workflows/test.yml"><img alt="build status" src="https://github.com/react-component/context/actions/workflows/test.yml/badge.svg"></a>
10+
<a href="https://app.codecov.io/gh/react-component/context"><img alt="Codecov" src="https://img.shields.io/codecov/c/github/react-component/context/master.svg?style=flat-square"></a>
11+
<a href="https://bundlephobia.com/package/@rc-component/context"><img alt="bundle size" src="https://img.shields.io/bundlephobia/minzip/@rc-component/context?style=flat-square"></a>
12+
<a href="https://github.com/umijs/dumi"><img alt="dumi" src="https://img.shields.io/badge/docs%20by-dumi-blue?style=flat-square"></a>
13+
</p>
14+
</div>
415

5-
React way perf context selector
16+
<p align="center">English | <a href="./README.zh-CN.md">简体中文</a></p>
617

7-
[![NPM version][npm-image]][npm-url] [![build status][github-actions-image]][github-actions-url] [![Codecov][codecov-image]][codecov-url] [![node version][node-image]][node-url] [![npm download][download-image]][download-url]
18+
## Highlights
819

9-
[npm-image]: http://img.shields.io/npm/v/@rc-component/context.svg?style=flat-square
10-
[npm-url]: http://npmjs.org/package/@rc-component/context
11-
[github-actions-image]: https://github.com/react-component/context/workflows/CI/badge.svg
12-
[github-actions-url]: https://github.com/react-component/context/actions
13-
[codecov-image]: https://img.shields.io/codecov/c/github/react-component/context/master.svg?style=flat-square
14-
[codecov-url]: https://app.codecov.io/gh/react-component/context
15-
[node-image]: https://img.shields.io/badge/node.js-%3E=_0.10-green.svg?style=flat-square
16-
[node-url]: http://nodejs.org/download/
17-
[download-image]: https://img.shields.io/npm/dm/@rc-component/context.svg?style=flat-square
18-
[download-url]: https://npmjs.org/package/@rc-component/context
20+
| Area | Support |
21+
| ------- | ---------------------------------------------------------------------- |
22+
| Purpose | Performant React context selector utilities for rc-component packages. |
23+
| Package | `@rc-component/context` |
24+
| Release | `@rc-component/np` / `rc-np` |
1925

20-
## Development
26+
## Install
2127

28+
```bash
29+
npm install @rc-component/context
2230
```
31+
32+
## Usage
33+
34+
```tsx | pure
35+
import { createContext } from '@rc-component/context';
36+
37+
const [Provider, useContext] = createContext({ count: 0 });
38+
39+
export { Provider, useContext };
40+
```
41+
42+
## API
43+
44+
| API | Description |
45+
| ----------------------------- | -------------------------------------------------- |
46+
| `createContext(defaultValue)` | Create a provider and selector-aware context hook. |
47+
48+
## Development
49+
50+
```bash
2351
npm install
2452
npm start
53+
npm test
54+
npm run lint
55+
npm run tsc
56+
npm run compile
2557
```
58+
59+
The dumi site runs at `http://localhost:8000`.
60+
61+
## Release
62+
63+
```bash
64+
npm run prepublishOnly
65+
```
66+
67+
The release flow is handled by `@rc-component/np` through the `rc-np` command when the package uses the shared release flow.
68+
69+
## License
70+
71+
@rc-component/context is released under the [MIT](./LICENSE.md) license.

README.zh-CN.md

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
<div align="center">
2+
<h1>@rc-component/context</h1>
3+
<p><sub><a href="https://ant.design"><img alt="Ant Design" height="14" src="https://gw.alipayobjects.com/zos/rmsportal/KDpgvguMpGfqaHPjicRK.svg" style="vertical-align: -0.125em;" /></a> Ant Design 生态的一部分。</sub></p>
4+
<p>🔁 面向 rc-component 包的高性能 React Context 选择器工具。</p>
5+
6+
<p>
7+
<a href="https://npmjs.org/package/@rc-component/context"><img alt="NPM version" src="https://img.shields.io/npm/v/@rc-component/context.svg?style=flat-square"></a>
8+
<a href="https://npmjs.org/package/@rc-component/context"><img alt="npm downloads" src="https://img.shields.io/npm/dm/@rc-component/context.svg?style=flat-square"></a>
9+
<a href="https://github.com/react-component/context/actions/workflows/test.yml"><img alt="build status" src="https://github.com/react-component/context/actions/workflows/test.yml/badge.svg"></a>
10+
<a href="https://app.codecov.io/gh/react-component/context"><img alt="Codecov" src="https://img.shields.io/codecov/c/github/react-component/context/master.svg?style=flat-square"></a>
11+
<a href="https://bundlephobia.com/package/@rc-component/context"><img alt="bundle size" src="https://img.shields.io/bundlephobia/minzip/@rc-component/context?style=flat-square"></a>
12+
<a href="https://github.com/umijs/dumi"><img alt="dumi" src="https://img.shields.io/badge/docs%20by-dumi-blue?style=flat-square"></a>
13+
</p>
14+
</div>
15+
16+
<p align="center"><a href="./README.md">English</a> | 简体中文</p>
17+
18+
## 亮点
19+
20+
| 方向 | 支持 |
21+
| ---- | ------------------------------------------------------- |
22+
| 定位 | 面向 rc-component 包的高性能 React Context 选择器工具。 |
23+
| 包名 | `@rc-component/context` |
24+
| 发布 | `@rc-component/np` / `rc-np` |
25+
26+
## 安装
27+
28+
```bash
29+
npm install @rc-component/context
30+
```
31+
32+
## 用法
33+
34+
```tsx | pure
35+
import { createContext } from '@rc-component/context';
36+
37+
const [Provider, useContext] = createContext({ count: 0 });
38+
39+
export { Provider, useContext };
40+
```
41+
42+
## API
43+
44+
| 名称 | 说明 |
45+
| ----------------------------- | ------------------------------------------- |
46+
| `createContext(defaultValue)` | 创建 Provider 与支持选择器的 context hook。 |
47+
48+
## 本地开发
49+
50+
```bash
51+
npm install
52+
npm start
53+
npm test
54+
npm run lint
55+
npm run tsc
56+
npm run compile
57+
```
58+
59+
本地 dumi 站点默认运行在 `http://localhost:8000`.
60+
61+
## 发布
62+
63+
```bash
64+
npm run prepublishOnly
65+
```
66+
67+
发布流程通过 `@rc-component/np` 提供的 `rc-np` 命令处理。
68+
69+
## 许可证
70+
71+
@rc-component/context 基于 [MIT](./LICENSE.md) 协议发布。

0 commit comments

Comments
 (0)