Skip to content

Commit 7df528c

Browse files
authoredApr 4, 2025
build: use pnpm and NX instead of npm and lerna (#1567)
1 parent 0083f50 commit 7df528c

File tree

229 files changed

+25127
-39826
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

229 files changed

+25127
-39826
lines changed
 

‎.github/workflows/build.yml

+37-25
Original file line numberDiff line numberDiff line change
@@ -6,59 +6,70 @@ on:
66
pull_request:
77
types: [opened, synchronize, reopened, edited]
88

9+
env:
10+
NX_REJECT_UNKNOWN_LOCAL_CACHE: 0
11+
912
jobs:
1013
build:
1114
name: Build
1215
runs-on: ubuntu-latest
16+
timeout-minutes: 60
1317
steps:
1418
- uses: actions/checkout@v4
1519
with:
1620
fetch-depth: 100
1721

22+
- name: Install pnpm
23+
uses: pnpm/action-setup@v4
24+
1825
- uses: nrwl/nx-set-shas@v3
1926

2027
- uses: actions/setup-node@v4
2128
with:
22-
node-version: "20.x"
23-
cache: "npm"
24-
cache-dependency-path: "**/package-lock.json"
29+
cache: "pnpm"
30+
cache-dependency-path: "**/pnpm-lock.yaml"
31+
node-version-file: ".nvmrc"
2532

2633
- name: Cache NX
2734
uses: actions/cache@v4
2835
with:
29-
path: node_modules/.cache/nx/
36+
path: .nx/cache
3037
key: nx-${{ env.NX_BRANCH }}-${{ env.NX_RUN_GROUP }}-${{ github.sha }}
3138
restore-keys: |
3239
nx-${{ env.NX_BRANCH }}-${{ env.NX_RUN_GROUP }}-
3340
nx-${{ env.NX_BRANCH }}-
3441
nx-
3542
43+
# This is needed for the canvas dep, Tiptap V3 should remove the need for this
44+
- run: sudo apt-get update && sudo apt-get install -y build-essential libcairo2-dev libpango1.0-dev libjpeg-dev libgif-dev librsvg2-dev pkg-config
3645
- name: Install Dependencies
37-
run: npm ci --prefer-offline --no-audit
38-
39-
- name: Bootstrap packages
40-
run: npm run bootstrap
46+
run: pnpm install
4147

4248
- name: Lint packages
43-
run: npm run lint
49+
run: pnpm run lint
4450

4551
- name: Build packages
46-
run: npm run build
52+
run: pnpm run build
4753

4854
- name: Run unit tests
49-
run: npm run test
55+
run: pnpm run test
5056

5157
- name: Upload webpack stats artifact (editor)
5258
uses: relative-ci/agent-upload-artifact-action@v2
5359
with:
5460
webpackStatsFile: ./playground/dist/webpack-stats.json
5561
artifactName: relative-ci-artifacts-editor
5662

63+
- name: Soft release
64+
id: soft-release
65+
run: pnpx pkg-pr-new publish './packages/*' # --compact enable compact after release
66+
5767
playwright:
5868
name: "Playwright Tests - ${{ matrix.browser }}"
5969
runs-on: ubuntu-latest
70+
timeout-minutes: 60
6071
container:
61-
image: mcr.microsoft.com/playwright:v1.49.1-noble
72+
image: mcr.microsoft.com/playwright:v1.51.1-noble
6273
strategy:
6374
fail-fast: false
6475
matrix:
@@ -68,37 +79,38 @@ jobs:
6879
with:
6980
fetch-depth: 100
7081

82+
- name: Install pnpm
83+
uses: pnpm/action-setup@v4
84+
7185
- uses: nrwl/nx-set-shas@v3
7286

7387
- uses: actions/setup-node@v4
7488
with:
75-
node-version: "20.x"
76-
cache: "npm"
77-
cache-dependency-path: "**/package-lock.json"
89+
cache: "pnpm"
90+
cache-dependency-path: "**/pnpm-lock.yaml"
91+
node-version-file: ".nvmrc"
7892

7993
- name: Cache NX
8094
uses: actions/cache@v4
8195
with:
82-
path: node_modules/.cache/nx/
83-
key: nx-${{ env.NX_BRANCH }}-${{ env.NX_RUN_GROUP }}-${{ github.sha }}
96+
path: .nx/cache
97+
key: nx-${{ matrix.browser }}-${{ env.NX_BRANCH }}-${{ env.NX_RUN_GROUP }}-${{ github.sha }}
8498
restore-keys: |
85-
nx-${{ env.NX_BRANCH }}-${{ env.NX_RUN_GROUP }}-
86-
nx-${{ env.NX_BRANCH }}-
99+
nx-${{ matrix.browser }}-${{ env.NX_BRANCH }}-${{ env.NX_RUN_GROUP }}-
100+
nx-${{ matrix.browser }}-${{ env.NX_BRANCH }}-
87101
nx-
88102
89-
- run: apt-get update && apt-get install -y build-essential libcairo2-dev libpango1.0-dev libjpeg-dev libgif-dev librsvg2-dev
103+
- run: apt-get update && apt-get install -y build-essential libcairo2-dev libpango1.0-dev libjpeg-dev libgif-dev librsvg2-dev pkg-config
90104

91105
- name: Install dependencies
92-
run: npm ci --prefer-offline --no-audit
106+
run: pnpm install
93107

94108
- name: Build packages
95-
run: npm run build
109+
run: pnpm run build
96110

97111
- name: Run server and Playwright tests
98112
run: |
99-
npm run start:built > /dev/null &
100-
npx wait-on http://localhost:3000
101-
cd tests && HOME=/root npx playwright test --project ${{ matrix.browser }}
113+
HOME=/root PLAYWRIGHT_CONFIG="--project ${{ matrix.browser }}" pnpm run e2e
102114
103115
- uses: actions/upload-artifact@v4
104116
if: always()

‎.github/workflows/publish.yaml

+64
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# ./.github/workflows/publish.yml
2+
name: Publish
3+
4+
on:
5+
push:
6+
tags:
7+
- v*.*.*
8+
9+
env:
10+
NX_REJECT_UNKNOWN_LOCAL_CACHE: 0
11+
12+
jobs:
13+
publish:
14+
name: Publish
15+
runs-on: ubuntu-latest
16+
permissions:
17+
contents: write
18+
id-token: write # needed for provenance data generation
19+
attestations: write
20+
timeout-minutes: 10
21+
steps:
22+
- uses: actions/checkout@v4
23+
with:
24+
fetch-depth: 100
25+
- run: jq '.packageManager' package.json | tr -d '"pnpm@'
26+
id: package-manager-version
27+
28+
- name: Install pnpm
29+
uses: pnpm/action-setup@v4
30+
with:
31+
version: ${{ steps.package-manager-version.outputs.stdout }}
32+
33+
- uses: nrwl/nx-set-shas@v3
34+
35+
- uses: actions/setup-node@v4
36+
with:
37+
cache: "pnpm"
38+
cache-dependency-path: "**/pnpm-lock.yaml"
39+
node-version-file: ".nvmrc"
40+
41+
- name: Cache NX
42+
uses: actions/cache@v4
43+
with:
44+
path: .nx/cache
45+
key: nx-${{ env.NX_BRANCH }}-${{ env.NX_RUN_GROUP }}-${{ github.sha }}
46+
restore-keys: |
47+
nx-${{ env.NX_BRANCH }}-${{ env.NX_RUN_GROUP }}-
48+
nx-${{ env.NX_BRANCH }}-
49+
nx-
50+
51+
- run: sudo apt-get update && sudo apt-get install -y build-essential libcairo2-dev libpango1.0-dev libjpeg-dev libgif-dev librsvg2-dev pkg-config
52+
53+
- name: Install Dependencies & Build
54+
run: pnpm install && pnpm build
55+
56+
- name: Print Environment Info
57+
run: pnpm exec nx report
58+
59+
- name: Publish packages
60+
run: pnpm exec nx release publish
61+
env:
62+
NODE_AUTH_TOKEN: ${{ secrets.NPM_ACCESS_TOKEN }}
63+
NPM_CONFIG_PROVENANCE: true
64+
GITHUB_TOKEN: "${{ github.token }}"

0 commit comments

Comments
 (0)