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
  •  
  •  
  •  
12 changes: 6 additions & 6 deletions .github/actions/bench-diff/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ A browser suite, which needs a browser downloaded first:
- uses: actions/checkout@v4
- uses: ./.github/actions/bench-diff
with:
id: v4-mount
title: v4 mount benchmarks
id: mount
title: mount benchmarks
unit: component
working-directory: packages/v4
working-directory: packages/js-toolkit
prepare: npx playwright install --with-deps chromium
bench: npm exec vitest bench -- --config vitest.bench.config.js --run --outputJson "$BENCH_JSON"
rounds: '3'
Expand All @@ -49,9 +49,9 @@ A Node suite, which needs nothing extra — the only difference is the command:
```yaml
- uses: ./.github/actions/bench-diff
with:
id: v3
title: v3 benchmarks
working-directory: packages/js-toolkit
id: utils
title: utils benchmarks
working-directory: packages/some-node-package
bench: npm exec vitest bench -- --config vitest.bench.config.ts --run --outputJson "$BENCH_JSON"
```

Expand Down
83 changes: 0 additions & 83 deletions .github/workflows/benchmarks-v3.yml

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,28 +1,23 @@
name: benchmarks-v4
name: benchmarks

# v4's benchmarks run in a real Chromium, so they cannot share the v3 job in
# `benchmarks.yml`: CodSpeed's simulation mode instruments the Node process,
# while a browser-mode benchmark body runs in the browser over CDP, so it
# would measure the driver. This job compares the base and the head commit on
# one runner instead, which removes cross-machine noise without an account, a
# token or a stored baseline.
# The benchmarks run in a real Chromium, which rules out CodSpeed: its
# simulation mode instruments the Node process, while a browser-mode benchmark
# body runs in the browser over CDP, so it would measure the driver. This job
# compares the base and the head commit on one runner instead, which removes
# cross-machine noise without an account, a token or a stored baseline.
#
# It comments; it never blocks. The hard gate is `src/mount-at-scale.spec.ts`
# in the normal test job, whose thresholds do not depend on runner speed.
#
# Separate file rather than a job in `benchmarks.yml` because only a
# workflow-level `paths:` filter can keep it off pull requests that do not
# touch v4, and `benchmarks.yml` must keep running for v3.

on:
pull_request:
branches:
- main
paths:
- 'packages/v4/**'
- 'packages/js-toolkit/**'
- 'package-lock.json'
- '.github/actions/bench-diff/**'
- '.github/workflows/benchmarks-v4.yml'
- '.github/workflows/benchmarks.yml'

permissions:
contents: read
Expand All @@ -38,16 +33,15 @@ jobs:
- uses: ./.github/actions/bench-diff
with:
# Identity, not configuration: the action knows nothing about
# browsers or about v4. A second suite — v3's Node and happy-dom
# benchmarks, say — is another step with another `id`, not a branch
# inside the action.
id: v4-mount
title: v4 mount benchmarks
# browsers or about this package. A second suite is another step with
# another `id`, not a branch inside the action.
id: mount
title: mount benchmarks
unit: component
working-directory: packages/v4
working-directory: packages/js-toolkit
# No build: vitest runs the browser suite straight from TypeScript.
prepare: npx playwright install --with-deps chromium
# The at-scale file only. Adding the other three v4 benchmark files
# The at-scale file only. Adding the other three benchmark files
# costs ~55 s per run, so ~5.5 min across six runs, for micro-
# benchmarks a wall-clock diff can barely resolve.
#
Expand All @@ -56,7 +50,7 @@ jobs:
# near 1 ms, where Chromium's 100 us clamp makes a percentage
# meaningless. It is set on the command rather than as step `env:`,
# which a composite action's steps do not reliably inherit.
bench: V4_BENCH_SIZES=1000,5000 npm exec vitest bench -- --config vitest.bench.config.js --run src/mount-at-scale.bench.ts --outputJson "$BENCH_JSON"
bench: BENCH_SIZES=1000,5000 npm exec vitest bench -- --config vitest.bench.config.js --run src/mount-at-scale.bench.ts --outputJson "$BENCH_JSON"
rounds: '3'
# Same-commit noise floor, three interleaved rounds per side: 4.5 %
# median, 12.5 % p90, 33 % worst — and every case above 13 % is a
Expand Down
50 changes: 16 additions & 34 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
name: docs

# The 4.x documentation, served at js-toolkit-v4.studiometa.dev.
#
# It keeps that domain for as long as 4.x is a prerelease: `latest` on npm is
# still 3.x, so js-toolkit.studiometa.dev must keep answering with the 3.x
# pages. Those are built and deployed from the `3.x` branch, which is also the
# production branch of the `js-toolkit` Cloudflare Pages project. The two
# domains swap when 4.0.0 ships.

on:
push:
branches: [main]
Expand All @@ -8,7 +16,7 @@ on:
- main

jobs:
deploy-v3:
deploy:
runs-on: ubuntu-latest
permissions:
contents: read
Expand All @@ -23,37 +31,11 @@ jobs:

- run: npm ci

- name: Build docs
run: npm run docs:build

- name: Deploy to Cloudflare Pages
uses: cloudflare/wrangler-action@v3
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
gitHubToken: ${{ secrets.GITHUB_TOKEN }}
command: pages deploy packages/docs/.vitepress/dist --project-name=js-toolkit

deploy-v4:
runs-on: ubuntu-latest
permissions:
contents: read
deployments: write
steps:
- uses: actions/checkout@v4

