Skip to content

Commit

Permalink
Test against multiple Tiptap versions in CI
Browse files Browse the repository at this point in the history
  • Loading branch information
sjdemartini committed Dec 28, 2024
1 parent 259a6eb commit aa1f052
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,14 @@ jobs:
strategy:
matrix:
node-version: [20]
# Test across old versions of Tiptap, the versions specified in our
# lockfile, and the latest version of Tiptap, to ensure compatibility.
tiptap-version: [null, 2.0.4, latest]
include:
- tiptap-version: 2.0.4
# Specify the version of y-prosemirror to use to ensure proper peer
# dependency compatibility and resolution.
y-prosemirror-version: 1.0.20

steps:
- name: Checkout repo
Expand All @@ -33,9 +41,42 @@ jobs:
- name: Dependencies audit
run: pnpm audit --audit-level=high

- if: ${{ matrix.tiptap-version != null }}
name: Override tiptap version to ${{ matrix.tiptap-version }}
# So that we can update all tiptap packages at once, we use
# `pnpm update`, which allows wildcard syntax and version specifier
# (unlike `pnpm install`). We have to separately install the indirect
# dependencies of @tiptap/react with the desired version (the floating
# and bubble menu packages), since `update` doesn't apply to them.
run: |
pnpm update -D "@tiptap/*@${{ matrix.tiptap-version }}"
pnpm add -D "@tiptap/extension-floating-menu@${{ matrix.tiptap-version }}" "@tiptap/extension-bubble-menu@${{ matrix.tiptap-version }}"
pnpm dedupe
- if: ${{ matrix.y-prosemirror-version }}
name: Override y-prosemirror version to ${{ matrix.y-prosemirror-version }}
run: pnpm add -D "y-prosemirror@${{ matrix.y-prosemirror-version }}"

- name: Check for duplicate dependencies
run: pnpm dedupe --check

- if: ${{ matrix.tiptap-version == "2.0.4" }}
name: Resolve known inconsequential TS differences in Tiptap 2.0.4
# 1) Delete the `@ts-expect-error` comments where needed, as older
# versions of Tiptap didn't have the same types that required this
# override.
# 2) Add `@ts-expect-error` to TableImproved.ts where the typing in
# older versions was incorrect (as Tiptap itself did here
# https://github.com/ueberdosis/tiptap/blob/b0198eb14b98db5ca691bd9bfe698ffaddbc4ded/packages/extension-table/src/table.ts#L253,
# and we did prior to updating to newer Tiptap).
run: |
sed -i '' '/@ts-expect-error/d' src/extensions/ResizableImage.ts
sed -i '' '/@ts-expect-error/d' src/extensions/HeadingWithAnchor.ts
sed -i '' '/View: this.options.View/i\
// @ts-expect-error incorrect type\
' src/extensions/TableImproved.ts
- name: Build
run: pnpm run build

Expand Down

0 comments on commit aa1f052

Please sign in to comment.