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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions .github/workflows/browser-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Browser docs

# Checks the no-build examples in "Using Victory in the Browser"
# (website/docs/introduction/browser.mdx) with `pnpm docs:check-browser`. They
# load published Victory and React from esm.sh and jsDelivr, so this tests the
# CDNs and published versions, not a pull request's code. It runs on:
# pull requests that change the page or the check
# manual runs (Actions → Browser docs → Run workflow), optionally against
# another Victory version, e.g. a canary before a release
on:
pull_request:
branches:
- main
paths:
- website/docs/introduction/browser.mdx
- scripts/check-browser-docs.mjs
- .github/workflows/browser-docs.yml
workflow_dispatch:
inputs:
victory:
description: Victory version to check instead of the docs' (e.g. 38.1.0-canary-20261106120000)
required: false
type: string

# Reset permissions and grant them per job.
permissions: {}

jobs:
check:
name: Check browser docs examples
runs-on: ubuntu-latest
permissions:
contents: read # to check out repo (actions/checkout)
steps:
- uses: actions/checkout@v7
with:
persist-credentials: false
- uses: $/.github/actions/setup

# The stories package's Playwright, which the check uses.
- name: Install Chromium
run: pnpm stories:install --with-deps

- name: Check
env:
VICTORY_VERSION: ${{ inputs.victory }}
run: pnpm docs:check-browser ${VICTORY_VERSION:+--victory "$VICTORY_VERSION"}
3 changes: 2 additions & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Tracking issue: https://github.com/FormidableLabs/victory/issues/3093. Read it b
- `stories/`: the `victory-stories` workspace package (private): 203 stories in Storybook's file format and a Vite gallery app (`app/`). `utils/load-stories.ts` loads them and renders each as Storybook did (global, meta, then story args; meta decorators). `tests/` snapshots every story's markup in headless Chromium (Vitest browser mode), one file per story in `tests/__snapshots__/`, and screenshots a curated few (`SCREENSHOT_STORIES`) in `tests/__screenshots__/`, only in the pinned Playwright Docker image (tag in `ci.yml`). `tests/interactions/` drives stories with Playwright's mouse (`userEvent`) and asserts on what changes (tooltips, containers, events).
- `website/`: Docusaurus docs site.
- `test/`: shared Vitest config (jsdom, globals) and helpers.
- `scripts/`: task scripts (`pack-check.mjs`, `bundle-size.mjs`, `lint-gha.mjs`), changelog, and npm trusted-publishing setup.
- `scripts/`: task scripts (`pack-check.mjs`, `bundle-size.mjs`, `lint-gha.mjs`, `check-browser-docs.mjs`), changelog, and npm trusted-publishing setup.

## Commands

Expand Down Expand Up @@ -58,6 +58,7 @@ pnpm stories:install # Chromium for the stories' snapshot tests (Playwright)
pnpm stories:interactions:watch # interaction tests in a visible browser, slowed down (needs full Chromium; CONTRIBUTING)
pnpm --filter victory-stories test -u # update story snapshots (after `pnpm build`)
pnpm stories:screenshots [-u] # story screenshots in the CI image (Docker or Colima); -u updates
pnpm docs:check-browser [--victory <version>] # browser docs examples on esm.sh/jsDelivr (network; CI: PRs changing them, manual runs)
```

Keep Turborepo telemetry off: CI sets `TURBO_TELEMETRY_DISABLED=1`, and agents should set it too. In a git worktree, Turborepo stores its cache in the main checkout's `.turbo/cache`; set `TURBO_CACHE_DIR=.turbo/cache` if that location isn't writable (e.g. a sandbox).
Expand Down
8 changes: 8 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,12 @@ You can run the documentation website locally with the following command. It is
$ pnpm start:docs
```

### Browser docs examples

[Using Victory in the Browser](website/docs/introduction/browser.mdx) has two no-build examples that load published Victory and React from esm.sh and jsDelivr. `pnpm docs:check-browser` checks them: it crawls each example's module graph to check that React loads once, then renders the page in headless Chromium (after `pnpm stories:install`), clicks "Randomize" and fails on any error. It also checks the jsDelivr remap advice: on another React, the page works with the documented remap line and fails without it. Pass `--victory <version>` to check another Victory version (a canary, or a release before the docs are bumped).

It tests the CDNs and published versions, not your changes, so CI runs it only for pull requests that change the page or the check, and on demand (**Actions → Browser docs → Run workflow**, with an optional Victory version).

### Build and checks

Our task system takes care of task dependencies for you. When you first clone this repo or a new branch, run:
Expand Down Expand Up @@ -334,6 +340,8 @@ On the merge of the Version Packages PR, the release workflow:

To try out unreleased changes, run the release workflow manually (**Actions → Release → Run workflow**) on a branch that the `npm-publish` environment allows. It publishes a snapshot (e.g. `37.4.0-canary-20261025120000`) of every package with a pending changeset to the `next` dist-tag. It never touches `latest`.

Before a release, check the [browser docs examples](#browser-docs-examples) against the canary: run **Actions → Browser docs → Run workflow** with the canary's version (or `pnpm docs:check-browser --victory <version>`). If jsDelivr built the canary against a different React than the docs use, it names the module that imports it; update the docs' React (and the remap line) with the release. A new major also bumps the docs' `victory` versions.

### Release setup (maintainers, one time)

- **npm:** run `scripts/npm-trust.sh` (npm >= 11.15.0, 2FA) to configure trusted publishing for every package. Add `--dry-run` to preview.
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@
"clean:cache:modules": "node scripts/clean.mjs node_modules/.cache \"packages/*/node_modules/.cache\"",
"build": "turbo run build --filter=./packages/*",
"build:docs": "turbo run build --filter=victory-docs",
"docs:check-browser": "node scripts/check-browser-docs.mjs",
"format": "oxfmt --check",
"format:fix": "oxfmt",
"lint": "oxlint --report-unused-disable-directives-severity=error",
Expand Down
Loading
Loading