- uses: actions/setup-node@v4
with:
node-version: 24
cache: 'npm'

- run: npm ci

# Twoslash resolves the package types out of `dist`, since the v4 exports
# Twoslash resolves the package types out of `dist`, since the exports
# map has no `typescript` condition. The docs build below ignores the
# committed caches, so this is what it reads.
- name: Build the v4 package
run: npm run build:v4
- name: Build the package
run: npm run build:js-toolkit

# Regenerate every twoslash hover instead of trusting the committed caches.
#
Expand All @@ -63,11 +45,11 @@ jobs:
# cache was first written. That is invisible: the build passes and the page
# renders, only the tooltip is out of date.
#
# The committed caches stay useful — they keep a local `docs:v4:dev` fast.
# The committed caches stay useful — they keep a local `docs:dev` fast.
# What is published is regenerated, so it cannot drift from the source.
# Costs about 50s: a 32s build becomes 83s for ~200 samples.
- name: Build v4 docs
run: npm run docs:v4:build
- name: Build the docs
run: npm run docs:build
env:
TWOSLASH_INLINE_CACHE_IGNORE: '1'

Expand All @@ -77,4 +59,4 @@ jobs:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
gitHubToken: ${{ secrets.GITHUB_TOKEN }}
command: pages deploy packages/v4/docs/.vitepress/dist --project-name=js-toolkit-v4
command: pages deploy packages/js-toolkit/docs/.vitepress/dist --project-name=js-toolkit-v4
9 changes: 3 additions & 6 deletions .github/workflows/export-size.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ on:
- main
paths:
- 'packages/js-toolkit/**'
- 'packages/v4/**'
- 'package-lock.json'
- '.github/workflows/export-size.yml'

Expand All @@ -22,10 +21,8 @@ jobs:
- uses: weareikko/export-size@1
with:
# `packages/js-toolkit/` is the folder npm publishes, so the report
# measures exactly what a consumer installs. Both packages resolve to
# their own `dist/`, which `npm run build` produces, so both appear in
# the same report and can be compared export by export.
# measures exactly what a consumer installs. It resolves to its own
# `dist/`, which `npm run build` produces below.
packages: |
@studiometa/js-toolkit:packages/js-toolkit
@studiometa/js-toolkit-v4:packages/v4
build: npm run build && npm run check:constant-subpaths -w @studiometa/js-toolkit-v4
build: npm run build && npm run check:constant-subpaths -w @studiometa/js-toolkit
35 changes: 12 additions & 23 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,12 @@ jobs:
- name: Run types tests
run: npm run lint:types

v4:
name: unit (v4)
js-toolkit:
name: unit (js-toolkit)
runs-on: ubuntu-latest
defaults:
run:
working-directory: packages/v4
working-directory: packages/js-toolkit
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
Expand All @@ -56,9 +56,9 @@ jobs:
- name: Install dependencies
run: npm ci --no-audit --no-progress --no-fund
working-directory: .
# The v4 specs run in a real browser: they cover native view
# transitions, frame-aligned scheduling and DOM lifecycle, none of
# which a DOM emulation can answer for.
# The specs run in a real browser: they cover native view transitions,
# frame-aligned scheduling and DOM lifecycle, none of which a DOM
# emulation can answer for.
- name: Install Playwright Chromium
run: npx playwright install --with-deps chromium
- name: Run tests
Expand All @@ -68,23 +68,12 @@ jobs:
- name: Check the packed package
run: npm run check:package

unit:
eslint-plugin:
name: unit (eslint-plugin-js-toolkit)
runs-on: macos-latest
strategy:
matrix:
include:
- package: js-toolkit
working-directory: packages/js-toolkit
test-command: npm test -- --retry=3 --coverage.enabled
coverage-file: packages/js-toolkit/coverage/clover.xml
- package: eslint-plugin-js-toolkit
working-directory: packages/eslint-plugin
test-command: npm test -- --retry=3 --coverage.enabled
coverage-file: packages/eslint-plugin/coverage/clover.xml
name: unit (${{ matrix.package }})
defaults:
run:
working-directory: ${{ matrix.working-directory }}
working-directory: packages/eslint-plugin
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
Expand All @@ -95,12 +84,12 @@ jobs:
run: npm ci --no-audit --no-progress --no-fund
working-directory: .
- name: Run tests
run: ${{ matrix.test-command }}
run: npm test -- --retry=3 --coverage.enabled
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
files: ${{ matrix.coverage-file }}
flags: ${{ matrix.package }}
files: packages/eslint-plugin/coverage/clover.xml
flags: eslint-plugin-js-toolkit
fail_ci_if_error: false
verbose: true
env:
Expand Down
12 changes: 5 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,16 @@ yarn-error.log*

# Build files
packages/*/dist/
packages/demo/dist/
/packages/v4/test/.runtime/
/packages/js-toolkit/demo/dist/
/packages/js-toolkit/test/.runtime/

# Module graph reports written by `npm run measure -- --json <file>`
.measure-*.json

# Benchmark output written by `npm run bench:v4`
# Benchmark output written by `npm run bench`
.bench-report.json
/packages/docs/.vitepress/cache
/packages/docs/.vitepress/dist
/packages/v4/docs/.vitepress/cache
/packages/v4/docs/.vitepress/dist
/packages/js-toolkit/docs/.vitepress/cache
/packages/js-toolkit/docs/.vitepress/dist
coverage/
/full.d.ts
/index.d.ts
Expand Down
Loading
Loading