Skip to content

Commit 85e9ae1

Browse files
committed
fix(react19): support react19, use changesets, use new github workflow
1 parent 4105581 commit 85e9ae1

12 files changed

Lines changed: 605 additions & 88 deletions

File tree

.changeset/README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Changesets
2+
3+
Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
4+
with multi-package repos, or single-package repos to help you version and publish your code. You can
5+
find the full documentation for it [in our repository](https://github.com/changesets/changesets)
6+
7+
We have a quick list of common questions to get you started engaging with this project in
8+
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)

.changeset/config.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"$schema": "https://unpkg.com/@changesets/config@3.1.2/schema.json",
3+
"changelog": "@changesets/cli/changelog",
4+
"commit": false,
5+
"fixed": [],
6+
"linked": [],
7+
"access": "restricted",
8+
"baseBranch": "main",
9+
"updateInternalDependencies": "patch",
10+
"ignore": []
11+
}

.changeset/kind-coats-mix.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"react-base-virtual-list": patch
3+
---
4+
5+
fix(react19): support react19, use changesets, use new github workflow

.github/workflows/build.yml

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

.github/workflows/publish.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Publish Package & Docs
2+
on:
3+
push:
4+
branches:
5+
- main
6+
7+
permissions:
8+
contents: write
9+
id-token: write
10+
pages: write # 必须:部署 Pages 需要
11+
statuses: write
12+
13+
jobs:
14+
# 任务 1:发布到 npm
15+
release:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/checkout@v4
19+
- uses: actions/setup-node@v4
20+
with:
21+
node-version: 20
22+
registry-url: "https://registry.npmjs.org"
23+
- run: pnpm install
24+
- name: Create Release PR or Publish
25+
id: changesets
26+
uses: changesets/action@v1
27+
with:
28+
publish: pnpm changeset publish --provenance
29+
env:
30+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
31+
32+
# 任务 2:部署文档到 GitHub Pages
33+
deploy-docs:
34+
runs-on: ubuntu-latest
35+
steps:
36+
- uses: actions/checkout@v4
37+
- uses: actions/setup-node@v4
38+
with:
39+
node-version: 20
40+
41+
- run: pnpm install
42+
- name: Build Docs
43+
run: pnpm run demo:build
44+
45+
- name: Upload artifact
46+
uses: actions/upload-pages-artifact@v3
47+
with:
48+
path: "./dist-demo"
49+
50+
- name: Deploy to GitHub Pages
51+
id: deployment
52+
uses: actions/deploy-pages@v4

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ lerna-debug.log*
1010
node_modules
1111
dist
1212
dist-ssr
13+
dist-demo
1314
*.local
1415

1516
# Editor directories and files

README.md

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
# react-base-virtual-list ![GitHub License](https://img.shields.io/github/license/phphe/react-base-virtual-list) ![NPM Version](https://img.shields.io/npm/v/react-base-virtual-list) ![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/phphe/react-base-virtual-list/build.yml) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/react-base-virtual-list)
1+
# react-base-virtual-list ![License](https://img.shields.io/github/license/phphe/react-base-virtual-list) ![NPM Version](https://img.shields.io/npm/v/react-base-virtual-list) ![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/phphe/react-base-virtual-list/publish.yml) [![Changelog](https://img.shields.io/badge/changelog-latest-blue.svg)](./CHANGELOG.md)
22

33
[中文](README_CN.md)
44

