Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
21 changes: 0 additions & 21 deletions .github/actions/restore-build/action.yml

This file was deleted.

17 changes: 9 additions & 8 deletions .github/actions/setup-env/action.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: Setup Node.js and pnpm
description: Install pnpm, setup Node.js, and optionally configure pnpm store
name: Setup Vite+ and pnpm environment
description: Install Vite+ (vp) and pnpm, setup Node.js, and optionally configure the pnpm store

inputs:
node-version:
Expand All @@ -13,7 +13,7 @@ inputs:
default: ''
required: false
cache:
description: Whether to use setup-node's pnpm caching (pass literal string `'true'` to enable)
description: Whether to use setup-vp's dependency caching (pass literal string `'true'` to enable)
default: 'false'
required: false

Expand All @@ -24,12 +24,13 @@ runs:
with:
version: ${{ inputs.pnpm-version }}

- uses: actions/setup-node@v4
with:
node-version: ${{ inputs.node-version }}
cache: ${{ inputs.cache == 'true' && 'pnpm' || '' }}

- name: Configure pnpm store
if: inputs.store-dir != ''
shell: bash
run: pnpm config set store-dir ${{ github.workspace }}/${{ inputs.store-dir }}

- uses: voidzero-dev/setup-vp@v1.17.0
with:
node-version: ${{ inputs.node-version }}
cache: ${{ inputs.cache == 'true' && 'true' || 'false' }}
run-install: false
4 changes: 2 additions & 2 deletions .github/actions/setup-playwright/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ runs:
- name: Install Playwright browsers
if: steps.playwright-cache.outputs.cache-hit != 'true'
shell: bash
run: pnpm exec playwright install --with-deps chromium
run: vp exec playwright install --with-deps chromium

- name: Install Playwright system deps
if: steps.playwright-cache.outputs.cache-hit == 'true'
shell: bash
run: pnpm exec playwright install-deps chromium
run: vp exec playwright install-deps chromium
116 changes: 60 additions & 56 deletions .github/instructions/tiptap.instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,47 +46,51 @@ Notes:

## NPM scripts

Scripts defined at the repo root:

- `pnpm dev` - start the demos on port 3000
- `pnpm build` - build all packages via Turborepo
- `pnpm check` - run format check + lint
- `pnpm check:fix` - run format:fix + lint:fix
- `pnpm format` - run oxfmt formatter check
- `pnpm format:fix` - run oxfmt formatter
- `pnpm lint` - run oxlint checks
- `pnpm lint:fix` - run oxlint with auto-fix
- `pnpm lint:staged` - run lint-staged on staged files
- `pnpm test:e2e` - run Playwright e2e tests headlessly in Chromium
- `pnpm test:e2e:firefox` - same, in Firefox
- `pnpm test:e2e:all` - same, in both browsers
- `pnpm test:e2e:open` - run Playwright in UI mode (Chromium tests)
- `pnpm test:e2e:open:firefox` - UI mode, Firefox tests
- `pnpm test:e2e:open:all` - UI mode, both browsers selectable
- `pnpm test:e2e:report` - open the HTML report from the last run
- `pnpm test:unit` - run Vitest unit tests in `packages/**/__tests__/`
- `pnpm test` - build then run all tests
- `pnpm serve` - build and serve the demos on port 3000
- `pnpm publish` - build and publish with Changesets
- `pnpm reset` - remove caches, build artifacts, and reinstall deps
Scripts defined at the repo root. Run them with `vp run <script>` (or `pnpm run <script>`):

- `vp run dev` - start the demos on port 3000
- `vp run build` - build all packages via Vite+ (`vp run -r build`)
- `vp run check` - run format check + lint
- `vp run check:fix` - run format:fix + lint:fix
- `vp run format` - run oxfmt formatter check
- `vp run format:fix` - run oxfmt formatter
- `vp run lint` - run oxlint checks
- `vp run lint:fix` - run oxlint with auto-fix
- `vp run lint:staged` - run Vite+ staged checks on staged files
- `vp run test:e2e` - run Playwright e2e tests headlessly in Chromium
- `vp run test:e2e:firefox` - same, in Firefox
- `vp run test:e2e:all` - same, in both browsers
- `vp run test:e2e:open` - run Playwright in UI mode (Chromium tests)
- `vp run test:e2e:open:firefox` - UI mode, Firefox tests
- `vp run test:e2e:open:all` - UI mode, both browsers selectable
- `vp run test:e2e:report` - open the HTML report from the last run
- `vp run test:unit` - run Vitest unit tests in `packages/**/__tests__/`
- `vp run test` - build then run all tests
- `vp run serve` - build and serve the demos on port 3000
- `vp run publish` - build and publish with Changesets
- `vp run reset` - remove caches, build artifacts, and reinstall deps

Scripts are cached by Vite Task (`run.cache.scripts` is enabled in `vite.config.mts`). Re-running an unchanged script replays its output instead of executing. Persistent scripts like `dev` never exit, so they are never cached. Clear the cache with `vp cache clean`.

---

## Linting & formatting

