Skip to content

Commit 7df528c

Browse files
authored
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 }}"

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,4 @@ release
3333
/test-results/
3434
/playwright-report/
3535
/playwright/.cache/
36+
.nx/

.nvmrc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
v20.11.0
1+
v22.14.0

.vscode/settings.json

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
"editor.defaultFormatter": "esbenp.prettier-vscode",
33
"editor.formatOnSave": true,
44
"[javascript]": { "editor.defaultFormatter": "esbenp.prettier-vscode" },
5-
"[typescript]": { "editor.defaultFormatter": "esbenp.prettier-vscode" },
65
"[typescriptreact]": {
76
"editor.defaultFormatter": "esbenp.prettier-vscode"
87
},

CONTRIBUTING.md

+8-8
Original file line numberDiff line numberDiff line change
@@ -23,20 +23,20 @@ An introduction into the BlockNote Prosemirror schema can be found in [packages/
2323

2424
To run the project, open the command line in the project's root directory and enter the following commands:
2525

26-
# Install all required npm modules for lerna, and bootstrap lerna packages
27-
npm install
28-
npm run bootstrap
26+
```bash
27+
# Install all required npm modules
28+
pnpm install
2929

30-
# Start the example project
31-
npm start
30+
# Start the example project
31+
pnpm start
32+
```
3233

3334
## Adding packages
3435

3536
- Add the dependency to the relevant `package.json` file (packages/xxx/package.json)
36-
- run `npm run install-new-packages`
37-
- Double check `package-lock.json` to make sure only the relevant packages have been affected
37+
- Double check `pnpm-lock.yaml` to make sure only the relevant packages have been affected
3838

39-
## Packages:
39+
## Packages
4040

4141
| Package | Size | Version |
4242
|--------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------|

docs/.eslintrc.json

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
{
22
"extends": "next/core-web-vitals",
3+
"parser": "@typescript-eslint/parser",
4+
"plugins": [ "@typescript-eslint"],
35
"rules": {
4-
"import/extensions": 0
5-
}
6+
"import/extensions": 0,
7+
"@next/next/no-img-element": "off"
8+
},
9+
"root": true
610
}

docs/package.json

+11-11
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,18 @@
44
"private": true,
55
"scripts": {
66
"dev": "next dev",
7-
"docs:build": "next build",
7+
"build:site": "next build",
88
"start": "next start",
99
"lint": "next lint"
1010
},
1111
"dependencies": {
12-
"@blocknote/ariakit": "^0.26.0",
13-
"@blocknote/core": "^0.26.0",
14-
"@blocknote/code-block": "^0.26.0",
15-
"@blocknote/mantine": "^0.26.0",
16-
"@blocknote/react": "^0.26.0",
17-
"@blocknote/shadcn": "^0.26.0",
18-
"@blocknote/xl-multi-column": "^0.26.0",
12+
"@blocknote/ariakit": "workspace:*",
13+
"@blocknote/core": "workspace:*",
14+
"@blocknote/code-block": "workspace:*",
15+
"@blocknote/mantine": "workspace:*",
16+
"@blocknote/react": "workspace:*",
17+
"@blocknote/shadcn": "workspace:*",
18+
"@blocknote/xl-multi-column": "workspace:*",
1919
"@headlessui/react": "^1.7.18",
2020
"@heroicons/react": "^2.1.4",
2121
"@mantine/core": "^7.10.1",
@@ -26,7 +26,7 @@
2626
"classnames": "2.3.2",
2727
"clsx": "^2.1.0",
2828
"framer-motion": "^10.16.16",
29-
"next": "^14.2.3",
29+
"next": "^15",
3030
"next-auth": "^5.0.0-beta.19",
3131
"nextra": "^2.13.2",
3232
"nextra-theme-docs": "^2.13.2",
@@ -41,8 +41,8 @@
4141
},
4242
"devDependencies": {
4343
"@types/node": "^20",
44-
"@types/react": "^18",
45-
"@types/react-dom": "^18",
44+
"@types/react": "^18.0.25",
45+
"@types/react-dom": "^18.0.9",
4646
"autoprefixer": "^10.0.1",
4747
"eslint": "^8",
4848
"eslint-config-next": "14.1.0",

docs/tailwind.config.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import type { Config } from "tailwindcss";
2-
const colors = require("tailwindcss/colors");
2+
import colors from "tailwindcss/colors";
33
const config: Config = {
44
darkMode: "class",
55
content: [

docs/tsconfig.json

+20-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
{
22
"compilerOptions": {
3-
"lib": ["dom", "dom.iterable", "esnext"],
3+
"lib": [
4+
"dom",
5+
"dom.iterable",
6+
"esnext"
7+
],
48
"allowJs": true,
59
"skipLibCheck": true,
610
"strict": true,
@@ -18,9 +22,20 @@
1822
}
1923
],
2024
"paths": {
21-
"@/*": ["./*"]
22-
}
25+
"@/*": [
26+
"./*"
27+
]
28+
},
29+
"target": "ES2017"
2330
},
24-
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
25-
"exclude": ["node_modules"]
31+
"include": [
32+
"next-env.d.ts",
33+
"**/*.ts",
34+
"**/*.tsx",
35+
"**/*.mdx",
36+
".next/types/**/*.ts"
37+
],
38+
"exclude": [
39+
"node_modules"
40+
]
2641
}

docs/types/mdx.d.ts

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
declare module '*.mdx' {
2+
import type { ComponentType } from 'react'
3+
const component: ComponentType<any>
4+
export default component
5+
}

examples/01-basic/01-minimal/main.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// AUTO-GENERATED FILE, DO NOT EDIT DIRECTLY
22
import React from "react";
33
import { createRoot } from "react-dom/client";
4-
import App from "./App";
4+
import App from "./App.jsx";
55

66
const root = createRoot(document.getElementById("root")!);
77
root.render(

examples/01-basic/01-minimal/package.json

+3-13
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,8 @@
66
"scripts": {
77
"start": "vite",
88
"dev": "vite",
9-
"build": "tsc && vite build",
10-
"preview": "vite preview",
11-
"lint": "eslint . --max-warnings 0"
9+
"build:prod": "tsc && vite build",
10+
"preview": "vite preview"
1211
},
1312
"dependencies": {
1413
"@blocknote/core": "latest",
@@ -23,15 +22,6 @@
2322
"@types/react": "^18.0.25",
2423
"@types/react-dom": "^18.0.9",
2524
"@vitejs/plugin-react": "^4.3.1",
26-
"eslint": "^8.10.0",
2725
"vite": "^5.3.4"
28-
},
29-
"eslintConfig": {
30-
"extends": [
31-
"../../../.eslintrc.js"
32-
]
33-
},
34-
"eslintIgnore": [
35-
"dist"
36-
]
26+
}
3727
}

0 commit comments

Comments
 (0)