5-
React basic virtual list, supports common features and is easy to customize. Support React 18, 19. [Online Demo](https://phphe.github.io/react-base-virtual-list/)
5+
React basic virtual list, supports common features and is easy to customize. Support React 18, 19. [Online Demo](https://phphe.github.io/react-base-virtual-list/) | [Changelog](./CHANGELOG.md)
66

77
## Features
88

@@ -111,7 +111,7 @@ Irrelevant parts are omitted in the above code. `VirtualListHandle` is a `typesc
111111
interface VirtualListHandle {
112112
scrollToIndex(
113113
index: number,
114-
block?: "start" | "end" | "center" | "nearest"
114+
block?: "start" | "end" | "center" | "nearest",
115115
): void;
116116
getRootElement(): HTMLElement;
117117
forceUpdate(): void;
@@ -142,10 +142,6 @@ You can also use the following third-party CDN url to include it.
142142
## Development
143143

144144
- `lib`: The main files, also the files that are packaged into the library. Running `npm run build` will package the files in this directory into the `dist` folder. The corresponding Vite configuration file is `vite.build.ts`.
145-
- `src`: The files used for development and debugging. Running `npm run dev` will run the code in this directory in the browser. Running `npm run build:web` will package the code in this directory into the `dist` folder. The corresponding Vite configuration file is `vite.config.ts`.
145+
- `src`: The files used for development and debugging. Running `npm run dev` will run the code in this directory in the browser. Running `npm run demo:build` will package the code in this directory into the `dist-demo` folder. The corresponding Vite configuration file is `vite.config.ts`.
146146
- `uno.config.ts`: [unocss](https://github.com/unocss/unocss) configuration file. `unocss` only works in the `src` folder. With the current configuration, you can use `Tailwindcss` style class names.
147-
- `.github/workflows/build.yml`: Some automated actions performed when publishing to GitHub. You can delete or modify it.
148-
149-
## Changelog
150-
151-
https://github.com/phphe/react-base-virtual-list/releases
147+
- `.github/workflows/publish.yml`: Some automated actions performed when publishing to GitHub pages and npmjs.com. You can delete or modify it.

README_CN.md

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
# react-base-virtual-list ![GitHub License](https://img.shields.io/github/license/phphe/react-base-virtual-list) ![NPM Version](https://img.shields.io/npm/v/react-base-virtual-list) ![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/phphe/react-base-virtual-list/build.yml) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/%40phphe%2Freact-base-virtual-list)
1+
# react-base-virtual-list ![License](https://img.shields.io/github/license/phphe/react-base-virtual-list) ![NPM Version](https://img.shields.io/npm/v/react-base-virtual-list) ![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/phphe/react-base-virtual-list/publish.yml) [![Changelog](https://img.shields.io/badge/changelog-latest-blue.svg)](./CHANGELOG.md)
22

33
[English](README.md)
44

5-
React 基础虚拟列表,实现了常用功能并且易于二次开发。支持React 18, 19。[在线示例](https://phphe.github.io/react-base-virtual-list/)
5+
React 基础虚拟列表,实现了常用功能并且易于二次开发。支持React 18, 19。[在线示例](https://phphe.github.io/react-base-virtual-list/) | [更新记录](./CHANGELOG.md)
66

77
## 特点
88

@@ -141,10 +141,6 @@ interface VirtualListHandle {
141141
## 开发指南
142142

143143
- `lib`: 主要文件,也是打包成库的文件。运行`npm run build`会打包其中的文件到`dist`目录。对应 vite 配置文件为: `vite.build.ts`.
144-
- `src`: 开发时调试的文件。运行`npm run dev`会在浏览器中运行其中的代码。运行`npm run build:web`会把其中的代码打包到`dist`目录。对应 vite 配置文件为: `vite.config.ts`.
144+
- `src`: 开发时调试的文件。运行`npm run dev`会在浏览器中运行其中的代码。运行`npm run demo:build`会把其中的代码打包到`dist-demo`目录。对应 vite 配置文件为: `vite.config.ts`.
145145
- `uno.config.ts`: [unocss](https://github.com/unocss/unocss) 配置文件。`unocss`仅在`src`文件夹生效。当前配置下,你可以使用`Tailwindcss`风格的`class`名。
146-
- `.github/workflows/build.yml`: 发布到 github 时自动进行的一些操作。你可以删除或者修改。
147-
148-
## 更新日志(changelog)
149-
150-
https://github.com/phphe/react-base-virtual-list/releases
146+
- `.github/workflows/publish.yml`: 发布到 github pages 和 npmjs.com 时自动进行的一些操作。你可以删除或者修改。

package.json

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,18 +29,19 @@
2929
"scripts": {
3030
"dev": "vite",
3131
"build": "vite build --config vite.build.js && vite build --config vite.build.js -- --iife && rm -rf dist/src",
32-
"build:web": "tsc && vite build",
32+
"demo:build": "tsc && vite build",
3333
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
34-
"preview": "vite preview"
34+
"preview": "vite preview",
35+
"change": "changeset",
36+
"version-packages": "changeset version",
37+
"release": "changeset publish"
3538
},
36-
"dependencies": {},
3739
"peerDependencies": {
3840
"react": "^18 || ^19",
3941
"react-dom": "^18 || ^19"
4042
},
4143
"devDependencies": {
42-
"react": "^18.2.0",
43-
"react-dom": "^18.2.0",
44+
"@changesets/cli": "^2.29.8",
4445
"@types/react": "^18.2.43",
4546
"@types/react-dom": "^18.2.17",
4647
"@typescript-eslint/eslint-plugin": "^6.14.0",
@@ -50,9 +51,15 @@
5051
"eslint": "^8.55.0",
5152
"eslint-plugin-react-hooks": "^4.6.0",
5253
"eslint-plugin-react-refresh": "^0.4.5",
54+
"react": "^18.2.0",
55+
"react-dom": "^18.2.0",
5356
"typescript": "^5.2.2",
5457
"unocss": "^0.58.4",
5558
"vite": "^5.0.8",
5659
"vite-plugin-dts": "^3.7.2"
60+
},
61+
"publishConfig": {
62+
"access": "public",
63+
"provenance": true
5764
}
5865
}

0 commit comments

Comments
 (0)