An open source design system that's fully customizable and agent ready
TypeScript
ci: read the Node version from .nvmrc and share one setup action (#3753)
sangwook37c19d35a25a
diff --git a/.github/actions/setup/action.yml b/.github/actions/setup/action.ymlnew file mode 100644index 0000000000..5a1325268d--- /dev/null+++ b/.github/actions/setup/action.yml@@ -0,0 +1,41 @@+# Copyright (c) Meta Platforms, Inc. and affiliates.++name: 'Setup Node and pnpm'+description: >-+ Install pnpm, set up Node from .nvmrc with the pnpm store cached, and+ optionally install workspace dependencies. Requires actions/checkout to have+ run first — .nvmrc and the composite action itself are read from the+ checked-out tree.++inputs:+ install:+ description: 'Run `pnpm install --frozen-lockfile` after Node is set up.'+ required: false+ default: 'true'+ registry-url:+ description: >-+ npm registry to authenticate against. Publishing jobs set this so+ setup-node writes the auth config npm publish needs.+ required: false+ default: ''++runs:+ using: composite+ steps:+ # pnpm has to be on PATH before setup-node, otherwise `cache: pnpm` cannot+ # resolve the store path. The version comes from package.json's+ # `packageManager` field — never pin it here as well.+ - uses: pnpm/action-setup@v6++ # .nvmrc is the single source of truth for the Node version, shared with+ # local nvm / fnm / mise. The 24.x line also bundles npm >= 11.5.1, which+ # release.yml requires for OIDC trusted publishing.+ - uses: actions/setup-node@v6+ with:+ node-version-file: .nvmrc+ cache: pnpm+ registry-url: ${{ inputs.registry-url }}++ - if: inputs.install == 'true'+ run: pnpm install --frozen-lockfile+ shell: bashdiff --git a/.github/workflows/ci.yml b/.github/workflows/ci.ymlindex 874872a8db..16d4365036 100644--- a/.github/workflows/ci.yml+++ b/.github/workflows/ci.yml@@ -59,13 +59,7 @@ jobs:steps:- uses: actions/checkout@v7- - uses: pnpm/action-setup@v6- - uses: actions/setup-node@v6- with:- node-version: 24- cache: 'pnpm'-- - run: pnpm install --frozen-lockfile+ - uses: ./.github/actions/setup# docsite `generate` runs `astryx theme build`, which imports the compiled# @astryxdesign/core/theme entry (dist/theme/index.js). Build core first so that@@ -113,15 +107,7 @@ jobs:- uses: actions/checkout@v7if: needs.check-scope.outputs.docsite_only != 'true'- - uses: pnpm/action-setup@v6- if: needs.check-scope.outputs.docsite_only != 'true'- - uses: actions/setup-node@v6- if: needs.check-scope.outputs.docsite_only != 'true'- with:- node-version: 24- cache: 'pnpm'-- - run: pnpm install --frozen-lockfile+ - uses: ./.github/actions/setupif: needs.check-scope.outputs.docsite_only != 'true'- name: Check copyright headers@@ -164,20 +150,9 @@ jobs:if: needs.check-scope.outputs.docsite_only != 'true' && github.event_name == 'pull_request'run: git fetch origin ${{ github.base_ref }} --depth=1- - name: Setup pnpm- if: needs.check-scope.outputs.docsite_only != 'true'- uses: pnpm/action-setup@v6-- - name: Setup Node.js- if: needs.check-scope.outputs.docsite_only != 'true'- uses: actions/setup-node@v6- with:- node-version: 24- cache: 'pnpm'-- - name: Install dependencies+ - name: Setup Node and pnpmif: needs.check-scope.outputs.docsite_only != 'true'- run: pnpm install --frozen-lockfile+ uses: ./.github/actions/setup- name: Build core packageif: needs.check-scope.outputs.docsite_only != 'true'@@ -371,10 +346,13 @@ jobs:- name: Checkoutuses: actions/checkout@v7+ # Node only. This job reads a downloaded artifact and posts a comment; it+ # never installs workspace deps, so it skips the composite action and the+ # pnpm store cache restore that comes with it.- name: Setup Node.jsuses: actions/setup-node@v6with:- node-version: 24+ node-version-file: .nvmrc- name: Download analysis artifactuses: actions/download-artifact@v8@@ -445,14 +423,12 @@ jobs:- name: Checkoutuses: actions/checkout@v7- - name: Setup pnpm- uses: pnpm/action-setup@v6-- - name: Setup Node.js- uses: actions/setup-node@v6+ # Dependencies are installed later, together with the Playwright browser,+ # because the analysis artifact has to be downloaded first.+ - name: Setup Node and pnpm+ uses: ./.github/actions/setupwith:- node-version: 24- cache: 'pnpm'+ install: 'false'- name: Download analysis artifactuses: actions/download-artifact@v8@@ -500,10 +476,13 @@ jobs:- name: Checkoutuses: actions/checkout@v7+ # Node only. This job reads a downloaded artifact and posts a comment; it+ # never installs workspace deps, so it skips the composite action and the+ # pnpm store cache restore that comes with it.- name: Setup Node.jsuses: actions/setup-node@v6with:- node-version: 24+ node-version-file: .nvmrc- name: Download analysis artifactuses: actions/download-artifact@v8diff --git a/.github/workflows/cli-smoke-test.yml b/.github/workflows/cli-smoke-test.ymlindex 8aacf5857a..6e458a7629 100644--- a/.github/workflows/cli-smoke-test.yml+++ b/.github/workflows/cli-smoke-test.yml@@ -25,13 +25,7 @@ jobs:steps:- uses: actions/checkout@v7- - uses: pnpm/action-setup@v6- - uses: actions/setup-node@v6- with:- node-version: 24- cache: "pnpm"-- - run: pnpm install --frozen-lockfile+ - uses: ./.github/actions/setup- name: CLI smoke testrun: node .github/scripts/cli-smoke-test.mjsdiff --git a/.github/workflows/codemod-verify.yml b/.github/workflows/codemod-verify.ymlindex f36c088afd..d58533cf7e 100644--- a/.github/workflows/codemod-verify.yml+++ b/.github/workflows/codemod-verify.yml@@ -37,13 +37,7 @@ jobs:with:fetch-depth: 0- - uses: pnpm/action-setup@v6- - uses: actions/setup-node@v6- with:- node-version: 24- cache: "pnpm"-- - run: pnpm install --frozen-lockfile+ - uses: ./.github/actions/setup- name: Verify codemod reproduces callsite changesid: verifydiff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.ymlindex e5e9043539..e84e68243c 100644--- a/.github/workflows/deploy.yml+++ b/.github/workflows/deploy.yml@@ -54,13 +54,7 @@ jobs:with:ref: main- - uses: pnpm/action-setup@v6- - uses: actions/setup-node@v6- with:- node-version: 24- cache: 'pnpm'-- - run: pnpm install --frozen-lockfile+ - uses: ./.github/actions/setup- run: pnpm test@@ -98,17 +92,8 @@ jobs:with:ref: main- - name: Setup pnpm- uses: pnpm/action-setup@v6-- - name: Setup Node.js- uses: actions/setup-node@v6- with:- node-version: 24- cache: 'pnpm'-- - name: Install dependencies- run: pnpm install --frozen-lockfile+ - name: Setup Node and pnpm+ uses: ./.github/actions/setup- name: Build core packagerun: pnpm builddiff --git a/.github/workflows/lint.yml b/.github/workflows/lint.ymlindex 4e384487c0..0f52270e3f 100644--- a/.github/workflows/lint.yml+++ b/.github/workflows/lint.yml@@ -41,15 +41,7 @@ jobs:if: steps.scope.outputs.docsite_only == 'true'run: echo "Docsite-only PR — skipping lint"- - uses: pnpm/action-setup@v6- if: steps.scope.outputs.docsite_only != 'true'- - uses: actions/setup-node@v6- if: steps.scope.outputs.docsite_only != 'true'- with:- node-version: 24- cache: 'pnpm'-- - run: pnpm install --frozen-lockfile+ - uses: ./.github/actions/setupif: steps.scope.outputs.docsite_only != 'true'- name: Clear ESLint cachediff --git a/.github/workflows/redeploy-preview.yml b/.github/workflows/redeploy-preview.ymlindex 08ac7211db..416f483a6e 100644--- a/.github/workflows/redeploy-preview.yml+++ b/.github/workflows/redeploy-preview.yml@@ -47,17 +47,8 @@ jobs:with:ref: ${{ steps.pr-info.outputs.head_sha }}- - name: Setup pnpm- uses: pnpm/action-setup@v6-- - name: Setup Node.js- uses: actions/setup-node@v6- with:- node-version: 24- cache: pnpm-- - name: Install dependencies- run: pnpm install --frozen-lockfile+ - name: Setup Node and pnpm+ uses: ./.github/actions/setup- name: Build corerun: pnpm builddiff --git a/.github/workflows/release.yml b/.github/workflows/release.ymlindex d68293ce6d..1d5003824a 100644--- a/.github/workflows/release.yml+++ b/.github/workflows/release.yml@@ -71,19 +71,14 @@ jobs:- name: Checkoutuses: actions/checkout@v7- - name: Setup pnpm- uses: pnpm/action-setup@v6-- - name: Setup Node.js- uses: actions/setup-node@v6+ # registry-url makes setup-node write the auth config `npm publish` reads.+ # The Node line in .nvmrc must stay >= 24 so npm >= 11.5.1 ships with it,+ # which OIDC trusted publishing requires.+ - name: Setup Node and pnpm+ uses: ./.github/actions/setupwith:- node-version: 24 # bundles npm >= 11.5.1, required for OIDC publishing- cache: 'pnpm'registry-url: 'https://registry.npmjs.org'- - name: Install dependencies- run: pnpm install --frozen-lockfile-- name: Build all packagesrun: pnpm build@@ -136,19 +131,14 @@ jobs:- name: Checkoutuses: actions/checkout@v7- - name: Setup pnpm- uses: pnpm/action-setup@v6-- - name: Setup Node.js- uses: actions/setup-node@v6+ # registry-url makes setup-node write the auth config `npm publish` reads.+ # The Node line in .nvmrc must stay >= 24 so npm >= 11.5.1 ships with it,+ # which OIDC trusted publishing requires.+ - name: Setup Node and pnpm+ uses: ./.github/actions/setupwith:- node-version: 24 # bundles npm >= 11.5.1, required for OIDC publishing- cache: 'pnpm'registry-url: 'https://registry.npmjs.org'- - name: Install dependencies- run: pnpm install --frozen-lockfile-- name: Build all packagesrun: pnpm builddiff --git a/.github/workflows/vibe-screenshots.yml b/.github/workflows/vibe-screenshots.ymlindex 2e93cb2976..24443bc85c 100644--- a/.github/workflows/vibe-screenshots.yml+++ b/.github/workflows/vibe-screenshots.yml@@ -41,17 +41,8 @@ jobs:- name: Checkoutuses: actions/checkout@v7- - name: Setup pnpm- uses: pnpm/action-setup@v6-- - name: Setup Node.js- uses: actions/setup-node@v6- with:- node-version: '24'- cache: 'pnpm'-- - name: Install dependencies- run: pnpm install --frozen-lockfile+ - name: Setup Node and pnpm+ uses: ./.github/actions/setup- name: Build core packagesrun: pnpm build@@ -84,17 +75,8 @@ jobs:- name: Checkoutuses: actions/checkout@v7- - name: Setup pnpm- uses: pnpm/action-setup@v6-- - name: Setup Node.js- uses: actions/setup-node@v6- with:- node-version: '24'- cache: 'pnpm'-- - name: Install dependencies- run: pnpm install --frozen-lockfile+ - name: Setup Node and pnpm+ uses: ./.github/actions/setup- name: Install Playwrightrun: npx playwright install chromium --with-depsdiff --git a/.gitignore b/.gitignoreindex f63b8f1d20..c505f37a08 100644--- a/.gitignore+++ b/.gitignore@@ -60,3 +60,11 @@ apps/example-nextjs-tailwind/.next# Lockfiles (pnpm is the package manager — see pnpm-workspace.yaml)package-lock.jsonyarn.lock++# Node version managers (.nvmrc is the single source — CI reads it via+# node-version-file). Ignored so a personal asdf/mise/nodenv file cannot drift+# from it. If the team ever moves to one of these, delete the matching line+# here first — otherwise the new file is silently left out of the commit.+.node-version+.tool-versions+mise.tomldiff --git a/.nvmrc b/.nvmrcnew file mode 100644index 0000000000..a45fd52cc5--- /dev/null+++ b/.nvmrc@@ -0,0 +1 @@+24diff --git a/CONTRIBUTING.md b/CONTRIBUTING.mdindex 722c02ba2e..3fd604bbe1 100644--- a/CONTRIBUTING.md+++ b/CONTRIBUTING.md@@ -17,16 +17,21 @@ This file covers local development setup.### Node.js-Install Node.js 22+ from an active LTS line using one of these methods:+The Node version lives in `.nvmrc` (currently the 24.x line). CI reads the same+file via `node-version-file`, so local and CI never drift apart. Don't declare+the version anywhere else.**Via nvm (recommended):**```bashcurl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bashsource ~/.zshrc-nvm install 22+nvm install # no argument — reads .nvmrc```+`fnm` and `mise` read `.nvmrc` too. `asdf` does not; its `.tool-versions` is+git-ignored precisely so it cannot become a competing source of truth.+**Via nodejs.org:**Download and install from https://nodejs.org