diff --git a/.circleci/config.yml b/.circleci/config.yml index a67026ad4205..0334cb181d89 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -71,6 +71,7 @@ jobs: - run: name: Add examples/* to yarn workspace command: | + npm pkg delete workspaces[6] npm pkg delete workspaces[5] npm pkg delete workspaces[4] npm pkg delete workspaces[3] diff --git a/.github/workflows/benchmark-react.yml b/.github/workflows/benchmark-react.yml index 0940bcc3aed7..ce6a2b4f05e0 100644 --- a/.github/workflows/benchmark-react.yml +++ b/.github/workflows/benchmark-react.yml @@ -43,9 +43,7 @@ jobs: node-version: '24' cache: 'yarn' - name: Install packages - run: | - corepack enable - yarn install --immutable + run: ./scripts/ci-install.sh examples/benchmark-react - name: Install Playwright (Chromium + system deps) run: npx playwright install chromium --with-deps - name: Build packages diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml index 344bfd6921fe..7d9ede31d8f8 100644 --- a/.github/workflows/benchmark.yml +++ b/.github/workflows/benchmark.yml @@ -41,9 +41,7 @@ jobs: node-version: '24' cache: 'yarn' - name: Install packages - run: | - corepack enable - yarn install --immutable + run: ./scripts/ci-install.sh examples/benchmark - name: Build packages run: yarn build:benchmark - name: Run benchmark diff --git a/.github/workflows/beta-release.yml b/.github/workflows/beta-release.yml index 5cd086543138..ecd1cccc0f46 100644 --- a/.github/workflows/beta-release.yml +++ b/.github/workflows/beta-release.yml @@ -31,9 +31,7 @@ jobs: cache: 'yarn' registry-url: 'https://registry.npmjs.org' - name: Install packages - run: | - corepack enable - yarn install --immutable + run: ./scripts/ci-install.sh - name: Create Beta Release Pull Request or Publish to npm id: changesets diff --git a/.github/workflows/bundle_size.yml b/.github/workflows/bundle_size.yml index 27192a85a95f..31331ca84ba6 100644 --- a/.github/workflows/bundle_size.yml +++ b/.github/workflows/bundle_size.yml @@ -36,17 +36,12 @@ jobs: node-version: '24' cache: 'yarn' - name: Install packages - env: - YARN_ENABLE_IMMUTABLE_INSTALLS: true - run: | - # npm pkg delete workspaces[5] - # npm pkg delete workspaces[4] - # npm pkg delete workspaces[3] - # npm pkg delete workspaces[1] - corepack enable + run: ./scripts/ci-install.sh examples/test-bundlesize - name: compressed-size-action uses: preactjs/compressed-size-action@v2 continue-on-error: true + env: + YARN_ENABLE_IMMUTABLE_INSTALLS: false with: repo-token: "${{ secrets.GITHUB_TOKEN }}" build-script: "ci:build:bundlesize" diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 16eabb44fe89..3762df45a5b6 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -24,9 +24,7 @@ jobs: cache: 'yarn' registry-url: 'https://registry.npmjs.org' - name: Install packages - run: | - corepack enable - yarn install --immutable + run: ./scripts/ci-install.sh - name: Create Release Pull Request or Publish to npm id: changesets diff --git a/AGENTS.md b/AGENTS.md index 4c7cca3fda45..a90478f10d33 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -27,6 +27,8 @@ Monorepo for `@data-client` npm packages. - **CircleCI** (`.circleci/config.yml`) — PR validation: lint, typecheck, unit tests (React 17/18/native/latest), Node matrix, ESM type checks (TS 4.0–5.3+), browser build. - **GitHub Actions** (`.github/workflows/`) — release (`changesets`), bundle size PR comments, benchmark regression detection. +Changing root `package.json` `workspaces` requires updating `.circleci/config.yml` (`setup` job) and `.github/workflows/` install steps. + ## Changesets Any user-facing change in `packages/*` requires a changeset. Core packages are version-linked (bumping one bumps all). See skill "changeset" for full workflow. diff --git a/scripts/ci-install.sh b/scripts/ci-install.sh new file mode 100755 index 000000000000..9880ddb18764 --- /dev/null +++ b/scripts/ci-install.sh @@ -0,0 +1,29 @@ +#!/bin/bash +# Installs only the workspaces needed for a CI job, then restores +# package.json and yarn.lock so later steps never see a dirty tree. +# +# Usage: scripts/ci-install.sh [extra-workspace ...] +# Always includes packages/* and scripts/rollup-plugins. +# Pass additional workspace paths as arguments. +# +# Examples: +# scripts/ci-install.sh # release / beta-release +# scripts/ci-install.sh examples/benchmark # node benchmark +set -euo pipefail + +WORKSPACES='["packages/*","scripts/rollup-plugins"' +for ws in "$@"; do + WORKSPACES+=',"'"$ws"'"' +done +WORKSPACES+=']' + +node -e " + const f = 'package.json'; + const p = JSON.parse(require('fs').readFileSync(f, 'utf8')); + p.workspaces = $WORKSPACES; + require('fs').writeFileSync(f, JSON.stringify(p, null, 2) + '\n'); +" +corepack enable +YARN_ENABLE_IMMUTABLE_INSTALLS=false yarn install + +git checkout -- package.json yarn.lock