- oxlint runs with sensible defaults (no config file required).
- oxfmt config is at **`.oxfmtrc.json`**.
- Husky and lint-staged run automatically on commits.
- Vite+ hooks (`vp staged`) run automatically on commits.

Use `vp run lint` / `vp run format`, not the built-in `vp lint` / `vp format`. The built-ins scan every `vite.config.ts` in the repo (including the per-package pack configs) as their own config and fail to load them. The repo scripts call the standalone `oxlint` / `oxfmt` binaries directly, which avoid that.

Run manually:

```bash
pnpm lint
pnpm lint:fix
pnpm format
pnpm format:fix
pnpm check
pnpm check:fix
vp run lint
vp run lint:fix
vp run format
vp run format:fix
vp run check
vp run check:fix
```

---
Expand All @@ -98,13 +102,13 @@ pnpm check:fix
- Start in dev mode:

```bash
pnpm dev
vp run dev
```

- Build static output and serve locally:

```bash
pnpm serve
vp run serve
```

When adding a demo, keep it small and self-contained, with imports from published package names (`@tiptap/...`).
Expand All @@ -121,22 +125,22 @@ Two layers:
Run them:

```bash
pnpm test:unit # Vitest
pnpm test:e2e # Playwright headless (Chromium)
pnpm test:e2e:firefox # Playwright headless (Firefox)
pnpm test:e2e:all # both browsers — every test twice
pnpm test:e2e:open # UI mode (Chromium tests)
pnpm test:e2e:open:firefox # UI mode (Firefox tests)
pnpm test:e2e:open:all # UI mode, switch between browsers in the project picker
pnpm test:e2e:report # open the HTML report from the last run
vp run test:unit # Vitest
vp run test:e2e # Playwright headless (Chromium)
vp run test:e2e:firefox # Playwright headless (Firefox)
vp run test:e2e:all # both browsers — every test twice
vp run test:e2e:open # UI mode (Chromium tests)
vp run test:e2e:open:firefox # UI mode (Firefox tests)
vp run test:e2e:open:all # UI mode, switch between browsers in the project picker
vp run test:e2e:report # open the HTML report from the last run
```

Playwright auto-starts the demo dev server (`pnpm -C demos run start:e2e` on port 4080) via `playwright.config.ts` — no separate terminal needed. Shared helpers live in `demos/test/helpers.ts`: `getEditor`, `setEditorContent`, `clickButton`. Use `demos/src/Commands/Cut/index.spec.ts` as a canonical template when adding new specs.

Browser setup:

- CI installs Chromium only (cached between runs) and only runs the Chromium project.
- For local Firefox testing, install it once with `pnpm exec playwright install firefox` (~80MB).
- For local Firefox testing, install it once with `vp exec playwright install firefox` (~80MB).
- UI mode (`--ui`) always opens its host window in Chromium — that's the Playwright UI app itself, not the browser running your tests. Tests still execute in the project you selected (check the trace metadata or `browserName` fixture if you need to confirm).

