From b23547dd3fa4141dec8ba1ee09d2b0ce5c5888fb Mon Sep 17 00:00:00 2001 From: John Doe Date: Sun, 8 Feb 2026 14:21:40 +0100 Subject: [PATCH 01/16] chore: use tsx for all Nx commands to be able to execute local plugins same as other projects --- .env.example | 8 +++++- .env.local.example | 12 ++++++++ .github/workflows/ci.yml | 2 ++ .github/workflows/code-pushup-fork.yml | 2 ++ .github/workflows/code-pushup.yml | 2 ++ .github/workflows/coverage.yml | 2 ++ .github/workflows/publish.yml | 2 ++ .github/workflows/release.yml | 2 ++ .gitignore | 1 + CONTRIBUTING.md | 39 ++++++++++++++++++++++---- 10 files changed, 65 insertions(+), 7 deletions(-) create mode 100644 .env.local.example diff --git a/.env.example b/.env.example index 64dd9ba97..464d2983f 100644 --- a/.env.example +++ b/.env.example @@ -1,2 +1,8 @@ -# for uploading to portal +# Example environment variables +# These are for reference only - use .env.local for local development + +# For uploading to Code PushUp portal CP_API_KEY= + +# Note: For local development with tsx/TypeScript execution, +# copy .env.local.example to .env.local and configure NODE_OPTIONS there diff --git a/.env.local.example b/.env.local.example new file mode 100644 index 000000000..fe63e05ee --- /dev/null +++ b/.env.local.example @@ -0,0 +1,12 @@ +# Local development environment variables +# Copy this to .env.local (gitignored) and customize for your setup + +# Enable tsx for TypeScript execution in Nx +# This allows running local generator/executor directly as .ts files without pre-compilation +# This allowes the local plugins to import files with .js extensions (same as the packages in the repository) +NODE_OPTIONS=--import tsx +# This is used to resolve the paths in the local generator/executor so local packages can be imported as path aliases +TSX_TSCONFIG_PATH=tsconfig.base.json + +# Local API keys (optional - only if testing upload features) +# CP_API_KEY=your_api_key_here diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c71f05f4e..3f852515a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,6 +9,8 @@ on: env: NX_NON_NATIVE_HASHER: true NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }} + NODE_OPTIONS: --import tsx + TSX_TSCONFIG_PATH: tsconfig.base.json jobs: format: diff --git a/.github/workflows/code-pushup-fork.yml b/.github/workflows/code-pushup-fork.yml index b747702de..cd97a99e1 100644 --- a/.github/workflows/code-pushup-fork.yml +++ b/.github/workflows/code-pushup-fork.yml @@ -13,6 +13,8 @@ on: env: NX_NON_NATIVE_HASHER: true + NODE_OPTIONS: --import tsx + TSX_TSCONFIG_PATH: tsconfig.base.json permissions: pull-requests: write diff --git a/.github/workflows/code-pushup.yml b/.github/workflows/code-pushup.yml index f582753eb..692ca3a7b 100644 --- a/.github/workflows/code-pushup.yml +++ b/.github/workflows/code-pushup.yml @@ -9,6 +9,8 @@ on: env: NX_NON_NATIVE_HASHER: true NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }} + NODE_OPTIONS: --import tsx + TSX_TSCONFIG_PATH: tsconfig.base.json permissions: pull-requests: write diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index 640a76e5d..6ceff1d0f 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -7,6 +7,8 @@ on: env: NX_NON_NATIVE_HASHER: true NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }} + NODE_OPTIONS: --import tsx + TSX_TSCONFIG_PATH: tsconfig.base.json jobs: list-packages: diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index e3896afee..1750ee8b3 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -18,6 +18,8 @@ permissions: env: NX_NON_NATIVE_HASHER: true NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }} + NODE_OPTIONS: --import tsx + TSX_TSCONFIG_PATH: tsconfig.base.json jobs: publish: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d60e37bea..009e3ac99 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -17,6 +17,8 @@ jobs: env: NX_NON_NATIVE_HASHER: true NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }} + NODE_OPTIONS: --import tsx + TSX_TSCONFIG_PATH: tsconfig.base.json steps: - name: Authenticate as "Code PushUp Bot" GitHub App uses: actions/create-github-app-token@v2 diff --git a/.gitignore b/.gitignore index 31d7e1678..1e6ef3822 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ # See http://help.github.com/ignore-files/ for more about ignoring files. .env +.env.local .npmrc # compiled output diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 4c87bcf90..8125f9faa 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -16,11 +16,38 @@ npm install This table provides a quick overview of the environmental setup, with detailed explanations in the corresponding sections. -| Feature | Local Default | CI Default | Description | -| ------------------------------- | ------------- | ---------------- | ----------------------------------------------------------------------------------------------------------------------------- | -| `env.INCLUDE_SLOW_TESTS` **❗️** | `false` | `true` | Controls inclusion of long-running tests. Overridden by setting. Details in the [Testing](#Testing) section. | -| `env.CUSTOM_CHROME_PATH` | N/A | Windows **❗️❗️** | Path to Chrome executable. See [plugin-lighthouse/CONTRIBUTING.md](./packages/plugin-lighthouse/CONTRIBUTING.md#chrome-path). | -| Quality Pipeline | Off | On | Runs all plugins against the codebase. | +| Feature | Local Default | CI Default | Description | +| ------------------------------- | ------------------- | ------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | +| `NODE_OPTIONS` **⚙️** | Set in `.env.local` | Set globally in workflows | `--import tsx` - Enables TypeScript execution for local Nx plugins and generators. **Required for development.** | +| `TSX_TSCONFIG_PATH` **⚙️** | Set in `.env.local` | Set globally in workflows | `tsconfig.base.json` - Resolves TypeScript path aliases for local packages. **Required for development.** | +| `env.INCLUDE_SLOW_TESTS` **❗️** | `false` | `true` | Controls inclusion of long-running tests. Overridden by setting. Details in the [Testing](#Testing) section. | +| `env.CUSTOM_CHROME_PATH` | N/A | Windows **❗️❗️** | Path to Chrome executable. See [plugin-lighthouse/CONTRIBUTING.md](./packages/plugin-lighthouse/CONTRIBUTING.md#chrome-path). | +| Quality Pipeline | Off | On | Runs all plugins against the codebase. | + +**⚙️** TypeScript Execution Setup (Required) + +This project uses local Nx plugins and generators written in TypeScript. To run them, you need: + +1. **Create `.env.local`** (gitignored, local-only): + + ```sh + cp .env.local.example .env.local + ``` + +2. **The file includes** (already configured in the example): + + ```sh + NODE_OPTIONS=--import tsx + TSX_TSCONFIG_PATH=tsconfig.base.json + ``` + +3. **Why these are needed**: + - `NODE_OPTIONS` - Allows importing TypeScript files with `.js` extensions (used throughout the repo) + - `TSX_TSCONFIG_PATH` - Enables path aliases like `@code-pushup/models` in generators/executors + +4. **CI Configuration**: + - Both variables are set **globally** in all GitHub Actions workflows + - Ensures consistent behavior between local development and CI **❗️** Test Inclusion Logic @@ -66,7 +93,7 @@ Some of the plugins have a longer runtime. In order to ensure better DX, longer You can control the execution of long-running tests over the `INCLUDE_SLOW_TESTS` environment variable. -To change this setup, open (or create) the `.env` file in the root folder. +To change this setup, open your `.env.local` file in the root folder (or copy from `.env.local.example` if it doesn't exist). Edit or add the environment variable there as follows: `INCLUDE_SLOW_TESTS=true`. ## Git From 2a8b7bc8990a2e17ce9269f5e9965573bf5b6d2e Mon Sep 17 00:00:00 2001 From: John Doe Date: Sun, 8 Feb 2026 14:29:29 +0100 Subject: [PATCH 02/16] chore: set tsx env vars per job --- .github/workflows/ci.yml | 20 ++++++++++++++++++-- .github/workflows/code-pushup-fork.yml | 8 ++++++-- .github/workflows/code-pushup.yml | 4 ++-- .github/workflows/coverage.yml | 8 ++++++-- .github/workflows/publish.yml | 5 +++-- .github/workflows/release.yml | 6 +++--- CONTRIBUTING.md | 3 ++- 7 files changed, 40 insertions(+), 14 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3f852515a..1dac80167 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,8 +9,6 @@ on: env: NX_NON_NATIVE_HASHER: true NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }} - NODE_OPTIONS: --import tsx - TSX_TSCONFIG_PATH: tsconfig.base.json jobs: format: @@ -31,6 +29,9 @@ jobs: - name: Install dependencies run: npm ci - name: Check formatting of affected files + env: + NODE_OPTIONS: --import tsx + TSX_TSCONFIG_PATH: tsconfig.base.json run: npx nx format:check lint: @@ -51,6 +52,9 @@ jobs: - name: Install dependencies run: npm ci - name: Lint affected projects + env: + NODE_OPTIONS: --import tsx + TSX_TSCONFIG_PATH: tsconfig.base.json run: npx nx affected -t lint --parallel=3 unit-test: @@ -75,6 +79,9 @@ jobs: - name: Install dependencies run: npm ci - name: Unit test affected projects + env: + NODE_OPTIONS: --import tsx + TSX_TSCONFIG_PATH: tsconfig.base.json run: npx nx affected -t unit-test --parallel=3 integration-test: @@ -99,6 +106,9 @@ jobs: - name: Install dependencies run: npm ci - name: Integration test affected projects + env: + NODE_OPTIONS: --import tsx + TSX_TSCONFIG_PATH: tsconfig.base.json run: npx nx affected -t int-test --parallel=3 e2e: @@ -123,6 +133,9 @@ jobs: - name: Install dependencies run: npm ci - name: E2E test affected projects + env: + NODE_OPTIONS: --import tsx + TSX_TSCONFIG_PATH: tsconfig.base.json run: npx nx affected -t e2e-test --parallel=1 build: @@ -143,6 +156,9 @@ jobs: - name: Install dependencies run: npm ci - name: Build all projects # affected is not used to be able to test-releae packages + env: + NODE_OPTIONS: --import tsx + TSX_TSCONFIG_PATH: tsconfig.base.json run: npx nx run-many --target=build --parallel=3 - name: Test-release packages run: npx pkg-pr-new publish "packages/**/dist" diff --git a/.github/workflows/code-pushup-fork.yml b/.github/workflows/code-pushup-fork.yml index cd97a99e1..06a68663a 100644 --- a/.github/workflows/code-pushup-fork.yml +++ b/.github/workflows/code-pushup-fork.yml @@ -13,8 +13,6 @@ on: env: NX_NON_NATIVE_HASHER: true - NODE_OPTIONS: --import tsx - TSX_TSCONFIG_PATH: tsconfig.base.json permissions: pull-requests: write @@ -24,6 +22,9 @@ jobs: runs-on: ubuntu-latest name: Standalone mode (fork) if: github.event.pull_request.head.repo.fork + env: + NODE_OPTIONS: --import tsx + TSX_TSCONFIG_PATH: tsconfig.base.json steps: - name: Checkout repository uses: actions/checkout@v4 @@ -48,6 +49,9 @@ jobs: runs-on: ubuntu-latest name: Monorepo mode (fork) if: github.event.pull_request.head.repo.fork + env: + NODE_OPTIONS: --import tsx + TSX_TSCONFIG_PATH: tsconfig.base.json steps: - name: Checkout repository uses: actions/checkout@v4 diff --git a/.github/workflows/code-pushup.yml b/.github/workflows/code-pushup.yml index 692ca3a7b..509a8ffa6 100644 --- a/.github/workflows/code-pushup.yml +++ b/.github/workflows/code-pushup.yml @@ -9,8 +9,6 @@ on: env: NX_NON_NATIVE_HASHER: true NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }} - NODE_OPTIONS: --import tsx - TSX_TSCONFIG_PATH: tsconfig.base.json permissions: pull-requests: write @@ -50,6 +48,8 @@ jobs: if: ${{ !github.event.pull_request.head.repo.fork }} env: CP_API_KEY: ${{ secrets.CP_API_KEY }} + NODE_OPTIONS: --import tsx + TSX_TSCONFIG_PATH: tsconfig.base.json steps: - name: Checkout repository uses: actions/checkout@v4 diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index 6ceff1d0f..f7f4e70bd 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -7,8 +7,6 @@ on: env: NX_NON_NATIVE_HASHER: true NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }} - NODE_OPTIONS: --import tsx - TSX_TSCONFIG_PATH: tsconfig.base.json jobs: list-packages: @@ -26,6 +24,9 @@ jobs: run: npm ci - name: List packages using Nx CLI id: list-packages + env: + NODE_OPTIONS: --import tsx + TSX_TSCONFIG_PATH: tsconfig.base.json run: | matrix=$(node tools/scripts/create-codecov-matrix.js) echo "matrix=$matrix" >> $GITHUB_OUTPUT @@ -50,6 +51,9 @@ jobs: - name: Install dependencies run: npm ci - name: Execute tests with coverage + env: + NODE_OPTIONS: --import tsx + TSX_TSCONFIG_PATH: tsconfig.base.json run: npx nx run ${{ matrix.project }}:${{ matrix.target }} - name: Upload coverage reports to Codecov uses: codecov/codecov-action@v4 diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 1750ee8b3..ff35ce13b 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -18,8 +18,6 @@ permissions: env: NX_NON_NATIVE_HASHER: true NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }} - NODE_OPTIONS: --import tsx - TSX_TSCONFIG_PATH: tsconfig.base.json jobs: publish: @@ -44,4 +42,7 @@ jobs: - name: Install dependencies run: npm ci - name: Publish packages to npm + env: + NODE_OPTIONS: --import tsx + TSX_TSCONFIG_PATH: tsconfig.base.json run: npx nx release publish diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 009e3ac99..4e2165302 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -17,8 +17,6 @@ jobs: env: NX_NON_NATIVE_HASHER: true NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }} - NODE_OPTIONS: --import tsx - TSX_TSCONFIG_PATH: tsconfig.base.json steps: - name: Authenticate as "Code PushUp Bot" GitHub App uses: actions/create-github-app-token@v2 @@ -48,6 +46,8 @@ jobs: - name: Install dependencies run: npm ci - name: Version, release and generate changelog - run: npx nx release --skip-publish env: + NODE_OPTIONS: --import tsx + TSX_TSCONFIG_PATH: tsconfig.base.json GH_TOKEN: ${{ steps.app-token.outputs.token }} + run: npx nx release --skip-publish diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 8125f9faa..6e87100aa 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -46,7 +46,8 @@ This project uses local Nx plugins and generators written in TypeScript. To run - `TSX_TSCONFIG_PATH` - Enables path aliases like `@code-pushup/models` in generators/executors 4. **CI Configuration**: - - Both variables are set **globally** in all GitHub Actions workflows + - Both variables are set at the **job or step level** in all GitHub Actions workflows + - Applied after `npm ci` to ensure `tsx` is installed before Node tries to import it - Ensures consistent behavior between local development and CI **❗️** Test Inclusion Logic From c1dd85cd561fe128a1ea0520efc0bd86036adfdd Mon Sep 17 00:00:00 2001 From: John Doe Date: Sun, 8 Feb 2026 14:35:38 +0100 Subject: [PATCH 03/16] refactor: wip --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1dac80167..b3e75cfc6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -32,7 +32,7 @@ jobs: env: NODE_OPTIONS: --import tsx TSX_TSCONFIG_PATH: tsconfig.base.json - run: npx nx format:check + run: npx nx format:check --verbose lint: runs-on: ubuntu-latest From 63f25761e25845ca2f0d923fca0f9740140505e6 Mon Sep 17 00:00:00 2001 From: John Doe Date: Sun, 8 Feb 2026 14:41:39 +0100 Subject: [PATCH 04/16] fix: remove NODE_OPTIONS from Code PushUp workflow job env The Code PushUp composite action uses npx tsx explicitly, so NODE_OPTIONS at job level causes "Post job cleanup" errors when tsx is no longer available. The runner script sets NODE_OPTIONS programmatically when needed. Co-authored-by: Cursor --- .github/workflows/ci.yml | 5 +---- .github/workflows/code-pushup-fork.yml | 6 ------ .github/workflows/code-pushup.yml | 2 -- 3 files changed, 1 insertion(+), 12 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b3e75cfc6..812018d64 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -29,10 +29,7 @@ jobs: - name: Install dependencies run: npm ci - name: Check formatting of affected files - env: - NODE_OPTIONS: --import tsx - TSX_TSCONFIG_PATH: tsconfig.base.json - run: npx nx format:check --verbose + run: npx nx format:check lint: runs-on: ubuntu-latest diff --git a/.github/workflows/code-pushup-fork.yml b/.github/workflows/code-pushup-fork.yml index 06a68663a..b747702de 100644 --- a/.github/workflows/code-pushup-fork.yml +++ b/.github/workflows/code-pushup-fork.yml @@ -22,9 +22,6 @@ jobs: runs-on: ubuntu-latest name: Standalone mode (fork) if: github.event.pull_request.head.repo.fork - env: - NODE_OPTIONS: --import tsx - TSX_TSCONFIG_PATH: tsconfig.base.json steps: - name: Checkout repository uses: actions/checkout@v4 @@ -49,9 +46,6 @@ jobs: runs-on: ubuntu-latest name: Monorepo mode (fork) if: github.event.pull_request.head.repo.fork - env: - NODE_OPTIONS: --import tsx - TSX_TSCONFIG_PATH: tsconfig.base.json steps: - name: Checkout repository uses: actions/checkout@v4 diff --git a/.github/workflows/code-pushup.yml b/.github/workflows/code-pushup.yml index 509a8ffa6..f582753eb 100644 --- a/.github/workflows/code-pushup.yml +++ b/.github/workflows/code-pushup.yml @@ -48,8 +48,6 @@ jobs: if: ${{ !github.event.pull_request.head.repo.fork }} env: CP_API_KEY: ${{ secrets.CP_API_KEY }} - NODE_OPTIONS: --import tsx - TSX_TSCONFIG_PATH: tsconfig.base.json steps: - name: Checkout repository uses: actions/checkout@v4 From afc919a028980dfcbecfa679201afa62e3beebc0 Mon Sep 17 00:00:00 2001 From: John Doe Date: Sun, 8 Feb 2026 14:50:39 +0100 Subject: [PATCH 05/16] refactor: wip --- .github/workflows/ci.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 812018d64..1dac80167 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -29,6 +29,9 @@ jobs: - name: Install dependencies run: npm ci - name: Check formatting of affected files + env: + NODE_OPTIONS: --import tsx + TSX_TSCONFIG_PATH: tsconfig.base.json run: npx nx format:check lint: From 642badb1cadedf798ae7fb2dbf26811a4e298739 Mon Sep 17 00:00:00 2001 From: John Doe Date: Sun, 8 Feb 2026 14:57:35 +0100 Subject: [PATCH 06/16] chore: fix markdown formatting in README files Remove extra blank lines to pass prettier checks Co-authored-by: Cursor --- examples/plugins/src/package-json/README.md | 1 - packages/plugin-eslint/README.md | 1 - 2 files changed, 2 deletions(-) diff --git a/examples/plugins/src/package-json/README.md b/examples/plugins/src/package-json/README.md index 34546b094..b3141ffed 100644 --- a/examples/plugins/src/package-json/README.md +++ b/examples/plugins/src/package-json/README.md @@ -20,7 +20,6 @@ You can configure the plugin with the following options: 1. If you haven't already, install [@code-pushup/cli](../cli/README.md) and create a configuration file. 2. Copy the [plugin source](../package-json) as is into your project - 1. Add this plugin to the `plugins` array in your Code PushUp CLI config file (e.g. `code-pushup.config.js`). Pass in the path or the directory to crawl (relative to `process.cwd()`). diff --git a/packages/plugin-eslint/README.md b/packages/plugin-eslint/README.md index 8a4ca9027..31b296864 100644 --- a/packages/plugin-eslint/README.md +++ b/packages/plugin-eslint/README.md @@ -72,7 +72,6 @@ Detected ESLint rules are mapped to Code PushUp audits. Audit reports are calcul ``` If you're using an Nx monorepo, additional helper functions are provided to simplify your configuration: - - If you wish to combine all projects in your workspace into one report, use the `eslintConfigFromAllNxProjects` helper: ```js From 5fee579a5d9f029a4b0601febad47682c2839bed Mon Sep 17 00:00:00 2001 From: John Doe Date: Sun, 8 Feb 2026 15:08:28 +0100 Subject: [PATCH 07/16] refactor: revert --- CONTRIBUTING.md | 40 ++++++---------------------------------- 1 file changed, 6 insertions(+), 34 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 6e87100aa..4c87bcf90 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -16,39 +16,11 @@ npm install This table provides a quick overview of the environmental setup, with detailed explanations in the corresponding sections. -| Feature | Local Default | CI Default | Description | -| ------------------------------- | ------------------- | ------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | -| `NODE_OPTIONS` **⚙️** | Set in `.env.local` | Set globally in workflows | `--import tsx` - Enables TypeScript execution for local Nx plugins and generators. **Required for development.** | -| `TSX_TSCONFIG_PATH` **⚙️** | Set in `.env.local` | Set globally in workflows | `tsconfig.base.json` - Resolves TypeScript path aliases for local packages. **Required for development.** | -| `env.INCLUDE_SLOW_TESTS` **❗️** | `false` | `true` | Controls inclusion of long-running tests. Overridden by setting. Details in the [Testing](#Testing) section. | -| `env.CUSTOM_CHROME_PATH` | N/A | Windows **❗️❗️** | Path to Chrome executable. See [plugin-lighthouse/CONTRIBUTING.md](./packages/plugin-lighthouse/CONTRIBUTING.md#chrome-path). | -| Quality Pipeline | Off | On | Runs all plugins against the codebase. | - -**⚙️** TypeScript Execution Setup (Required) - -This project uses local Nx plugins and generators written in TypeScript. To run them, you need: - -1. **Create `.env.local`** (gitignored, local-only): - - ```sh - cp .env.local.example .env.local - ``` - -2. **The file includes** (already configured in the example): - - ```sh - NODE_OPTIONS=--import tsx - TSX_TSCONFIG_PATH=tsconfig.base.json - ``` - -3. **Why these are needed**: - - `NODE_OPTIONS` - Allows importing TypeScript files with `.js` extensions (used throughout the repo) - - `TSX_TSCONFIG_PATH` - Enables path aliases like `@code-pushup/models` in generators/executors - -4. **CI Configuration**: - - Both variables are set at the **job or step level** in all GitHub Actions workflows - - Applied after `npm ci` to ensure `tsx` is installed before Node tries to import it - - Ensures consistent behavior between local development and CI +| Feature | Local Default | CI Default | Description | +| ------------------------------- | ------------- | ---------------- | ----------------------------------------------------------------------------------------------------------------------------- | +| `env.INCLUDE_SLOW_TESTS` **❗️** | `false` | `true` | Controls inclusion of long-running tests. Overridden by setting. Details in the [Testing](#Testing) section. | +| `env.CUSTOM_CHROME_PATH` | N/A | Windows **❗️❗️** | Path to Chrome executable. See [plugin-lighthouse/CONTRIBUTING.md](./packages/plugin-lighthouse/CONTRIBUTING.md#chrome-path). | +| Quality Pipeline | Off | On | Runs all plugins against the codebase. | **❗️** Test Inclusion Logic @@ -94,7 +66,7 @@ Some of the plugins have a longer runtime. In order to ensure better DX, longer You can control the execution of long-running tests over the `INCLUDE_SLOW_TESTS` environment variable. -To change this setup, open your `.env.local` file in the root folder (or copy from `.env.local.example` if it doesn't exist). +To change this setup, open (or create) the `.env` file in the root folder. Edit or add the environment variable there as follows: `INCLUDE_SLOW_TESTS=true`. ## Git From 3c133ce595fc69808d9c434c5fa452595d551c6b Mon Sep 17 00:00:00 2001 From: John Doe Date: Sun, 8 Feb 2026 15:13:35 +0100 Subject: [PATCH 08/16] fix: use absolute path for TSX_TSCONFIG_PATH in CI workflows E2E tests create temporary directories (e.g. tmp/e2e/plugin-eslint-e2e/) and tsx was trying to resolve the relative path from the current working directory instead of the workspace root, causing: Error: Cannot resolve tsconfig at path: /home/runner/work/cli/cli/tmp/e2e/plugin-eslint-e2e/tsconfig.base.json Solution: Use absolute path ${{ github.workspace }}/tsconfig.base.json in all workflow steps that set TSX_TSCONFIG_PATH. Local .env.local can still use relative path since development happens from the workspace root. Co-authored-by: Cursor --- .github/workflows/ci.yml | 12 ++++++------ .github/workflows/coverage.yml | 4 ++-- .github/workflows/publish.yml | 2 +- .github/workflows/release.yml | 2 +- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1dac80167..8c27a77f7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -31,7 +31,7 @@ jobs: - name: Check formatting of affected files env: NODE_OPTIONS: --import tsx - TSX_TSCONFIG_PATH: tsconfig.base.json + TSX_TSCONFIG_PATH: ${{ github.workspace }}/tsconfig.base.json run: npx nx format:check lint: @@ -54,7 +54,7 @@ jobs: - name: Lint affected projects env: NODE_OPTIONS: --import tsx - TSX_TSCONFIG_PATH: tsconfig.base.json + TSX_TSCONFIG_PATH: ${{ github.workspace }}/tsconfig.base.json run: npx nx affected -t lint --parallel=3 unit-test: @@ -81,7 +81,7 @@ jobs: - name: Unit test affected projects env: NODE_OPTIONS: --import tsx - TSX_TSCONFIG_PATH: tsconfig.base.json + TSX_TSCONFIG_PATH: ${{ github.workspace }}/tsconfig.base.json run: npx nx affected -t unit-test --parallel=3 integration-test: @@ -108,7 +108,7 @@ jobs: - name: Integration test affected projects env: NODE_OPTIONS: --import tsx - TSX_TSCONFIG_PATH: tsconfig.base.json + TSX_TSCONFIG_PATH: ${{ github.workspace }}/tsconfig.base.json run: npx nx affected -t int-test --parallel=3 e2e: @@ -135,7 +135,7 @@ jobs: - name: E2E test affected projects env: NODE_OPTIONS: --import tsx - TSX_TSCONFIG_PATH: tsconfig.base.json + TSX_TSCONFIG_PATH: ${{ github.workspace }}/tsconfig.base.json run: npx nx affected -t e2e-test --parallel=1 build: @@ -158,7 +158,7 @@ jobs: - name: Build all projects # affected is not used to be able to test-releae packages env: NODE_OPTIONS: --import tsx - TSX_TSCONFIG_PATH: tsconfig.base.json + TSX_TSCONFIG_PATH: ${{ github.workspace }}/tsconfig.base.json run: npx nx run-many --target=build --parallel=3 - name: Test-release packages run: npx pkg-pr-new publish "packages/**/dist" diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index f7f4e70bd..c69691adb 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -26,7 +26,7 @@ jobs: id: list-packages env: NODE_OPTIONS: --import tsx - TSX_TSCONFIG_PATH: tsconfig.base.json + TSX_TSCONFIG_PATH: ${{ github.workspace }}/tsconfig.base.json run: | matrix=$(node tools/scripts/create-codecov-matrix.js) echo "matrix=$matrix" >> $GITHUB_OUTPUT @@ -53,7 +53,7 @@ jobs: - name: Execute tests with coverage env: NODE_OPTIONS: --import tsx - TSX_TSCONFIG_PATH: tsconfig.base.json + TSX_TSCONFIG_PATH: ${{ github.workspace }}/tsconfig.base.json run: npx nx run ${{ matrix.project }}:${{ matrix.target }} - name: Upload coverage reports to Codecov uses: codecov/codecov-action@v4 diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index ff35ce13b..bc03e1ecf 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -44,5 +44,5 @@ jobs: - name: Publish packages to npm env: NODE_OPTIONS: --import tsx - TSX_TSCONFIG_PATH: tsconfig.base.json + TSX_TSCONFIG_PATH: ${{ github.workspace }}/tsconfig.base.json run: npx nx release publish diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 4e2165302..2947ef670 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -48,6 +48,6 @@ jobs: - name: Version, release and generate changelog env: NODE_OPTIONS: --import tsx - TSX_TSCONFIG_PATH: tsconfig.base.json + TSX_TSCONFIG_PATH: ${{ github.workspace }}/tsconfig.base.json GH_TOKEN: ${{ steps.app-token.outputs.token }} run: npx nx release --skip-publish From 5f3a281267afd40ff14a9cf60920039eed378055 Mon Sep 17 00:00:00 2001 From: John Doe Date: Sun, 8 Feb 2026 15:16:47 +0100 Subject: [PATCH 09/16] refactor: wip --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8c27a77f7..4e36b0caf 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -32,7 +32,7 @@ jobs: env: NODE_OPTIONS: --import tsx TSX_TSCONFIG_PATH: ${{ github.workspace }}/tsconfig.base.json - run: npx nx format:check + run: NX_DAEMON=false npx nx format:check --skipNxCache lint: runs-on: ubuntu-latest From 06fa553da0d47b7bab56f7db84d1070446a3881c Mon Sep 17 00:00:00 2001 From: John Doe Date: Sun, 8 Feb 2026 15:32:45 +0100 Subject: [PATCH 10/16] refactor: wip --- testing/test-setup/src/lib/os.setup-file.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 testing/test-setup/src/lib/os.setup-file.ts diff --git a/testing/test-setup/src/lib/os.setup-file.ts b/testing/test-setup/src/lib/os.setup-file.ts new file mode 100644 index 000000000..6432fa375 --- /dev/null +++ b/testing/test-setup/src/lib/os.setup-file.ts @@ -0,0 +1,14 @@ +import os from 'node:os'; +import { afterEach, beforeEach, vi } from 'vitest'; + +export const MOCK_AVAILABLE_PARALLELISM = 1; + +const availableParallelismMock = vi.spyOn(os, 'availableParallelism'); + +beforeEach(() => { + availableParallelismMock.mockReturnValue(MOCK_AVAILABLE_PARALLELISM); +}); + +afterEach(() => { + availableParallelismMock.mockClear(); +}); From 6d445b010d5d395ed25bdcf03ab886c5f167c7d2 Mon Sep 17 00:00:00 2001 From: John Doe Date: Sun, 8 Feb 2026 15:33:18 +0100 Subject: [PATCH 11/16] refactor: wip --- testing/test-setup/src/lib/os.setup-file.ts | 14 -------------- 1 file changed, 14 deletions(-) delete mode 100644 testing/test-setup/src/lib/os.setup-file.ts diff --git a/testing/test-setup/src/lib/os.setup-file.ts b/testing/test-setup/src/lib/os.setup-file.ts deleted file mode 100644 index 6432fa375..000000000 --- a/testing/test-setup/src/lib/os.setup-file.ts +++ /dev/null @@ -1,14 +0,0 @@ -import os from 'node:os'; -import { afterEach, beforeEach, vi } from 'vitest'; - -export const MOCK_AVAILABLE_PARALLELISM = 1; - -const availableParallelismMock = vi.spyOn(os, 'availableParallelism'); - -beforeEach(() => { - availableParallelismMock.mockReturnValue(MOCK_AVAILABLE_PARALLELISM); -}); - -afterEach(() => { - availableParallelismMock.mockClear(); -}); From 45501c0e81920532901e76665505542cff2e2bdb Mon Sep 17 00:00:00 2001 From: John Doe Date: Sun, 8 Feb 2026 15:40:39 +0100 Subject: [PATCH 12/16] refactor: wip --- .github/workflows/ci.yml | 30 ++++++------------------------ .github/workflows/coverage.yml | 10 ++-------- .github/workflows/publish.yml | 5 +---- .github/workflows/release.yml | 4 +--- package.json | 4 +++- 5 files changed, 13 insertions(+), 40 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4e36b0caf..da05e9986 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -29,10 +29,7 @@ jobs: - name: Install dependencies run: npm ci - name: Check formatting of affected files - env: - NODE_OPTIONS: --import tsx - TSX_TSCONFIG_PATH: ${{ github.workspace }}/tsconfig.base.json - run: NX_DAEMON=false npx nx format:check --skipNxCache + run: NX_DAEMON=false npm run tsx-nx -- format:check --skipNxCache lint: runs-on: ubuntu-latest @@ -52,10 +49,7 @@ jobs: - name: Install dependencies run: npm ci - name: Lint affected projects - env: - NODE_OPTIONS: --import tsx - TSX_TSCONFIG_PATH: ${{ github.workspace }}/tsconfig.base.json - run: npx nx affected -t lint --parallel=3 + run: npm run tsx-nx -- affected -t lint --parallel=3 unit-test: strategy: @@ -79,10 +73,7 @@ jobs: - name: Install dependencies run: npm ci - name: Unit test affected projects - env: - NODE_OPTIONS: --import tsx - TSX_TSCONFIG_PATH: ${{ github.workspace }}/tsconfig.base.json - run: npx nx affected -t unit-test --parallel=3 + run: npm run tsx-nx -- affected -t unit-test --parallel=3 integration-test: strategy: @@ -106,10 +97,7 @@ jobs: - name: Install dependencies run: npm ci - name: Integration test affected projects - env: - NODE_OPTIONS: --import tsx - TSX_TSCONFIG_PATH: ${{ github.workspace }}/tsconfig.base.json - run: npx nx affected -t int-test --parallel=3 + run: npm run tsx-nx -- affected -t int-test --parallel=3 e2e: strategy: @@ -133,10 +121,7 @@ jobs: - name: Install dependencies run: npm ci - name: E2E test affected projects - env: - NODE_OPTIONS: --import tsx - TSX_TSCONFIG_PATH: ${{ github.workspace }}/tsconfig.base.json - run: npx nx affected -t e2e-test --parallel=1 + run: npm run tsx-nx -- affected -t e2e-test --parallel=1 build: runs-on: ubuntu-latest @@ -156,9 +141,6 @@ jobs: - name: Install dependencies run: npm ci - name: Build all projects # affected is not used to be able to test-releae packages - env: - NODE_OPTIONS: --import tsx - TSX_TSCONFIG_PATH: ${{ github.workspace }}/tsconfig.base.json - run: npx nx run-many --target=build --parallel=3 + run: npm run tsx-nx -- run-many --target=build --parallel=3 - name: Test-release packages run: npx pkg-pr-new publish "packages/**/dist" diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index c69691adb..d94aad96f 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -24,11 +24,8 @@ jobs: run: npm ci - name: List packages using Nx CLI id: list-packages - env: - NODE_OPTIONS: --import tsx - TSX_TSCONFIG_PATH: ${{ github.workspace }}/tsconfig.base.json run: | - matrix=$(node tools/scripts/create-codecov-matrix.js) + matrix=$(npm run tsx-node -- tools/scripts/create-codecov-matrix.js) echo "matrix=$matrix" >> $GITHUB_OUTPUT outputs: matrix: ${{ steps.list-packages.outputs.matrix }} @@ -51,10 +48,7 @@ jobs: - name: Install dependencies run: npm ci - name: Execute tests with coverage - env: - NODE_OPTIONS: --import tsx - TSX_TSCONFIG_PATH: ${{ github.workspace }}/tsconfig.base.json - run: npx nx run ${{ matrix.project }}:${{ matrix.target }} + run: npm run tsx-nx -- run ${{ matrix.project }}:${{ matrix.target }} - name: Upload coverage reports to Codecov uses: codecov/codecov-action@v4 with: diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index bc03e1ecf..8a93c196d 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -42,7 +42,4 @@ jobs: - name: Install dependencies run: npm ci - name: Publish packages to npm - env: - NODE_OPTIONS: --import tsx - TSX_TSCONFIG_PATH: ${{ github.workspace }}/tsconfig.base.json - run: npx nx release publish + run: npm run tsx-nx -- release publish diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 2947ef670..cce2d9cf8 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -47,7 +47,5 @@ jobs: run: npm ci - name: Version, release and generate changelog env: - NODE_OPTIONS: --import tsx - TSX_TSCONFIG_PATH: ${{ github.workspace }}/tsconfig.base.json GH_TOKEN: ${{ steps.app-token.outputs.token }} - run: npx nx release --skip-publish + run: npm run tsx-nx -- release --skip-publish diff --git a/package.json b/package.json index 52a48a7d4..f451bc9ce 100644 --- a/package.json +++ b/package.json @@ -15,7 +15,9 @@ "scripts": { "prepare": "husky install", "commit": "git-cz", - "knip": "knip" + "knip": "knip", + "tsx-nx": "NODE_OPTIONS='--import tsx' TSX_TSCONFIG_PATH=\"${GITHUB_WORKSPACE:-$PWD}/tsconfig.base.json\" nx", + "tsx-node": "NODE_OPTIONS='--import tsx' TSX_TSCONFIG_PATH=\"${GITHUB_WORKSPACE:-$PWD}/tsconfig.base.json\" node" }, "private": true, "dependencies": { From fd4c9c007325d883e8be94efae9773d5a7544b9d Mon Sep 17 00:00:00 2001 From: John Doe Date: Sun, 8 Feb 2026 15:48:38 +0100 Subject: [PATCH 13/16] refactor: wip --- .github/workflows/ci.yml | 12 ++++++------ .github/workflows/coverage.yml | 4 ++-- .github/workflows/publish.yml | 2 +- .github/workflows/release.yml | 2 +- package-lock.json | 26 ++++++++++++++++++++++++++ package.json | 5 +++-- 6 files changed, 39 insertions(+), 12 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index da05e9986..eb2983694 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -29,7 +29,7 @@ jobs: - name: Install dependencies run: npm ci - name: Check formatting of affected files - run: NX_DAEMON=false npm run tsx-nx -- format:check --skipNxCache + run: NX_DAEMON=false npm run ci:nx -- format:check --skipNxCache lint: runs-on: ubuntu-latest @@ -49,7 +49,7 @@ jobs: - name: Install dependencies run: npm ci - name: Lint affected projects - run: npm run tsx-nx -- affected -t lint --parallel=3 + run: npm run ci:nx -- affected -t lint --parallel=3 unit-test: strategy: @@ -73,7 +73,7 @@ jobs: - name: Install dependencies run: npm ci - name: Unit test affected projects - run: npm run tsx-nx -- affected -t unit-test --parallel=3 + run: npm run ci:nx -- affected -t unit-test --parallel=3 integration-test: strategy: @@ -97,7 +97,7 @@ jobs: - name: Install dependencies run: npm ci - name: Integration test affected projects - run: npm run tsx-nx -- affected -t int-test --parallel=3 + run: npm run ci:nx -- affected -t int-test --parallel=3 e2e: strategy: @@ -121,7 +121,7 @@ jobs: - name: Install dependencies run: npm ci - name: E2E test affected projects - run: npm run tsx-nx -- affected -t e2e-test --parallel=1 + run: npm run ci:nx -- affected -t e2e-test --parallel=1 build: runs-on: ubuntu-latest @@ -141,6 +141,6 @@ jobs: - name: Install dependencies run: npm ci - name: Build all projects # affected is not used to be able to test-releae packages - run: npm run tsx-nx -- run-many --target=build --parallel=3 + run: npm run ci:nx -- run-many --target=build --parallel=3 - name: Test-release packages run: npx pkg-pr-new publish "packages/**/dist" diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index d94aad96f..fc512c4c7 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -25,7 +25,7 @@ jobs: - name: List packages using Nx CLI id: list-packages run: | - matrix=$(npm run tsx-node -- tools/scripts/create-codecov-matrix.js) + matrix=$(npm run ci:node -- tools/scripts/create-codecov-matrix.js) echo "matrix=$matrix" >> $GITHUB_OUTPUT outputs: matrix: ${{ steps.list-packages.outputs.matrix }} @@ -48,7 +48,7 @@ jobs: - name: Install dependencies run: npm ci - name: Execute tests with coverage - run: npm run tsx-nx -- run ${{ matrix.project }}:${{ matrix.target }} + run: npm run ci:nx -- run ${{ matrix.project }}:${{ matrix.target }} - name: Upload coverage reports to Codecov uses: codecov/codecov-action@v4 with: diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 8a93c196d..ac1b27fbd 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -42,4 +42,4 @@ jobs: - name: Install dependencies run: npm ci - name: Publish packages to npm - run: npm run tsx-nx -- release publish + run: npm run ci:nx -- release publish diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index cce2d9cf8..6dc413d8d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -48,4 +48,4 @@ jobs: - name: Version, release and generate changelog env: GH_TOKEN: ${{ steps.app-token.outputs.token }} - run: npm run tsx-nx -- release --skip-publish + run: npm run ci:nx -- release --skip-publish diff --git a/package-lock.json b/package-lock.json index de389cb9b..17728d183 100644 --- a/package-lock.json +++ b/package-lock.json @@ -76,6 +76,7 @@ "chromium": "^3.0.3", "commitizen": "^4.3.1", "commitlint-plugin-tense": "^1.0.3", + "cross-env": "^10.1.0", "dotenv": "^16.4.5", "eslint-import-resolver-typescript": "^3.6.1", "eslint-plugin-functional": "^7.1.0", @@ -2792,6 +2793,13 @@ "tslib": "^2.4.0" } }, + "node_modules/@epic-web/invariant": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/@epic-web/invariant/-/invariant-1.0.0.tgz", + "integrity": "sha512-lrTPqgvfFQtR/eY/qkIzp98OGdNJu0m5ji3q/nJI8v3SXkRKEnWiOxMmbvcSoAIzv/cGiuvRy57k4suKQSAdwA==", + "dev": true, + "license": "MIT" + }, "node_modules/@esbuild/aix-ppc64": { "version": "0.23.1", "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.23.1.tgz", @@ -14349,6 +14357,24 @@ "node": ">=12.0.0" } }, + "node_modules/cross-env": { + "version": "10.1.0", + "resolved": "https://registry.npmjs.org/cross-env/-/cross-env-10.1.0.tgz", + "integrity": "sha512-GsYosgnACZTADcmEyJctkJIoqAhHjttw7RsFrVoJNXbsWWqaq6Ym+7kZjq6mS45O0jij6vtiReppKQEtqWy6Dw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@epic-web/invariant": "^1.0.0", + "cross-spawn": "^7.0.6" + }, + "bin": { + "cross-env": "dist/bin/cross-env.js", + "cross-env-shell": "dist/bin/cross-env-shell.js" + }, + "engines": { + "node": ">=20" + } + }, "node_modules/cross-fetch": { "version": "3.1.8", "resolved": "https://registry.npmjs.org/cross-fetch/-/cross-fetch-3.1.8.tgz", diff --git a/package.json b/package.json index f451bc9ce..ce1ead0a2 100644 --- a/package.json +++ b/package.json @@ -16,8 +16,8 @@ "prepare": "husky install", "commit": "git-cz", "knip": "knip", - "tsx-nx": "NODE_OPTIONS='--import tsx' TSX_TSCONFIG_PATH=\"${GITHUB_WORKSPACE:-$PWD}/tsconfig.base.json\" nx", - "tsx-node": "NODE_OPTIONS='--import tsx' TSX_TSCONFIG_PATH=\"${GITHUB_WORKSPACE:-$PWD}/tsconfig.base.json\" node" + "ci:nx": "cross-env-shell NODE_OPTIONS=\"--import tsx\" \"TSX_TSCONFIG_PATH=${GITHUB_WORKSPACE:-$PWD}/tsconfig.base.json\" nx", + "ci:node": "cross-env-shell NODE_OPTIONS=\"--import tsx\" \"TSX_TSCONFIG_PATH=${GITHUB_WORKSPACE:-$PWD}/tsconfig.base.json\" node" }, "private": true, "dependencies": { @@ -88,6 +88,7 @@ "chromium": "^3.0.3", "commitizen": "^4.3.1", "commitlint-plugin-tense": "^1.0.3", + "cross-env": "^10.1.0", "dotenv": "^16.4.5", "eslint-import-resolver-typescript": "^3.6.1", "eslint-plugin-functional": "^7.1.0", From b6f1ad4b9404529d435650442f9a9384308823ed Mon Sep 17 00:00:00 2001 From: John Doe Date: Sun, 8 Feb 2026 16:05:28 +0100 Subject: [PATCH 14/16] refactor: wip --- package.json | 4 ++-- tools/scripts/ci-tsx.js | 45 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+), 2 deletions(-) create mode 100644 tools/scripts/ci-tsx.js diff --git a/package.json b/package.json index ce1ead0a2..3c5bb4446 100644 --- a/package.json +++ b/package.json @@ -16,8 +16,8 @@ "prepare": "husky install", "commit": "git-cz", "knip": "knip", - "ci:nx": "cross-env-shell NODE_OPTIONS=\"--import tsx\" \"TSX_TSCONFIG_PATH=${GITHUB_WORKSPACE:-$PWD}/tsconfig.base.json\" nx", - "ci:node": "cross-env-shell NODE_OPTIONS=\"--import tsx\" \"TSX_TSCONFIG_PATH=${GITHUB_WORKSPACE:-$PWD}/tsconfig.base.json\" node" + "ci:nx": "node tools/scripts/ci-tsx.js nx", + "ci:node": "node tools/scripts/ci-tsx.js node" }, "private": true, "dependencies": { diff --git a/tools/scripts/ci-tsx.js b/tools/scripts/ci-tsx.js new file mode 100644 index 000000000..73df667dc --- /dev/null +++ b/tools/scripts/ci-tsx.js @@ -0,0 +1,45 @@ +// @ts-check +import { spawn } from 'node:child_process'; +import { resolve } from 'node:path'; + +// Determine the workspace root (GITHUB_WORKSPACE or current working directory) +const workspaceRoot = process.env.GITHUB_WORKSPACE || process.cwd(); +const tsconfigPath = resolve(workspaceRoot, 'tsconfig.base.json'); + +// Set up environment variables +const env = { + ...process.env, + NODE_OPTIONS: '--import tsx', + TSX_TSCONFIG_PATH: tsconfigPath, +}; + +// Get the command and its arguments from the command line +const [command, ...args] = process.argv.slice(2); + +if (!command) { + console.error('Usage: node ci-tsx.js [args...]'); + console.error('Example: node ci-tsx.js nx affected -t test'); + process.exit(1); +} + +// Spawn the command with the configured environment +const child = spawn(command, args, { + env, + stdio: 'inherit', + shell: true, +}); + +// Forward exit code +child.on('exit', (code, signal) => { + if (signal) { + process.kill(process.pid, signal); + } else { + process.exit(code ?? 0); + } +}); + +// Handle errors +child.on('error', error => { + console.error('Failed to start child process:', error); + process.exit(1); +}); From 78b79633972f3d86245da36645784d59af2dd666 Mon Sep 17 00:00:00 2001 From: John Doe Date: Sun, 8 Feb 2026 16:08:13 +0100 Subject: [PATCH 15/16] refactor: wip --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index eb2983694..375866437 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -29,7 +29,7 @@ jobs: - name: Install dependencies run: npm ci - name: Check formatting of affected files - run: NX_DAEMON=false npm run ci:nx -- format:check --skipNxCache + run: npm run ci:nx -- format:check lint: runs-on: ubuntu-latest From 3571d73c1afcdf91997ed15b4ece2e04afe6df43 Mon Sep 17 00:00:00 2001 From: John Doe Date: Sun, 8 Feb 2026 16:18:35 +0100 Subject: [PATCH 16/16] refactor: wip --- tools/scripts/ci-tsx.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tools/scripts/ci-tsx.js b/tools/scripts/ci-tsx.js index 73df667dc..22fad1a94 100644 --- a/tools/scripts/ci-tsx.js +++ b/tools/scripts/ci-tsx.js @@ -22,6 +22,9 @@ if (!command) { process.exit(1); } +// Log the command being executed +console.log(`> ${command} ${args.join(' ')}`); + // Spawn the command with the configured environment const child = spawn(command, args, { env,