Skip to content

Commit e135b99

Browse files
committed
chore: standardize repository maintenance
1 parent 53fc81e commit e135b99

10 files changed

Lines changed: 297 additions & 30 deletions

File tree

.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: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
version: 2
2+
updates:
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/codeql.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: 'CodeQL'
2+
3+
on:
4+
push:
5+
branches: ['master']
6+
pull_request:
7+
branches: ['master']
8+
schedule:
9+
- cron: '36 13 * * 3'
10+
11+
jobs:
12+
analyze:
13+
name: Analyze
14+
runs-on: ubuntu-latest
15+
permissions:
16+
actions: read
17+
contents: read
18+
security-events: write
19+
20+
strategy:
21+
fail-fast: false
22+
matrix:
23+
language: [javascript-typescript]
24+
25+
steps:
26+
- name: Checkout
27+
uses: actions/checkout@v7
28+
with:
29+
persist-credentials: false
30+
31+
- name: Initialize CodeQL
32+
uses: github/codeql-action/init@8aad20d150bbac5944a9f9d289da16a4b0d87c1e
33+
with:
34+
languages: ${{ matrix.language }}
35+
queries: +security-and-quality
36+
37+
- name: Autobuild
38+
uses: github/codeql-action/autobuild@8aad20d150bbac5944a9f9d289da16a4b0d87c1e
39+
40+
- name: Perform CodeQL Analysis
41+
uses: github/codeql-action/analyze@8aad20d150bbac5944a9f9d289da16a4b0d87c1e
42+
with:
43+
category: '/language:${{ matrix.language }}'

.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: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
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: Build preview
32+
if: ${{ steps.surge-token.outputs.enabled == 'true' }}
33+
run: |
34+
npm install
35+
npm run build
36+
- uses: afc163/surge-preview@bf90a5a86111f6311ca42f0a5a0f80fb0fb03cec
37+
if: ${{ steps.surge-token.outputs.enabled == 'true' }}
38+
env:
39+
SURGE_TOKEN: ${{ secrets.SURGE_TOKEN }}
40+
with:
41+
surge_token: ${{ env.SURGE_TOKEN }}
42+
github_token: ${{ secrets.GITHUB_TOKEN }}
43+
dist: docs-dist
44+
failOnError: false
45+
setCommitStatus: false
46+
- name: Skip Surge preview
47+
if: ${{ steps.surge-token.outputs.enabled != 'true' }}
48+
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: 55 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,73 @@
1-
# @rc-component/mini-decimal
1+
<div align="center">
2+
<h1>@rc-component/mini-decimal</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>🧮 Small decimal calculator for precise string-based arithmetic.</p>
25

