Skip to content

Commit db949fa

Browse files
committed
release: update docs & CI/CD
1 parent 9d8afa1 commit db949fa

File tree

3 files changed

+78
-11
lines changed

3 files changed

+78
-11
lines changed

.github/workflows/npm-publish.yml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: Publish to npm
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout repository
13+
uses: actions/checkout@v4
14+
- name: Setup Node.js
15+
uses: actions/setup-node@v4
16+
with:
17+
node-version: '22'
18+
19+
- name: Install dependencies
20+
run: |
21+
npm install pnpm --global
22+
pnpm i
23+
24+
- name: Run tests
25+
run: |
26+
pnpm run test
27+
28+
- name: Build library
29+
run: |
30+
pnpm run build
31+
32+
- name: Archive lib artifacts
33+
if: startsWith(github.event.head_commit.message, 'release')
34+
uses: actions/upload-artifact@v4
35+
with:
36+
name: lib-dist
37+
path: |
38+
!node_modules
39+
!.github
40+
!*.config.*
41+
!pnpm-lock.yaml
42+
43+
publish:
44+
needs: build
45+
if: startsWith(github.event.head_commit.message, 'release')
46+
runs-on: ubuntu-latest
47+
steps:
48+
- name: Download lib artifacts
49+
uses: actions/download-artifact@v4
50+
with:
51+
name: lib-dist
52+
- name: Set release tag
53+
run: |
54+
commit_message='${{ github.event.head_commit.message }}'
55+
if [[ $commit_message =~ --([a-zA-Z0-9_-]+)$ ]]; then
56+
tag=${BASH_REMATCH[1]}
57+
echo "npm_release_tag=$tag" >> $GITHUB_ENV
58+
fi
59+
60+
- name: Publish to npm
61+
uses: JS-DevTools/npm-publish@v3
62+
with:
63+
token: ${{ secrets.NPM_PUBLISH_TOKEN }}
64+
access: 'public'
65+
tag: ${{ env.npm_release_tag || 'latest' }}
66+

README.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# range-selection
1+
# ranges-selection
22

33
handling range selections in large scale data records such as virtual lists/grid tables.
44

@@ -14,18 +14,18 @@ WHERE id BETWEEN 0 AND 10
1414
## Installation
1515

1616
```bash
17-
npm install range-selection
17+
npm install ranges-selection
1818
# or
19-
yarn add range-selection
19+
yarn add ranges-selection
2020
# or
21-
pnpm add range-selection
21+
pnpm add ranges-selection
2222
```
2323

2424
## Usage
2525

2626
### Basic Usage
2727
```js
28-
import { Ranges } from "range-selection"
28+
import { Ranges } from "ranges-selection"
2929

3030
const ranges = new Ranges([[0, 10], [11, 15]]) // [[0, 15]]
3131

@@ -59,6 +59,7 @@ ranges.select(44) // [[0, 10], [12, 15], [44, 44]]
5959

6060
// Array of numbers
6161
ranges.select([44, 55, 56, 57]) // [[0, 10], [12, 15], [44, 44], [55, 57]]
62+
```
6263

6364
### Select Object
6465

@@ -86,7 +87,7 @@ ranges.unselect([2, 6, 7]) // [[0, 1], [3, 5], [8, 10], [12, 13], [15, 15]]
8687

8788
### Utility Functions
8889
```js
89-
import { normalize, merge, split, select, unselect, include } from 'range-selection/utils'
90+
import { normalize, merge, split, select, unselect, include } from 'ranges-selection/utils'
9091

9192
const ranges = [[0, 10], [12, 15]]
9293

package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
{
2-
"name": "range-selection",
3-
"version": "0.0.1",
2+
"name": "ranges-selection",
3+
"version": "0.0.2",
44
"description": "A range selection helper for infinite virtual List/Grid table",
5+
"repository": "github:aolyang/ranges-selection",
6+
"author": "aolyang <[email protected]>",
7+
"license": "MIT",
58
"type": "module",
69
"main": "./dist/index.js",
710
"types": "./dist/index.d.ts",
@@ -17,9 +20,6 @@
1720
"types": "./dist/utils.d.ts"
1821
}
1922
},
20-
"repository": "github:aolyang/range-selection",
21-
"author": "aolyang <[email protected]>",
22-
"license": "MIT",
2323
"scripts": {
2424
"build": "tsup --format esm,cjs && tsup --format esm --dts-only",
2525
"dev": "pnpm build --watch",

0 commit comments

Comments
 (0)