Skip to content

Commit e5e554d

Browse files
authored
loro mirror ci release (#26)
* feat: make setState async to avoid correctness problem * fix: refine jotai and react api * chore: add release ci and update config * fix: deps
1 parent a2833bc commit e5e554d

File tree

11 files changed

+286
-107
lines changed

11 files changed

+286
-107
lines changed
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
name: Release & Publish
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- master
8+
release:
9+
types: [published]
10+
11+
permissions:
12+
contents: write
13+
pull-requests: write
14+
15+
jobs:
16+
release-please:
17+
if: github.event_name == 'push'
18+
runs-on: ubuntu-latest
19+
steps:
20+
- name: Release Please
21+
uses: google-github-actions/release-please-action@v4
22+
with:
23+
token: ${{ secrets.GITHUB_TOKEN }}
24+
command: manifest
25+
26+
publish:
27+
if: github.event_name == 'release'
28+
runs-on: ubuntu-latest
29+
steps:
30+
- name: Checkout
31+
uses: actions/checkout@v4
32+
33+
- name: Setup pnpm
34+
uses: pnpm/action-setup@v4
35+
with:
36+
version: 9
37+
38+
- name: Setup Node.js
39+
uses: actions/setup-node@v4
40+
with:
41+
node-version: 18
42+
cache: 'pnpm'
43+
registry-url: 'https://registry.npmjs.org'
44+
45+
- name: Install dependencies
46+
run: pnpm install --frozen-lockfile
47+
48+
- name: Build packages
49+
run: pnpm -r build
50+
51+
- name: Determine package from tag
52+
id: which
53+
shell: bash
54+
run: |
55+
TAG="${{ github.event.release.tag_name }}"
56+
echo "Release tag: $TAG"
57+
if [[ "$TAG" =~ ^loro-mirror-v([0-9]+\.[0-9]+\.[0-9]+) ]]; then
58+
echo "name=loro-mirror" >> "$GITHUB_OUTPUT"
59+
echo "dir=packages/core" >> "$GITHUB_OUTPUT"
60+
echo "version=${BASH_REMATCH[1]}" >> "$GITHUB_OUTPUT"
61+
elif [[ "$TAG" =~ ^loro-mirror-react-v([0-9]+\.[0-9]+\.[0-9]+) ]]; then
62+
echo "name=loro-mirror-react" >> "$GITHUB_OUTPUT"
63+
echo "dir=packages/react" >> "$GITHUB_OUTPUT"
64+
echo "version=${BASH_REMATCH[1]}" >> "$GITHUB_OUTPUT"
65+
elif [[ "$TAG" =~ ^loro-mirror-jotai-v([0-9]+\.[0-9]+\.[0-9]+) ]]; then
66+
echo "name=loro-mirror-jotai" >> "$GITHUB_OUTPUT"
67+
echo "dir=packages/jotai" >> "$GITHUB_OUTPUT"
68+
echo "version=${BASH_REMATCH[1]}" >> "$GITHUB_OUTPUT"
69+
else
70+
echo "Tag $TAG does not match known packages; skipping publish."
71+
echo "name=" >> "$GITHUB_OUTPUT"
72+
fi
73+
74+
- name: Publish to npm
75+
if: steps.which.outputs.name != ''
76+
env:
77+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
78+
run: |
79+
echo "Publishing ${{ steps.which.outputs.name }} at version ${{ steps.which.outputs.version }}"
80+
pnpm --filter "${{ steps.which.outputs.name }}" publish --no-git-checks

.release-please-manifest.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"packages/core": "0.0.0",
3+
"packages/react": "0.0.0",
4+
"packages/jotai": "0.0.0"
5+
}

packages/core/.npmignore

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Exclude tests and dev-only files from package
2+
tests/
3+
**/__snapshots__/
4+
**/*.snap
5+
src/**/*.test.ts
6+
src/**/*.test.tsx
7+
src/**/*.test-d.ts
8+
vitest.config.ts
9+
tsconfig.typecheck.json
10+
pnpm-lock.yaml
11+
*.log

packages/core/package.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,17 @@
55
"type": "module",
66
"main": "dist/index.js",
77
"types": "dist/index.d.ts",
8+
"exports": {
9+
".": {
10+
"types": "./dist/index.d.ts",
11+
"import": "./dist/index.js",
12+
"default": "./dist/index.js"
13+
}
14+
},
15+
"sideEffects": false,
16+
"publishConfig": {
17+
"access": "public"
18+
},
819
"files": [
920
"dist",
1021
"src"

packages/jotai/.npmignore

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Exclude tests and dev-only files from package
2+
tests/
3+
**/__snapshots__/
4+
**/*.snap
5+
src/**/*.test.ts
6+
src/**/*.test.tsx
7+
src/**/*.test-d.ts
8+
vitest.config.ts
9+
tsconfig.typecheck.json
10+
pnpm-lock.yaml
11+
*.log

packages/jotai/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Loro Mirror for Jotai
22

3-
Jotai integration for Loro Mirror, providing atomic state management with Loro CRDT synchronization.
3+
Jotai integration for Loro Mirror, providing atomic state management with Loro CRDT synchronization.
44

55
## Installation
66

packages/jotai/package.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,22 @@
11
{
22
"name": "loro-mirror-jotai",
33
"version": "0.1.0",
4+
"description": "Jotai integration for Loro Mirror - a state management library with Loro CRDT synchronization",
5+
"type": "module",
46
"description": "Jotai atoms for Loro Mirror: CRDT-backed atomic state with typed schema and bidirectional sync.",
57
"main": "dist/index.js",
68
"types": "dist/index.d.ts",
9+
"exports": {
10+
".": {
11+
"types": "./dist/index.d.ts",
12+
"import": "./dist/index.js",
13+
"default": "./dist/index.js"
14+
}
15+
},
16+
"sideEffects": false,
17+
"publishConfig": {
18+
"access": "public"
19+
},
720
"files": [
821
"dist"
922
],

packages/react/.npmignore

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Exclude tests and dev-only files from package
2+
tests/
3+
**/__snapshots__/
4+
**/*.snap
5+
src/**/*.test.ts
6+
src/**/*.test.tsx
7+
src/**/*.test-d.ts
8+
vitest.config.ts
9+
tsconfig.typecheck.json
10+
pnpm-lock.yaml
11+
*.log

0 commit comments

Comments
 (0)