3-
A mini decimal calculator which only support `add`, `multi` or compare operation for mini bundle size.
6+
<p>
7+
<a href="https://npmjs.org/package/@rc-component/mini-decimal"><img alt="NPM version" src="https://img.shields.io/npm/v/@rc-component/mini-decimal.svg?style=flat-square"></a>
8+
<a href="https://npmjs.org/package/@rc-component/mini-decimal"><img alt="npm downloads" src="https://img.shields.io/npm/dm/@rc-component/mini-decimal.svg?style=flat-square"></a>
9+
<a href="https://github.com/react-component/mini-decimal/actions/workflows/test.yml"><img alt="build status" src="https://github.com/react-component/mini-decimal/actions/workflows/test.yml/badge.svg"></a>
10+
<a href="https://app.codecov.io/gh/react-component/mini-decimal"><img alt="Codecov" src="https://img.shields.io/codecov/c/github/react-component/mini-decimal/master.svg?style=flat-square"></a>
11+
<a href="https://bundlephobia.com/package/@rc-component/mini-decimal"><img alt="bundle size" src="https://img.shields.io/bundlephobia/minzip/@rc-component/mini-decimal?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-
[![NPM version][npm-image]][npm-url] [![dumi](https://img.shields.io/badge/docs%20by-dumi-blue?style=flat-square)](https://github.com/umijs/dumi) [![build status][github-actions-image]][github-actions-url] [![Codecov][codecov-image]][codecov-url] [![npm download][download-image]][download-url]
16+
<p align="center">English | [简体中文](./README.zh-CN.md)</p>
617

7-
[npm-image]: http://img.shields.io/npm/v/@rc-component/mini-decimal.svg?style=flat-square
8-
[npm-url]: http://npmjs.org/package/@rc-component/mini-decimal
9-
[github-actions-image]: https://github.com/react-component/mini-decimal/workflows/CI/badge.svg
10-
[github-actions-url]: https://github.com/react-component/mini-decimal/actions
11-
[codecov-image]: https://img.shields.io/codecov/c/github/react-component/mini-decimal/master.svg?style=flat-square
12-
[codecov-url]: https://codecov.io/gh/react-component/mini-decimal/branch/master
13-
[download-image]: https://img.shields.io/npm/dm/@rc-component/mini-decimal.svg?style=flat-square
14-
[download-url]: https://npmjs.org/package/@rc-component/mini-decimal
18+
## Highlights
1519

16-
## Development
20+
| Area | Support |
21+
| ------- | ------------------------------------------------------------- |
22+
| Purpose | Small decimal calculator for precise string-based arithmetic. |
23+
| Package | `@rc-component/mini-decimal` |
24+
| Release | `@rc-component/np` / `rc-np` |
25+
26+
## Install
1727

1828
```bash
19-
npm install
20-
npm test
29+
npm install @rc-component/mini-decimal
2130
```
2231

2332
## Usage
2433

25-
```tsx
34+
```tsx | pure
2635
import getMiniDecimal from '@rc-component/mini-decimal';
2736

28-
// Add
2937
getMiniDecimal('0.1').add('0.2').toString(); // 0.3
30-
31-
// Multi
3238
getMiniDecimal('0.1').multi('0.2').toString(); // 0.02
39+
```
40+
41+
## API
3342

34-
// Negate
35-
getMiniDecimal('0.1').negate().toString(); // -0.1
43+
| Method | Description |
44+
| ------------------- | ---------------------------------- |
45+
| `add(value)` | Add another decimal value. |
46+
| `multi(value)` | Multiply by another decimal value. |
47+
| `negate()` | Return the negated value. |
48+
| `equal(value)` | Check equality. |
49+
| `lessEquals(value)` | Compare two decimal values. |
3650

37-
// Equal
38-
getMiniDecimal('0.1').equal('0.1'); // true
39-
getMiniDecimal('0.1').equal('0.2'); // false
51+
## Development
4052

41-
// Less Equals
42-
getMiniDecimal('0.1').lessEquals('0.2'); // true
43-
getMiniDecimal('0.1').lessEquals('0.1'); // false
53+
```bash
54+
npm install
55+
npm test
56+
npm run lint
57+
npm run tsc
58+
npm run compile
4459
```
60+
61+
The dumi site runs at `http://localhost:8000`.
62+
63+
## Release
64+
65+
```bash
66+
npm run prepublishOnly
67+
```
68+
69+
The release flow is handled by `@rc-component/np` through the `rc-np` command when the package uses the shared release flow.
70+
71+
## License
72+
73+
@rc-component/mini-decimal is released under the [MIT](./LICENSE) license.

README.zh-CN.md

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
<div align="center">
2+
<h1>@rc-component/mini-decimal</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>🧮 用于精确字符串小数运算的轻量计算工具。</p>
5+
6+
<p>
7+
<a href="https://npmjs.org/package/@rc-component/mini-decimal"><img alt="NPM version" src="https://img.shields.io/npm/v/@rc-component/mini-decimal.svg?style=flat-square"></a>
8+
<a href="https://npmjs.org/package/@rc-component/mini-decimal"><img alt="npm downloads" src="https://img.shields.io/npm/dm/@rc-component/mini-decimal.svg?style=flat-square"></a>
9+
<a href="https://github.com/react-component/mini-decimal/actions/workflows/test.yml"><img alt="build status" src="https://github.com/react-component/mini-decimal/actions/workflows/test.yml/badge.svg"></a>
10+
<a href="https://app.codecov.io/gh/react-component/mini-decimal"><img alt="Codecov" src="https://img.shields.io/codecov/c/github/react-component/mini-decimal/master.svg?style=flat-square"></a>
11+
<a href="https://bundlephobia.com/package/@rc-component/mini-decimal"><img alt="bundle size" src="https://img.shields.io/bundlephobia/minzip/@rc-component/mini-decimal?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">简体中文 | [English](./README.md)</p>
17+
18+
## 亮点
19+
20+
| 方向 | 支持 |
21+
| ---- | -------------------------------------- |
22+
| 定位 | 用于精确字符串小数运算的轻量计算工具。 |
23+
| 包名 | `@rc-component/mini-decimal` |
24+
| 发布 | `@rc-component/np` / `rc-np` |
25+
26+
## 安装
27+
28+
```bash
29+
npm install @rc-component/mini-decimal
30+
```
31+
32+
## 用法
33+
34+
```tsx | pure
35+
import getMiniDecimal from '@rc-component/mini-decimal';
36+
37+
getMiniDecimal('0.1').add('0.2').toString(); // 0.3
38+
getMiniDecimal('0.1').multi('0.2').toString(); // 0.02
39+
```
40+
41+
## API
42+
43+
| 名称 | 说明 |
44+
| ------------------- | ------------------ |
45+
| `add(value)` | 加上另一个小数值。 |
46+
| `multi(value)` | 乘以另一个小数值。 |
47+
| `negate()` | 返回相反数。 |
48+
| `equal(value)` | 判断是否相等。 |
49+
| `lessEquals(value)` | 比较两个小数值。 |
50+
51+
## 本地开发
52+
53+
```bash
54+
npm install
55+
npm test
56+
npm run lint
57+
npm run tsc
58+
npm run compile
59+
```
60+
61+
本地 dumi 站点默认运行在 `http://localhost:8000`.
62+
63+
## 发布
64+
65+
```bash
66+
npm run prepublishOnly
67+
```
68+
69+
发布流程通过 `@rc-component/np` 提供的 `rc-np` 命令处理。
70+
71+
## 许可证
72+
73+
@rc-component/mini-decimal 基于 [MIT](./LICENSE) 协议发布。

package.json

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@rc-component/mini-decimal",
33
"version": "1.1.4",
4-
"description": "Lite lib to only support decimal add calculation",
4+
"description": "🧮 Small decimal calculator for precise string-based arithmetic.",
55
"keywords": [
66
"decimal"
77
],
@@ -30,12 +30,13 @@
3030
"coverage": "rc-test --coverage",
3131
"lint": "eslint src/ --ext .tsx,.ts",
3232
"lint:tsc": "tsc -p tsconfig.json --noEmit",
33-
"now-build": "npm run docs:build",
3433
"prepublishOnly": "npm run compile && rc-np",
3534
"prettier": "prettier --write \"**/*.{js,jsx,tsx,ts,less,md,json}\"",
3635
"start": "dumi dev",
3736
"test": "rc-test",
38-
"watch": "father dev"
37+
"watch": "father dev",
38+
"build": "dumi build",
39+
"tsc": "tsc -p tsconfig.json --noEmit"
3940
},
4041
"dependencies": {
4142
"@babel/runtime": "^7.18.0"
@@ -57,7 +58,7 @@
5758
"prettier": "^3.3.3",
5859
"react": "^18.0.0",
5960
"react-dom": "^18.0.0",
60-
"rc-test": "^7.0.15",
61+
"rc-test": "^7.1.3",
6162
"typescript": "^5.4.5"
6263
},
6364
"engines": {

vercel.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"framework": "umijs",
3+
"installCommand": "npm install",
4+
"buildCommand": "npm run build",
5+
"outputDirectory": "docs-dist"
6+
}

0 commit comments

Comments
 (0)