Skip to content

Commit 9d9af12

Browse files
committed
migrate to pnpm and better changeset workflow
1 parent b106148 commit 9d9af12

13 files changed

+7923
-13838
lines changed

Diff for: .changeset/config.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"fixed": [],
66
"linked": [],
77
"access": "public",
8-
"baseBranch": "next",
8+
"baseBranch": "main",
99
"updateInternalDependencies": "patch",
1010
"ignore": []
1111
}

Diff for: .github/workflows/build.yml

+6-5
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,17 @@ jobs:
1010
runs-on: ubuntu-latest
1111
steps:
1212
- uses: actions/checkout@v3
13+
- uses: pnpm/action-setup@v2
1314
- uses: actions/setup-node@v3
1415
with:
1516
node-version-file: '.nvmrc'
16-
cache: 'npm'
17-
- run: npm ci
17+
cache: 'pnpm'
18+
- run: pnpm i
1819
- name: Lint
19-
run: npm run lint
20+
run: pnpm -r run lint
2021

2122
- name: Test
22-
run: npm test
23+
run: pnpm -r test
2324
- name: Upload code coverage
2425
uses: paambaati/[email protected]
2526
env:
@@ -28,4 +29,4 @@ jobs:
2829
coverageLocations: ${{github.workspace}}/packages/core/coverage/lcov.info:lcov
2930
prefix: test
3031
- name: Build
31-
run: npm run build
32+
run: pnpm -r run build

Diff for: .github/workflows/gh-pages.yml

+4-5
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,15 @@ jobs:
99
runs-on: ubuntu-latest
1010
steps:
1111
- uses: actions/checkout@v3
12-
with:
13-
ref: 'main'
12+
- uses: pnpm/action-setup@v2
1413
- uses: actions/setup-node@v3
1514
with:
1615
node-version-file: '.nvmrc'
17-
cache: 'npm'
16+
cache: 'pnpm'
1817
- name: Install Dependencies
19-
run: npm ci
18+
run: pnpm i
2019
- name: Generate Documentation
21-
run: npm run build --workspace=docs
20+
run: pnpm --filter=docs run build
2221
- name: Deploy
2322
uses: peaceiris/actions-gh-pages@v3
2423
with:

Diff for: .github/workflows/release.yml

+11-7
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: Version or Publish
33
on:
44
push:
55
branches:
6-
- next
6+
- main
77

88
concurrency: ${{ github.workflow }}-${{ github.ref }}
99

@@ -12,20 +12,24 @@ jobs:
1212
runs-on: ubuntu-latest
1313
steps:
1414
- uses: actions/checkout@v3
15+
- uses: pnpm/action-setup@v2
1516
- uses: actions/setup-node@v3
1617
with:
1718
node-version-file: '.nvmrc'
18-
cache: 'npm'
19-
registry-url: 'https://registry.npmjs.org'
20-
- run: npm ci
21-
- run: npm test
22-
- run: npm run build
19+
cache: 'pnpm'
20+
- run: pnpm i
21+
- run: pnpm -r test
22+
- run: pnpm -r run build
2323

2424
- name: Create Release Pull Request or Publish to npm
2525
id: changesets
2626
uses: changesets/action@v1
2727
with:
28-
publish: npm run release
28+
version: pnpm run ci:version # pnpm changeset version && pnpm install --lockfile-only
29+
publish: pnpm run ci:publish
30+
commit: 'chore: update versions'
31+
title: 'Release: new versions'
32+
createGithubReleases: false
2933
env:
3034
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3135
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

Diff for: .github/workflows/snapshot-release.yml

+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: Snapshot Release
2+
3+
on:
4+
pull_request:
5+
types: [labeled]
6+
concurrency: ${{ github.workflow }}-${{ github.ref }}
7+
8+
jobs:
9+
release:
10+
if: |
11+
(github.event.label.name == 'release: snapshot')
12+
name: Snapshot Release
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v3
16+
- uses: pnpm/action-setup@v2
17+
- uses: actions/setup-node@v3
18+
with:
19+
node-version-file: '.nvmrc'
20+
cache: 'pnpm'
21+
- run: pnpm i
22+
- run: pnpm -r test
23+
- run: pnpm -r run build
24+
25+
- name: Prepare snapshot releases
26+
run: |
27+
pnpm changeset version --snapshot
28+
pnpm install --lockfile-only
29+
30+
- name: Publish snapshot releases
31+
run: pnpm -r publish --tag=next --no-git-checks
32+
env:
33+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
34+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
35+
- name: Create or update the snapshot release PR
36+
run: |
37+
VERSIONS=$(pnpm -r ls --json --depth=-1 | jq -r 'map(select(.version | contains ("0.0.0-"))) | .[] | (.name + "@" + .version)')
38+
39+
echo "Changesets published the following snapshots:" >> msg_body
40+
echo "\`\`\`" >> msg_body
41+
echo "$VERSIONS" >> msg_body
42+
echo "\`\`\`" >> msg_body
43+
44+
echo "--------"
45+
cat msg_body
46+
echo "--------"
47+
48+
gh pr comment $BRANCH_NAME --body-file msg_body
49+
env:
50+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
51+
BRANCH_NAME: ${{ github.head_ref }}
52+
- name: Unlabel PR
53+
run: |
54+
gh pr edit $GITHUB_HEAD_REF --remove-label='release: snapshot'
55+
env:
56+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Diff for: README.md

+7-7
Original file line numberDiff line numberDiff line change
@@ -25,22 +25,22 @@
2525

2626
## Run examples
2727

28-
1. Install dependencies: `npm ci`
29-
1. Run script: `npm run examples:dev`
30-
1. Wait for the server and bundler to start-up
28+
1. Install dependencies: `pnpm install`
29+
2. Run script: `pnpm run examples:dev`
30+
3. Wait for the server and bundler to start-up
3131

3232
## Run docs on localhost
3333

34-
1. Install dependencies: `npm ci`
35-
1. Run script: `npm run docs:dev`
34+
1. Install dependencies: `pnpm install`
35+
2. Run script: `pnpm run docs:dev`
3636

3737
## Contributing
3838

3939
1. Clone this repository
40-
1. Install dependencies: `npm ci`
40+
1. Install dependencies: `pnpm install`
4141
1. Make your changes
4242
1. Update or add tests in `packages/core/__tests__/`
43-
1. Verify that everything works: `npm run lint && npm test`
43+
1. Verify that everything works: `pnpm -r run lint && pnpm -r test`
4444
1. Submit a Pull Request
4545

4646
## License

Diff for: lefthook.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ pre-commit:
33
commands:
44
linter:
55
glob: "*.{mjs,cjs,js,ts}"
6-
run: npx eslint {staged_files}
6+
run: pnpm exec eslint {staged_files}

0 commit comments

Comments
 (0)