Skip to content

chore: use pnpm instead of npm #1567

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 63 commits into from
Apr 4, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
2bac42e
chore: use pnpm instead of npm
nperez0111 Mar 26, 2025
12dfced
build: update CI
nperez0111 Mar 27, 2025
ae4c0f1
build: setup pnpm
nperez0111 Mar 27, 2025
adae213
chore: forgot this one
nperez0111 Mar 27, 2025
4fddc69
chore: rm no-audit
nperez0111 Mar 27, 2025
6a6e06f
chore: rm bootstrap step
nperez0111 Mar 27, 2025
9df99a8
chore: rm linting on examples
nperez0111 Mar 27, 2025
1c7ea67
chore: only hoist prosemirror deps
nperez0111 Mar 27, 2025
5ad3d23
test: await test expectations
nperez0111 Mar 27, 2025
0000fb3
fix: resolve type issues with not hoisting react
nperez0111 Mar 27, 2025
13815cd
chore: go back to react 18 types
nperez0111 Mar 27, 2025
9b5776e
fix: move everything to same react version
nperez0111 Mar 27, 2025
1407a86
fix: move everything to same react version
nperez0111 Mar 27, 2025
6ceaefa
chore: try to rebuild native packages
nperez0111 Mar 27, 2025
6bb2b57
build: use new start command
nperez0111 Mar 27, 2025
f62b69a
chore: add pkg-config package too
nperez0111 Mar 27, 2025
b5d1500
chore: use sudo
nperez0111 Mar 27, 2025
d09309b
chore: change package version
nperez0111 Mar 27, 2025
ebd5694
build: add a kill others
nperez0111 Mar 27, 2025
622d44b
build: update playwright version to a static version
nperez0111 Mar 27, 2025
6533c02
chore: try again
nperez0111 Mar 27, 2025
5a9f08f
chore: correct command
nperez0111 Mar 27, 2025
888b3e6
build: add e2e testing as a script
nperez0111 Mar 28, 2025
74e6d60
Merge branch 'main' into pnpm
nperez0111 Mar 28, 2025
4f889e4
chore: fix linting
nperez0111 Mar 28, 2025
1aa8e88
chore: update snaps since we changed playwright browser versions
nperez0111 Mar 28, 2025
8297374
chore: run without CI env var
nperez0111 Mar 28, 2025
769e48a
chore: exit successfully if the first command exits with 0
nperez0111 Mar 28, 2025
a950f9f
chore: update e2e:updateSnpahots
nperez0111 Mar 28, 2025
7a31bb9
chore: add a workflow for releasing automatically
nperez0111 Mar 28, 2025
ffe6bd3
chore: have playwright start the server
nperez0111 Mar 28, 2025
dfab96e
chore: add hash to pnpm version
nperez0111 Mar 28, 2025
d96e803
chore: cleanup
nperez0111 Mar 28, 2025
12b62c1
build: add pkg.pr.new publishing
nperez0111 Mar 28, 2025
ac817c7
chore: use nvm version
nperez0111 Mar 28, 2025
c8d3c19
chore: use full git url
nperez0111 Mar 28, 2025
2cbf924
chore: update snapshots of webkit test
nperez0111 Mar 28, 2025
f9dc6a6
chore: do nothing on bootstrap
nperez0111 Mar 31, 2025
5c0dc1c
chore: add back build:site script
nperez0111 Mar 31, 2025
73c5664
chore: add update flag
nperez0111 Mar 31, 2025
07b3553
chore: update to next 15
nperez0111 Apr 1, 2025
59e3a31
chore: approve sharp
nperez0111 Apr 1, 2025
4733b80
chore: update pnpm-lock
nperez0111 Apr 1, 2025
a7c5b28
chore: update pnpm-lock
nperez0111 Apr 1, 2025
4ac0ea3
chore: bump parallelism
nperez0111 Apr 1, 2025
7e5e28a
chore: rm prefer-offline
nperez0111 Apr 1, 2025
0c89b93
chore: try updating pnpm
nperez0111 Apr 1, 2025
6d3fd35
Merge branch 'main' into pnpm
nperez0111 Apr 1, 2025
b704869
chore: update pnpm-lock
nperez0111 Apr 1, 2025
a1eba33
chore: rm lint from example
nperez0111 Apr 1, 2025
928146e
fix: speedup file generation
nperez0111 Apr 1, 2025
55ad362
chore: minimize output
nperez0111 Apr 1, 2025
2ae4c71
refactor: use type declaration
nperez0111 Apr 1, 2025
b637e0b
chore: try without rebuild
nperez0111 Apr 4, 2025
8ecfc6c
Merge branch 'main' into pnpm
nperez0111 Apr 4, 2025
4e2491f
chore: bunch of cleanup
nperez0111 Apr 4, 2025
29044b6
chore: use PLAYWRIGHT_CONFIG env var
nperez0111 Apr 4, 2025
fa31ada
chore: change cache dir
nperez0111 Apr 4, 2025
ce9d478
chore: update cache location
nperez0111 Apr 4, 2025
8a45fbd
chore: update nx cache dir
nperez0111 Apr 4, 2025
067ba7b
chore: use nx legacy cache
nperez0111 Apr 4, 2025
285ba9c
test: run build again
nperez0111 Apr 4, 2025
f89bc8c
chore: make into separate caches
nperez0111 Apr 4, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 37 additions & 25 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,59 +6,70 @@ on:
pull_request:
types: [opened, synchronize, reopened, edited]

