Skip to content

Commit f582daf

Browse files
authored
Merge pull request #10 from forge-42/pnpm-migration
Pnpm migration
2 parents a3bbc68 + 72d4b8e commit f582daf

File tree

20 files changed

+6673
-11099
lines changed

20 files changed

+6673
-11099
lines changed

.changeset/ninety-eggs-hide.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"open-source-stack": minor
3+
---
4+
5+
We have migrated the open-source-stack to use pnpm workspaces with changesets instead of the old npm approach with npm workspaces.
Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
name: 🚀 pkg-pr-new
22
on: [push, pull_request]
33

4+
concurrency:
5+
group: ${{ github.repository }}-${{ github.workflow }}-${{ github.ref }}
6+
cancel-in-progress: true
47
jobs:
58
build:
69
runs-on: ubuntu-latest
@@ -9,16 +12,18 @@ jobs:
912
- name: Checkout code
1013
uses: actions/checkout@v2
1114

15+
- name: Install pnpm
16+
uses: pnpm/action-setup@v4
17+
1218
- run: corepack enable
1319
- uses: actions/setup-node@v4
1420
with:
15-
node-version: 20
16-
cache: "npm"
21+
node-version-file: "package.json"
1722

1823
- name: Install dependencies
19-
run: npm install
24+
run: pnpm install
2025

2126
- name: Build
22-
run: npm run build
27+
run: pnpm run build
2328

24-
- run: npx pkg-pr-new publish
29+
- run: npx pkg-pr-new publish ./packages/*

.github/workflows/publish.yaml

Lines changed: 34 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,40 @@
1-
name: Publish Package to npmjs
1+
name: Release
2+
23
on:
3-
release:
4-
types: [published]
4+
push:
5+
branches:
6+
- main
7+
58
jobs:
6-
npm-publish:
9+
release:
10+
name: Release
711
runs-on: ubuntu-latest
812
steps:
9-
- uses: actions/checkout@v4
10-
# Setup .npmrc file to publish to npm
11-
- uses: actions/setup-node@v4
13+
- name: Checkout Repo
14+
uses: actions/checkout@v3
15+
16+
- name: Install pnpm
17+
uses: pnpm/action-setup@v4
18+
19+
- name: Setup Node.js
20+
uses: actions/setup-node@v3
1221
with:
13-
node-version: "20.x"
14-
registry-url: "https://registry.npmjs.org"
15-
- run: npm ci
16-
- run: npm publish
22+
node-version-file: "package.json"
23+
24+
- name: Install Dependencies
25+
run: pnpm install
26+
27+
# - name: 🔐 Setup npm auth
28+
# run: |
29+
# echo "registry=https://registry.npmjs.org" >> ~/.npmrc
30+
# echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" >> ~/.npmrc
31+
32+
- name: Create Release Pull Request or Publish to npm
33+
id: changesets
34+
uses: changesets/action@v1
1735
env:
18-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
36+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
37+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
38+
with:
39+
version: pnpm run version
40+
publish: pnpm run release

.github/workflows/pull-request.yaml

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -30,19 +30,18 @@ jobs:
3030

3131
- name: ⬇️ Checkout repo
3232
uses: actions/checkout@v4
33-
33+
- name: Install pnpm
34+
uses: pnpm/action-setup@v4
3435
- name: ⎔ Setup node
3536
uses: actions/setup-node@v4
3637
with:
3738
node-version-file: "package.json"
3839

3940
- name: 📥 Download deps
40-
uses: bahmutov/npm-install@v1
41-
with:
42-
useLockFile: false
41+
run: pnpm install
4342

4443
- name: 🔎 Type check
45-
run: npm run typecheck
44+
run: pnpm run typecheck
4645

4746
vitest:
4847
name: ⚡ Unit Tests
@@ -54,20 +53,16 @@ jobs:
5453
- name: ⬇️ Checkout repo
5554
uses: actions/checkout@v4
5655

56+
- name: Install pnpm
57+
uses: pnpm/action-setup@v4
58+
5759
- name: ⎔ Setup node
5860
uses: actions/setup-node@v4
5961
with:
6062
node-version-file: "package.json"
6163

6264
- name: 📥 Download deps
63-
uses: bahmutov/npm-install@v1
64-
with:
65-
useLockFile: false
65+
run: pnpm install
6666

6767
- name: ⚡ Run vitest
68-
run: npm run test:cov
69-
70-
- name: "Report Coverage"
71-
# Only works if you set `reportOnFailure: true` in your vite config as specified above
72-
if: always()
73-
uses: davelosert/vitest-coverage-report-action@v2
68+
run: pnpm run test:cov

lefthook.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ pre-commit:
22
parallel: true
33
commands:
44
check:
5-
run: npm run check -- --staged --fix --no-errors-on-unmatched
5+
run: pnpm run check -- --staged --fix --no-errors-on-unmatched
66
stage_fixed: true
77
typecheck:
8-
run: npm run typecheck
8+
run: pnpm run typecheck
99
test:
10-
run: npm run test
10+
run: pnpm run test

0 commit comments

Comments
 (0)