---
Expand Down Expand Up @@ -174,19 +178,19 @@ export function toggleBold(editor: Editor): boolean {

## Versioning and releases with Changesets

* Run `pnpm changeset` to create a new changeset (choose packages + bump type).
* Run `pnpm version` to update versions and changelogs.
* Publishing happens automatically via the Publish CI workflow on configured branches. See `agents/VERSIONING.md` for details.
- Run `pnpm changeset` to create a new changeset (choose packages + bump type).
- Run `vp run version` to update versions and changelogs.
- Publishing happens automatically via the Publish CI workflow on configured branches. See `agents/VERSIONING.md` for details.

Changelogs must describe **user-facing changes**. Avoid internal noise.

---

## Cleaning and resetting

- `pnpm run clean:packages` - remove build artifacts
- `pnpm run clean:packs` - remove generated tarballs
- `pnpm reset` - full reset of caches, node_modules, and lockfiles
- `vp run clean:packages` - remove build artifacts
- `vp run clean:packs` - remove generated tarballs
- `vp run reset` - full reset of caches, node_modules, and lockfiles

---

Expand All @@ -206,7 +210,7 @@ To make these instructions easier for automated agents and new contributors, the
### Environment

- Recommended Node version: >=18.x. Use a node version manager (nvm, fnm) or Corepack to pin a runtime.
- Recommended package manager: pnpm (use the repo's lockfile). If you see unexpected errors, run `pnpm reset`.
- Recommended package manager: pnpm (use the repo's lockfile). If you see unexpected errors, run `vp run reset`.

### Where to edit packages

Expand All @@ -224,14 +228,14 @@ The demos app discovers examples automatically. When adding a demo:
Run the following to validate changes quickly:

```bash
pnpm lint
pnpm build
pnpm test:unit # Vitest
pnpm test:e2e # Playwright (auto-starts the demo server)
pnpm dev # optionally run the demos and open http://localhost:3000
vp run lint
vp run build
vp run test:unit # Vitest
vp run test:e2e # Playwright (auto-starts the demo server)
vp run dev # optionally run the demos and open http://localhost:3000
```

If a single package is failing types, run a targeted build for that package (e.g. `pnpm -w -F @tiptap/core build`), or run `pnpm build` at the repo root.
If a single package is failing types, run a targeted build for that package (e.g. `vp run -F @tiptap/core build`), or run `vp run build` at the repo root.

### PR checklist

Expand All @@ -250,8 +254,8 @@ If a single package is failing types, run a targeted build for that package (e.g

### Troubleshooting notes

- If CI fails with dependency or lockfile errors, run `pnpm reset` locally and re-run the build.
- For flaky Playwright tests, reproduce locally with `pnpm test:e2e:open` (UI mode) or rerun with `--trace on` and inspect via `pnpm test:e2e:report`.
- If CI fails with dependency or lockfile errors, run `vp run reset` locally and re-run the build.
- For flaky Playwright tests, reproduce locally with `vp run test:e2e:open` (UI mode) or rerun with `--trace on` and inspect via `vp run test:e2e:report`.

---

Expand Down
34 changes: 12 additions & 22 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ jobs:
node-version: ${{ env.NODE_VERSION }}
pnpm-version: ${{ env.PNPM_VERSION }}
store-dir: ${{ env.PNPM_STORE_DIR }}
cache: 'true'

- name: Install dependencies
run: pnpm install --frozen-lockfile --strict-peer-dependencies
Expand Down Expand Up @@ -67,22 +68,15 @@ jobs:
- uses: ./.github/actions/restore-dependencies

- name: Build packages
run: pnpm run build && pnpm run build:demos
run: vp run build && vp run build:demos

- name: Pack build artifacts
run: tar -czf /tmp/build-output.tar.gz packages/*/dist packages-deprecated/*/dist demos/dist

- name: Upload build artifacts
uses: actions/upload-artifact@v7
with:
name: build-output
path: /tmp/build-output.tar.gz
retention-days: 1
- name: Check package exports
run: vp run check:package-exports

check-linting-formatting:
name: Check linting & formatting
runs-on: ubuntu-latest
needs: build-packages
needs: install-node-dependencies
timeout-minutes: 15

steps:
Expand All @@ -97,12 +91,12 @@ jobs:
- uses: ./.github/actions/restore-dependencies

- name: Run linting and formatting checks
run: pnpm run lint
run: vp run lint

run-unit-tests:
name: Run unit tests
runs-on: ubuntu-latest
needs: build-packages
needs: install-node-dependencies
timeout-minutes: 20

steps:
Expand All @@ -116,10 +110,8 @@ jobs:

- uses: ./.github/actions/restore-dependencies

- uses: ./.github/actions/restore-build

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

run-e2e-tests:
name: Run e2e tests (shard ${{ matrix.shard }}/${{ matrix.total }})
Expand All @@ -143,12 +135,10 @@ jobs:

- uses: ./.github/actions/restore-dependencies

- uses: ./.github/actions/restore-build

- uses: ./.github/actions/setup-playwright

- name: Run Playwright tests
run: pnpm exec playwright test --project=chromium --shard=${{ matrix.shard }}/${{ matrix.total }}
run: vp exec playwright test --project=chromium --shard=${{ matrix.shard }}/${{ matrix.total }}

- name: Upload blob report
if: always()
Expand All @@ -161,8 +151,8 @@ jobs:
merge-e2e-reports:
name: Merge e2e reports
runs-on: ubuntu-latest
needs: run-e2e-tests
if: always()
needs: [install-node-dependencies, run-e2e-tests]
if: always() && needs.install-node-dependencies.result == 'success'
timeout-minutes: 10

steps:
Expand All @@ -185,7 +175,7 @@ jobs:

- name: Merge into HTML report
if: ${{ hashFiles('all-blob-reports/**') != '' }}
run: pnpm exec playwright merge-reports --reporter html ./all-blob-reports
run: vp exec playwright merge-reports --reporter html ./all-blob-reports

- name: Upload merged HTML report
uses: actions/upload-artifact@v7
Expand Down
11 changes: 7 additions & 4 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,10 @@ jobs:
run: pnpm install --frozen-lockfile --strict-peer-dependencies

- name: Run build
run: pnpm run build && pnpm run build:demos
run: vp run build && vp run build:demos

- name: Check package exports
run: vp run check:package-exports

- name: Archive package dist artifacts
run: tar -cf package-dist-artifacts.tar packages/*/dist packages-deprecated/*/dist
Expand Down Expand Up @@ -106,15 +109,15 @@ jobs:
run: tar -xf package-dist-artifacts.tar

- name: Verify package dist artifacts
run: bash ./scripts/check-package-dists.sh
run: bash ./scripts/check-package-dists.sh && vp run check:package-exports

- name: Run changesets release flow
id: changesets
uses: changesets/action@v1
with:
createGithubReleases: false
version: pnpm run version
publish: pnpm changeset publish --tag ${{ needs.resolve-config.outputs.dist_tag }}
version: vp run version
publish: vp exec changeset publish --tag ${{ needs.resolve-config.outputs.dist_tag }}
title: ${{ needs.resolve-config.outputs.title }}
commit: ${{ needs.resolve-config.outputs.commit }}
env:
Expand Down
4 changes: 0 additions & 4 deletions .husky/pre-commit

This file was deleted.

Loading
Loading