env:
NX_REJECT_UNKNOWN_LOCAL_CACHE: 0

jobs:
build:
name: Build
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 100

- name: Install pnpm
uses: pnpm/action-setup@v4

- uses: nrwl/nx-set-shas@v3

- uses: actions/setup-node@v4
with:
node-version: "20.x"
cache: "npm"
cache-dependency-path: "**/package-lock.json"
cache: "pnpm"
cache-dependency-path: "**/pnpm-lock.yaml"
node-version-file: ".nvmrc"

- name: Cache NX
uses: actions/cache@v4
with:
path: node_modules/.cache/nx/
path: .nx/cache
key: nx-${{ env.NX_BRANCH }}-${{ env.NX_RUN_GROUP }}-${{ github.sha }}
restore-keys: |
nx-${{ env.NX_BRANCH }}-${{ env.NX_RUN_GROUP }}-
nx-${{ env.NX_BRANCH }}-
nx-

# This is needed for the canvas dep, Tiptap V3 should remove the need for this
- 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
- name: Install Dependencies
run: npm ci --prefer-offline --no-audit

- name: Bootstrap packages
run: npm run bootstrap
run: pnpm install

- name: Lint packages
run: npm run lint
run: pnpm run lint

- name: Build packages
run: npm run build
run: pnpm run build

- name: Run unit tests
run: npm run test
run: pnpm run test

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

- name: Soft release
id: soft-release
run: pnpx pkg-pr-new publish './packages/*' # --compact enable compact after release
Comment on lines +63 to +65
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This adds support for pkg.pr.new which allows us to publish preliminary versions of packages to their registry, which should decrease the burden of releasing things when people need them as they can always use the preliminary version. Also great for testing things out in development

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can see an example on this PR: #1567 (comment)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cool! when do you use it for testing?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It allows you to install the "final" package into another repository so it is very useful for testing in a real project.
Like, for that bug fix for docs, we could have made a PR with the change and they could install this version instead of having to actually release something


playwright:
name: "Playwright Tests - ${{ matrix.browser }}"
runs-on: ubuntu-latest
timeout-minutes: 60
container:
image: mcr.microsoft.com/playwright:v1.49.1-noble
image: mcr.microsoft.com/playwright:v1.51.1-noble
strategy:
fail-fast: false
matrix:
Expand All @@ -68,37 +79,38 @@ jobs:
with:
fetch-depth: 100

- name: Install pnpm
uses: pnpm/action-setup@v4

- uses: nrwl/nx-set-shas@v3

- uses: actions/setup-node@v4
with:
node-version: "20.x"
cache: "npm"
cache-dependency-path: "**/package-lock.json"
cache: "pnpm"
cache-dependency-path: "**/pnpm-lock.yaml"
node-version-file: ".nvmrc"

- name: Cache NX
uses: actions/cache@v4
with:
path: node_modules/.cache/nx/
key: nx-${{ env.NX_BRANCH }}-${{ env.NX_RUN_GROUP }}-${{ github.sha }}
path: .nx/cache
key: nx-${{ matrix.browser }}-${{ env.NX_BRANCH }}-${{ env.NX_RUN_GROUP }}-${{ github.sha }}
restore-keys: |
nx-${{ env.NX_BRANCH }}-${{ env.NX_RUN_GROUP }}-
nx-${{ env.NX_BRANCH }}-
nx-${{ matrix.browser }}-${{ env.NX_BRANCH }}-${{ env.NX_RUN_GROUP }}-
nx-${{ matrix.browser }}-${{ env.NX_BRANCH }}-
nx-

- run: apt-get update && apt-get install -y build-essential libcairo2-dev libpango1.0-dev libjpeg-dev libgif-dev librsvg2-dev
- run: apt-get update && apt-get install -y build-essential libcairo2-dev libpango1.0-dev libjpeg-dev libgif-dev librsvg2-dev pkg-config

- name: Install dependencies
run: npm ci --prefer-offline --no-audit
run: pnpm install

- name: Build packages
run: npm run build
run: pnpm run build

- name: Run server and Playwright tests
run: |
npm run start:built > /dev/null &
npx wait-on http://localhost:3000
cd tests && HOME=/root npx playwright test --project ${{ matrix.browser }}
HOME=/root PLAYWRIGHT_CONFIG="--project ${{ matrix.browser }}" pnpm run e2e

- uses: actions/upload-artifact@v4
if: always()
Expand Down
64 changes: 64 additions & 0 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# ./.github/workflows/publish.yml
name: Publish
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We now have automatic publishing, need to work out the kinks and then will write a guide on how to release stuff

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

awesome! very curious about this!


on:
push:
tags:
- v*.*.*

env:
NX_REJECT_UNKNOWN_LOCAL_CACHE: 0

jobs:
publish:
name: Publish
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write # needed for provenance data generation
attestations: write
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 100
- run: jq '.packageManager' package.json | tr -d '"pnpm@'
id: package-manager-version

- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: ${{ steps.package-manager-version.outputs.stdout }}

- uses: nrwl/nx-set-shas@v3

- uses: actions/setup-node@v4
with:
cache: "pnpm"
cache-dependency-path: "**/pnpm-lock.yaml"
node-version-file: ".nvmrc"

- name: Cache NX
uses: actions/cache@v4
with:
path: .nx/cache
key: nx-${{ env.NX_BRANCH }}-${{ env.NX_RUN_GROUP }}-${{ github.sha }}
restore-keys: |
nx-${{ env.NX_BRANCH }}-${{ env.NX_RUN_GROUP }}-
nx-${{ env.NX_BRANCH }}-
nx-

- 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

- name: Install Dependencies & Build
run: pnpm install && pnpm build

- name: Print Environment Info
run: pnpm exec nx report

- name: Publish packages
run: pnpm exec nx release publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_ACCESS_TOKEN }}
NPM_CONFIG_PROVENANCE: true
GITHUB_TOKEN: "${{ github.token }}"
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,4 @@ release
/test-results/
/playwright-report/
/playwright/.cache/
.nx/
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v20.11.0
v22.14.0
1 change: 0 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true,
"[javascript]": { "editor.defaultFormatter": "esbenp.prettier-vscode" },
"[typescript]": { "editor.defaultFormatter": "esbenp.prettier-vscode" },
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

intentional?

"[typescriptreact]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
Expand Down
16 changes: 8 additions & 8 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,20 @@ An introduction into the BlockNote Prosemirror schema can be found in [packages/

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

# Install all required npm modules for lerna, and bootstrap lerna packages
npm install
npm run bootstrap
```bash
# Install all required npm modules
pnpm install

# Start the example project
npm start
# Start the example project
pnpm start
```

## Adding packages

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

## Packages:
## Packages

| Package | Size | Version |
|--------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------|
Expand Down
8 changes: 6 additions & 2 deletions docs/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
{
"extends": "next/core-web-vitals",
"parser": "@typescript-eslint/parser",
"plugins": [ "@typescript-eslint"],
"rules": {
"import/extensions": 0
}
"import/extensions": 0,
"@next/next/no-img-element": "off"
},
"root": true
}
22 changes: 11 additions & 11 deletions docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,18 @@
"private": true,
"scripts": {
"dev": "next dev",
"docs:build": "next build",
"build:site": "next build",
"start": "next start",
"lint": "next lint"
},
"dependencies": {
"@blocknote/ariakit": "^0.26.0",
"@blocknote/core": "^0.26.0",
"@blocknote/code-block": "^0.26.0",
"@blocknote/mantine": "^0.26.0",
"@blocknote/react": "^0.26.0",
"@blocknote/shadcn": "^0.26.0",
"@blocknote/xl-multi-column": "^0.26.0",
"@blocknote/ariakit": "workspace:*",
"@blocknote/core": "workspace:*",
"@blocknote/code-block": "workspace:*",
"@blocknote/mantine": "workspace:*",
"@blocknote/react": "workspace:*",
"@blocknote/shadcn": "workspace:*",
"@blocknote/xl-multi-column": "workspace:*",
Comment on lines +12 to +18
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

workspace:* is PNPM specific to ensure that the docs & playground only ever reference the locally installed workspace version. Otherwise, it can technically be satisfied by anything matching the range. So, this syntax makes it explicit that we always want pnpm to symlink to the local package instead.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

great! previous setup was annoying when merging old branches

"@headlessui/react": "^1.7.18",
"@heroicons/react": "^2.1.4",
"@mantine/core": "^7.10.1",
Expand All @@ -26,7 +26,7 @@
"classnames": "2.3.2",
"clsx": "^2.1.0",
"framer-motion": "^10.16.16",
"next": "^14.2.3",
"next": "^15",
"next-auth": "^5.0.0-beta.19",
"nextra": "^2.13.2",
"nextra-theme-docs": "^2.13.2",
Expand All @@ -41,8 +41,8 @@
},
"devDependencies": {
"@types/node": "^20",
"@types/react": "^18",
"@types/react-dom": "^18",
"@types/react": "^18.0.25",
"@types/react-dom": "^18.0.9",
"autoprefixer": "^10.0.1",
"eslint": "^8",
"eslint-config-next": "14.1.0",
Expand Down
2 changes: 1 addition & 1 deletion docs/tailwind.config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { Config } from "tailwindcss";
const colors = require("tailwindcss/colors");
import colors from "tailwindcss/colors";
const config: Config = {
darkMode: "class",
content: [
Expand Down
25 changes: 20 additions & 5 deletions docs/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
{
"compilerOptions": {
"lib": ["dom", "dom.iterable", "esnext"],
"lib": [
"dom",
"dom.iterable",
"esnext"
],
"allowJs": true,
"skipLibCheck": true,
"strict": true,
Expand All @@ -18,9 +22,20 @@
}
],
"paths": {
"@/*": ["./*"]
}
"@/*": [
"./*"
]
},
"target": "ES2017"
},
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
"exclude": ["node_modules"]
"include": [
"next-env.d.ts",
"**/*.ts",
"**/*.tsx",
"**/*.mdx",
".next/types/**/*.ts"
],
"exclude": [
"node_modules"
]
}
5 changes: 5 additions & 0 deletions docs/types/mdx.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
declare module '*.mdx' {
import type { ComponentType } from 'react'
const component: ComponentType<any>
export default component
}
2 changes: 1 addition & 1 deletion examples/01-basic/01-minimal/main.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// AUTO-GENERATED FILE, DO NOT EDIT DIRECTLY
import React from "react";
import { createRoot } from "react-dom/client";
import App from "./App";
import App from "./App.jsx";

const root = createRoot(document.getElementById("root")!);
root.render(
Expand Down
16 changes: 3 additions & 13 deletions examples/01-basic/01-minimal/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@
"scripts": {
"start": "vite",
"dev": "vite",
"build": "tsc && vite build",
"preview": "vite preview",
"lint": "eslint . --max-warnings 0"
"build:prod": "tsc && vite build",
"preview": "vite preview"
},
"dependencies": {
"@blocknote/core": "latest",
Expand All @@ -23,15 +22,6 @@
"@types/react": "^18.0.25",
"@types/react-dom": "^18.0.9",
"@vitejs/plugin-react": "^4.3.1",
"eslint": "^8.10.0",
"vite": "^5.3.4"
},
"eslintConfig": {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

intentional to remove eslint from examples, or is it solved in a different way?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

eslint is global, so still works locally

the referenced config file never worked for the sandboxes, so better to just remove altogether

"extends": [
"../../../.eslintrc.js"
]
},
"eslintIgnore": [
"dist"
]
}
}
Loading
Loading