Skip to content

Commit 04ba326

Browse files
migrate to pnpm (#609)
* migrate to `pnpm` * rename `simple-project` fixture packages to remove socket security errors * add pnpm `dedupe` options * update release-pr workflow * update * update snashots * tweaks * tweak * tweak * fix missing ci-setup * tweak * tweak deps * update pnpm * ok, Socket, let's rename them * update snapshots * rename again * fmt --------- Co-authored-by: Mateusz Burzyński <mateuszburzynski@gmail.com>
1 parent ccba80b commit 04ba326

16 files changed

Lines changed: 3721 additions & 3161 deletions

File tree

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
11
name: Setup CI
2+
description: Setup CI
23

34
runs:
45
using: composite
56
steps:
6-
- name: Setup Node.js
7-
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
7+
- name: Set up pnpm
8+
uses: pnpm/action-setup@8912a9102ac27614460f54aedde9e1e7f9aec20d # v6.0.5
9+
10+
- uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
811
with:
912
node-version-file: ".node-version"
10-
cache: yarn
13+
cache: pnpm
1114

1215
- name: Install dependencies
1316
shell: bash
14-
run: yarn install --frozen-lockfile
17+
run: pnpm install --frozen-lockfile

.github/workflows/ci.yml

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@ name: CI
33
on:
44
pull_request:
55
push:
6-
branches: [main]
6+
branches:
7+
- main
78
merge_group:
8-
branches: [main]
9+
branches:
10+
- main
911

1012
permissions:
1113
contents: read
@@ -17,23 +19,31 @@ jobs:
1719
runs-on: ubuntu-latest
1820

1921
steps:
20-
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
22+
- name: Check out repo
23+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
24+
with:
25+
persist-credentials: false
26+
2127
- uses: ./.github/actions/ci-setup
2228

2329
- name: Test
24-
run: yarn test
30+
run: pnpm test
2531

2632
typecheck:
2733
name: Typecheck
2834
timeout-minutes: 20
2935
runs-on: ubuntu-latest
3036

3137
steps:
32-
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
38+
- name: Check out repo
39+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
40+
with:
41+
persist-credentials: false
42+
3343
- uses: ./.github/actions/ci-setup
3444

3545
- name: Typecheck
36-
run: yarn typecheck
46+
run: pnpm typecheck
3747

3848
ci-ok:
3949
name: CI OK

.github/workflows/publish.yml

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,21 @@ jobs:
2121
issues: write # to post issue comments (changesets/action)
2222
pull-requests: write # to create pull request (changesets/action)
2323
steps:
24-
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
24+
- name: Check out repo
25+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
26+
with:
27+
persist-credentials: false
28+
2529
- uses: ./.github/actions/ci-setup
2630

2731
- name: Build
28-
run: yarn build
32+
run: pnpm build
2933

3034
- name: Create or update release pull request
3135
id: changesets
3236
uses: ./
3337
with:
34-
version: yarn bump
38+
version: pnpm bump
3539

3640
publish:
3741
name: Publish
@@ -49,17 +53,19 @@ jobs:
4953
client-id: ${{ vars.APP_CLIENT_ID }}
5054
private-key: ${{ secrets.APP_PRIVATE_KEY }}
5155

52-
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
56+
- name: Check out repo
57+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
5358
with:
59+
persist-credentials: true
5460
# we need this token to bypass the branch and tag protection rules
5561
token: ${{ steps.app-token.outputs.token }}
5662

5763
- uses: ./.github/actions/ci-setup
5864

5965
- name: Build
60-
run: yarn build
66+
run: pnpm build
6167

6268
- name: Publish to marketplace
6369
uses: ./
6470
with:
65-
publish: yarn release
71+
publish: pnpm release

.github/workflows/release-pr.yml

Lines changed: 28 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,14 @@ permissions: {}
99
jobs:
1010
release_check:
1111
if: github.repository == 'changesets/action' && github.event.issue.pull_request && startsWith(github.event.comment.body, '/release-pr')
12+
timeout-minutes: 5
1213
runs-on: ubuntu-latest
14+
1315
permissions:
1416
contents: read
1517
issues: write
1618
pull-requests: read
19+
1720
steps:
1821
- id: report_in_progress
1922
run: |
@@ -99,12 +102,18 @@ jobs:
99102
timeout-minutes: 20
100103
runs-on: ubuntu-latest
101104
needs: release_check
105+
102106
permissions:
103107
contents: write
104108
issues: write
105109
pull-requests: write
110+
106111
steps:
107-
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
112+
- name: Check out repo
113+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
114+
with:
115+
persist-credentials: false
116+
108117
- uses: ./.github/actions/ci-setup
109118

110119
- name: Fetch validated commit from pull request head repository
@@ -131,30 +140,34 @@ jobs:
131140
if: steps.check_version_packages.outputs.version_packages == 'true'
132141
run: git reset --hard HEAD~1
133142

134-
- run: yarn changeset version --snapshot pr${{ github.event.issue.number }}
143+
- name: Create snapshot version
144+
run: pnpm changeset version --snapshot pr${{ github.event.issue.number }}
135145
env:
136146
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
137147

138148
- name: Build
139-
run: yarn build
149+
run: pnpm build
140150

141151
- name: Setup Git user
142152
run: |
143153
git config --global user.name "github-actions[bot]"
144154
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
145155
146156
- name: Release snapshot version
147-
run: yarn run release:pr
157+
run: pnpm release:pr
148158

149-
- run: gh api /repos/${{ github.repository }}/issues/comments/${{ github.event.comment.id }}/reactions -f content='rocket'
159+
- name: Add success reaction
160+
run: gh api /repos/${{ github.repository }}/issues/comments/${{ github.event.comment.id }}/reactions -f content='rocket'
150161
env:
151162
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
152163

153-
- run: gh api -X DELETE /repos/${{ github.repository }}/issues/comments/${{ github.event.comment.id }}/reactions/${{ needs.release_check.outputs.in_progress_reaction_id }}
164+
- name: Remove in-progress reaction
165+
run: gh api -X DELETE /repos/${{ github.repository }}/issues/comments/${{ github.event.comment.id }}/reactions/${{ needs.release_check.outputs.in_progress_reaction_id }}
154166
env:
155167
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
156168

157-
- run: |
169+
- name: Comment success
170+
run: |
158171
gh pr comment ${{ github.event.issue.number }} --body "The release for \`${{ needs.release_check.outputs.resolved_sha }}\` triggered by [this comment](${{ github.event.comment.url }}) has [succeeded](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}). Published commit: [${{ github.repository }}@$(git rev-parse HEAD)](https://github.com/${{ github.repository }}/commit/$(git rev-parse HEAD))."
159172
env:
160173
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -164,19 +177,24 @@ jobs:
164177
timeout-minutes: 2
165178
runs-on: ubuntu-latest
166179
if: failure() && github.repository == 'changesets/action' && (needs.release_check.result == 'failure' || needs.release.result == 'failure')
180+
167181
permissions:
168182
issues: write
169183
pull-requests: write
184+
170185
steps:
171-
- run: gh api /repos/${{ github.repository }}/issues/comments/${{ github.event.comment.id }}/reactions -f content='-1'
186+
- name: Add failure reaction
187+
run: gh api /repos/${{ github.repository }}/issues/comments/${{ github.event.comment.id }}/reactions -f content='-1'
172188
env:
173189
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
174190

175-
- run: gh api -X DELETE /repos/${{ github.repository }}/issues/comments/${{ github.event.comment.id }}/reactions/${{ needs.release_check.outputs.in_progress_reaction_id }}
191+
- name: Remove in-progress reaction
192+
run: gh api -X DELETE /repos/${{ github.repository }}/issues/comments/${{ github.event.comment.id }}/reactions/${{ needs.release_check.outputs.in_progress_reaction_id }}
176193
env:
177194
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
178195

179-
- run: |
196+
- name: Comment failure
197+
run: |
180198
gh pr comment ${{ github.event.issue.number }} --body "The release for \`${{ needs.release_check.outputs.requested_sha }}\` triggered by [this comment](${{ github.event.comment.url }}) has [failed](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})."
181199
env:
182200
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

README.md

Lines changed: 38 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ This action for [Changesets](https://github.com/changesets/changesets) creates a
2121
- published - A boolean value to indicate whether a publishing has happened or not
2222
- publishedPackages - A JSON array to present the published packages. The format is `[{"name": "@xx/xx", "version": "1.2.0"}, {"name": "@xx/xy", "version": "0.8.9"}]`
2323

24-
### Example workflow:
24+
### Example workflow
2525

2626
#### Without Publishing
2727

@@ -43,15 +43,18 @@ jobs:
4343
runs-on: ubuntu-latest
4444
steps:
4545
- name: Checkout Repo
46-
uses: actions/checkout@v3
46+
uses: actions/checkout@v6
4747

48-
- name: Setup Node.js 20
49-
uses: actions/setup-node@v3
48+
- name: Setup pnpm
49+
uses: pnpm/action-setup@v6
50+
51+
- name: Setup Node.js 26
52+
uses: actions/setup-node@v6
5053
with:
51-
node-version: 20
54+
node-version: 26
5255

5356
- name: Install Dependencies
54-
run: yarn
57+
run: pnpm install --frozen-lockfile
5558

5659
- name: Create Release Pull Request
5760
uses: changesets/action@v1
@@ -77,22 +80,25 @@ jobs:
7780
runs-on: ubuntu-latest
7881
steps:
7982
- name: Checkout Repo
80-
uses: actions/checkout@v3
83+
uses: actions/checkout@v6
84+
85+
- name: Setup pnpm
86+
uses: pnpm/action-setup@v6
8187
82-
- name: Setup Node.js 20.x
83-
uses: actions/setup-node@v3
88+
- name: Setup Node.js 26
89+
uses: actions/setup-node@v6
8490
with:
85-
node-version: 20.x
91+
node-version: 26
8692
8793
- name: Install Dependencies
88-
run: yarn
94+
run: pnpm install --frozen-lockfile
8995
9096
- name: Create Release Pull Request or Publish to npm
9197
id: changesets
9298
uses: changesets/action@v1
9399
with:
94100
# This expects you to have a script called release which does a build for your packages and calls changeset publish
95-
publish: yarn release
101+
publish: pnpm release
96102
env:
97103
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
98104
@@ -104,7 +110,7 @@ jobs:
104110

105111
By default the GitHub Action creates a `.npmrc` file with the following content:
106112

107-
```
113+
```txt
108114
//registry.npmjs.org/:_authToken=${process.env.NPM_TOKEN}
109115
```
110116

@@ -141,15 +147,18 @@ jobs:
141147
runs-on: ubuntu-latest
142148
steps:
143149
- name: Checkout Repo
144-
uses: actions/checkout@v3
150+
uses: actions/checkout@v6
145151
146-
- name: Setup Node.js 20.x
147-
uses: actions/setup-node@v3
152+
- name: Setup pnpm
153+
uses: pnpm/action-setup@v6
154+
155+
- name: Setup Node.js 26
156+
uses: actions/setup-node@v6
148157
with:
149-
node-version: 20.x
158+
node-version: 26
150159
151160
- name: Install Dependencies
152-
run: yarn
161+
run: pnpm install --frozen-lockfile
153162
154163
- name: Create Release Pull Request or Publish to npm
155164
id: changesets
@@ -158,7 +167,7 @@ jobs:
158167
- name: Publish
159168
if: steps.changesets.outputs.hasChangesets == 'false'
160169
# You can do something when a publish should happen.
161-
run: yarn publish
170+
run: pnpm publish
162171
```
163172

164173
#### With version script
@@ -183,21 +192,24 @@ jobs:
183192
runs-on: ubuntu-latest
184193
steps:
185194
- name: Checkout Repo
186-
uses: actions/checkout@v3
195+
uses: actions/checkout@v6
196+
197+
- name: Setup pnpm
198+
uses: pnpm/action-setup@v6
187199
188-
- name: Setup Node.js 20.x
189-
uses: actions/setup-node@v3
200+
- name: Setup Node.js 26
201+
uses: actions/setup-node@v6
190202
with:
191-
node-version: 20.x
203+
node-version: 26
192204
193205
- name: Install Dependencies
194-
run: yarn
206+
run: pnpm install --frozen-lockfile
195207
196208
- name: Create Release Pull Request
197209
uses: changesets/action@v1
198210
with:
199211
# this expects you to have a npm script called version that runs some logic and then calls `changeset version`.
200-
version: yarn version
212+
version: pnpm version
201213
```
202214
203215
#### With Yarn 2 / Plug'n'Play
@@ -208,5 +220,5 @@ If you are using [Yarn Plug'n'Play](https://yarnpkg.com/features/pnp), you shoul
208220
- uses: changesets/action@v1
209221
with:
210222
version: yarn changeset version
211-
...
223+
# ...
212224
```
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
{
22
"$schema": "https://unpkg.com/@changesets/config@1.3.0/schema.json",
3-
"ignore": ["ignored-package-pkg-a"]
3+
"ignore": [
4+
"changesets-dev-ignored-package-pkg-a"
5+
]
46
}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
2-
"name": "ignored-package-pkg-a",
2+
"name": "changesets-dev-ignored-package-pkg-a",
33
"version": "1.0.0",
44
"dependencies": {
5-
"ignored-package-pkg-b": "1.0.0"
5+
"changesets-dev-ignored-package-pkg-b": "1.0.0"
66
}
77
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
2-
"name": "ignored-package-pkg-b",
2+
"name": "changesets-dev-ignored-package-pkg-b",
33
"version": "1.0.0"
44
}

0 commit comments

Comments
 (0)