Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 0 additions & 11 deletions .eslintrc.js

This file was deleted.

2 changes: 2 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
github: ant-design
open_collective: ant-design
53 changes: 25 additions & 28 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,30 +1,27 @@
version: 2
updates:
- package-ecosystem: npm
directory: "/"
schedule:
interval: daily
time: "21:00"
open-pull-requests-limit: 10
ignore:
- dependency-name: "@types/jest"
versions:
- 26.0.20
- 26.0.21
- 26.0.22
- 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: np
versions:
- 7.2.0
- 7.3.0
- 7.4.0
- 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
day: monday
time: '21:00'
timezone: Asia/Shanghai
open-pull-requests-limit: 10
groups:
github-actions:
patterns:
- '*'
6 changes: 0 additions & 6 deletions .github/workflows/main.yml

This file was deleted.

22 changes: 22 additions & 0 deletions .github/workflows/react-doctor.yml
Original file line number Diff line number Diff line change
@@ -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
52 changes: 52 additions & 0 deletions .github/workflows/surge-preview.yml
Original file line number Diff line number Diff line change
@@ -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."
16 changes: 16 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -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 }}
76 changes: 61 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,71 @@
# @rc-component/context
<div align="center">
<h1>@rc-component/context</h1>
<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>
<p>🔁 Performant React context selector utilities for rc-component packages.</p>

---
<p>
<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>
<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>
<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>
<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>
<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>
<a href="https://github.com/umijs/dumi"><img alt="dumi" src="https://img.shields.io/badge/docs%20by-dumi-blue?style=flat-square"></a>
</p>
</div>

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

[![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]
## Highlights

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

## Development
## Install

```bash
npm install @rc-component/context
```

## Usage

```tsx | pure
import { createContext } from '@rc-component/context';

const [Provider, useContext] = createContext({ count: 0 });

export { Provider, useContext };
```

## API

| API | Description |
| ----------------------------- | -------------------------------------------------- |
| `createContext(defaultValue)` | Create a provider and selector-aware context hook. |

## Development

```bash
npm install
npm start
npm test
npm run lint
npm run tsc
npm run compile
```

The dumi site runs at `http://localhost:8000`.

## Release

```bash
npm run prepublishOnly
```

The release flow is handled by `@rc-component/np` through the `rc-np` command when the package uses the shared release flow.

## License

@rc-component/context is released under the [MIT](./LICENSE.md) license.
71 changes: 71 additions & 0 deletions README.zh-CN.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
<div align="center">
<h1>@rc-component/context</h1>
<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>
<p>🔁 面向 rc-component 包的高性能 React Context 选择器工具。</p>

<p>
<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>
<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>
<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>
<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>
<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>
<a href="https://github.com/umijs/dumi"><img alt="dumi" src="https://img.shields.io/badge/docs%20by-dumi-blue?style=flat-square"></a>
</p>
</div>

<p align="center"><a href="./README.md">English</a> | 简体中文</p>

## 亮点

| 方向 | 支持 |
| ---- | ------------------------------------------------------- |
| 定位 | 面向 rc-component 包的高性能 React Context 选择器工具。 |
| 包名 | `@rc-component/context` |
| 发布 | `@rc-component/np` / `rc-np` |

## 安装

```bash
npm install @rc-component/context
```

## 用法

```tsx | pure
import { createContext } from '@rc-component/context';

const [Provider, useContext] = createContext({ count: 0 });

export { Provider, useContext };
```

## API

| 名称 | 说明 |
| ----------------------------- | ------------------------------------------- |
| `createContext(defaultValue)` | 创建 Provider 与支持选择器的 context hook。 |

## 本地开发

```bash
npm install
npm start
npm test
npm run lint
npm run tsc
npm run compile
```

本地 dumi 站点默认运行在 `http://localhost:8000`.

## 发布

```bash
npm run prepublishOnly
```

发布流程通过 `@rc-component/np` 提供的 `rc-np` 命令处理。

## 许可证

@rc-component/context 基于 [MIT](./LICENSE.md) 协议发布。
Loading
Loading