chore: use tsx for Nx commands to execute local plugins same as other projects#1241
Closed
chore: use tsx for Nx commands to execute local plugins same as other projects#1241
Conversation
…s same as other projects
|
View your CI Pipeline Execution ↗ for commit 3571d73
☁️ Nx Cloud last updated this comment at |
@code-pushup/ci
@code-pushup/cli
@code-pushup/core
@code-pushup/create-cli
@code-pushup/models
@code-pushup/axe-plugin
@code-pushup/nx-plugin
@code-pushup/coverage-plugin
@code-pushup/eslint-plugin
@code-pushup/js-packages-plugin
@code-pushup/jsdocs-plugin
@code-pushup/lighthouse-plugin
@code-pushup/typescript-plugin
@code-pushup/utils
commit: |
Contributor
Code PushUp🤨 Code PushUp report has both improvements and regressions – compared current commit 9f23abb with previous commit 3dbf378. 🕵️ See full comparison in Code PushUp portal 🔍 🏷️ Categories👎 2 groups regressed, 👍 4 audits improved, 👎 3 audits regressed, 12 audits changed without impacting score🗃️ Groups
32 other groups are unchanged. 🛡️ Audits
660 other audits are unchanged. |
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 <cursoragent@cursor.com>
Remove extra blank lines to pass prettier checks Co-authored-by: Cursor <cursoragent@cursor.com>
Contributor
Code PushUp🥳 Code PushUp report has improved – compared current commit 9f23abb with previous commit 3dbf378. 💼 Project
|
| 🏷️ Category | ⭐ Previous score | ⭐ Current score | 🔄 Score change |
|---|---|---|---|
| Code coverage | 🟢 95 | 🟢 95 | |
| Documentation | 🟡 61 | 🟡 61 |
4 other categories are unchanged.
👍 2 groups improved, 👍 1 audit improved
🗃️ Groups
| 🔌 Plugin | 🗃️ Group | ⭐ Previous score | ⭐ Current score | 🔄 Score change |
|---|---|---|---|---|
| Code coverage | Code coverage metrics | 🟢 95 | 🟢 95 | |
| JSDocs coverage | Documentation coverage | 🟡 61 | 🟡 61 |
13 other groups are unchanged.
🛡️ Audits
| 🔌 Plugin | 🛡️ Audit | 📏 Previous value | 📏 Current value | 🔄 Value change |
|---|---|---|---|---|
| Code coverage | Branch coverage | 🟩 91.9 % | 🟩 91.9 % |
443 other audits are unchanged.
13 other projects are unchanged.
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 <cursoragent@cursor.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
This repository uses local Nx plugins and async generators written in TypeScript that need to:
Without proper TypeScript execution setup, Nx commands fail when trying to execute these local plugins/generators.
Solution
Explicit environment variable configuration for both local development and CI:
.env.local(gitignored).env.local.exampleto.env.local.env.localfilesNODE_OPTIONS=--import tsx- Enables TypeScript executionTSX_TSCONFIG_PATH=tsconfig.base.json- Resolves path aliasesBackground
Why SWC is skipped when running Nx with
NODE_OPTIONS="--import tsx"Nx has hardcoded transpiler-selection logic for local TS/TSX execution (plugins, executors, generators).
When running with a Node loader like
tsx, Nx does not register SWC, even if SWC is available.Relevant source:
https://github.com/nrwl/nx/blob/81c157d0631927b3d1891453aa45652f3b5a7988/packages/nx/src/plugins/js/utils/register.ts
Key logic:
If
getTranspiler(...)returnsundefined, Nx intentionally does not register SWC or ts-node.getTranspiler(...)only detects:@swc-node/registerts-nodeNode loaders like
tsxare not detected, so:getTranspiler(...) === undefinedregisterTranspilerbecomes a no-opThis is not in
@nx/js:swc, but in Nx’s runtime TS/TSX plugin execution pipeline.Running with
NODE_OPTIONS="--import tsx"therefore bypasses SWC via hardcoded logic.Related: