d7b80baa31
Currently, we only use native `structuredClone` in the browser, falling back to `JSON.parse(JSON.stringify(...))` elsewhere, despite Node supporting `structuredClone` [since v17](https://developer.mozilla.org/en-US/docs/Web/API/structuredClone) and Cloudflare Workers supporting it [since 2022](https://blog.cloudflare.com/standards-compliant-workers-api/). This PR adjusts our shim to use the native `structuredClone` on all platforms, if available. Additionally, `jsdom` doesn't implement `structuredClone`, a bug [open since 2022](https://github.com/jsdom/jsdom/issues/3363). This PR patches `jsdom` environment in all packages/apps that use it for tests. Also includes a driveby removal of `deepCopy`, a function that is strictly inferior to `structuredClone`. ### Change Type <!-- ❗ Please select a 'Scope' label ❗️ --> - [x] `sdk` — Changes the tldraw SDK - [x] `dotcom` — Changes the tldraw.com web app - [ ] `docs` — Changes to the documentation, examples, or templates. - [ ] `vs code` — Changes to the vscode plugin - [ ] `internal` — Does not affect user-facing stuff <!-- ❗ Please select a 'Type' label ❗️ --> - [ ] `bugfix` — Bug fix - [ ] `feature` — New feature - [x] `improvement` — Improving existing features - [x] `chore` — Updating dependencies, other boring stuff - [ ] `galaxy brain` — Architectural changes - [ ] `tests` — Changes to any test code - [ ] `tools` — Changes to infrastructure, CI, internal scripts, debugging tools, etc. - [ ] `dunno` — I don't know ### Test Plan 1. A smoke test would be enough - [ ] Unit Tests - [x] End to end tests
79 lines
1.8 KiB
YAML
79 lines
1.8 KiB
YAML
name: Checks
|
|
|
|
on:
|
|
pull_request:
|
|
merge_group:
|
|
push:
|
|
branches: [main]
|
|
|
|
env:
|
|
CI: 1
|
|
PRINT_GITHUB_ANNOTATIONS: 1
|
|
|
|
defaults:
|
|
run:
|
|
shell: bash
|
|
|
|
jobs:
|
|
test:
|
|
name: 'Tests & checks'
|
|
timeout-minutes: 15
|
|
runs-on: ubuntu-latest-16-cores-open # TODO: this should probably run on multiple OSes
|
|
|
|
steps:
|
|
- name: Check out code
|
|
uses: actions/checkout@v3
|
|
|
|
- uses: ./.github/actions/setup
|
|
|
|
- name: Check version constraints
|
|
run: yarn constraints
|
|
|
|
- name: Check for duplicate dependencies
|
|
run: yarn dedupe --check
|
|
|
|
# Not the most sophisticated way to check for warnings, but I don't think
|
|
# Yarn can be convinced to exit with a non-zero exit code on warnings
|
|
# see also https://unix.stackexchange.com/a/433713 for the explanation of the parameters
|
|
- name: Check for installation warnings
|
|
run: 'yarn | grep -vzq "with warnings"'
|
|
|
|
- name: Check tsconfigs
|
|
run: yarn check-tsconfigs
|
|
|
|
- name: Typecheck
|
|
run: yarn build-types
|
|
|
|
- name: Check scripts
|
|
run: yarn check-scripts
|
|
|
|
- name: Check PR template
|
|
run: yarn update-pr-template --check
|
|
|
|
- name: Lint
|
|
run: yarn lint
|
|
|
|
- name: Check API declarations and docs work as intended
|
|
run: yarn api-check
|
|
|
|
- name: Test
|
|
run: yarn test-ci
|
|
|
|
build:
|
|
name: 'Build all projects'
|
|
timeout-minutes: 15
|
|
runs-on: ubuntu-latest-16-cores-open
|
|
|
|
steps:
|
|
- name: Check out code
|
|
uses: actions/checkout@v3
|
|
|
|
- uses: ./.github/actions/setup
|
|
|
|
- name: Build all projects
|
|
# the sed pipe makes sure that github annotations come through without
|
|
# turbo's prefix
|
|
run: "yarn build | sed -E 's/^.*? ::/::/'"
|
|
|
|
- name: Pack public packages
|
|
run: "yarn lazy pack-tarball | sed -E 's/^.*? ::/::/'"
|