chore: use tsx when execution nx to have local plugins working#1242
chore: use tsx when execution nx to have local plugins working#1242
Conversation
|
View your CI Pipeline Execution ↗ for commit 1016633
☁️ 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/nx-plugin
@code-pushup/axe-plugin
@code-pushup/coverage-plugin
@code-pushup/js-packages-plugin
@code-pushup/jsdocs-plugin
@code-pushup/lighthouse-plugin
@code-pushup/typescript-plugin
@code-pushup/utils
@code-pushup/eslint-plugin
commit: |
Code PushUp🤨 Code PushUp report has both improvements and regressions – compared current commit 14f02ae with previous commit 3137af7. 🕵️ See full comparison in Code PushUp portal 🔍 🏷️ Categories👍 1 group improved, 👎 1 group regressed, 👍 3 audits improved, 👎 1 audit regressed, 14 audits changed without impacting score🗃️ Groups
32 other groups are unchanged. 🛡️ Audits
661 other audits are unchanged. |
Code PushUp🥳 Code PushUp report has improved – compared current commit 14f02ae with previous commit 3137af7. 💼 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.
💼 Project plugin-lighthouse
🤨 Code PushUp report has both improvements and regressions.
🕵️ See full comparison in Code PushUp portal 🔍
All of 6 categories are unchanged.
1 audit changed without impacting score
🗃️ Groups
All of 15 groups are unchanged.
🛡️ Audits
| 🔌 Plugin | 🛡️ Audit | 📏 Previous value | 📏 Current value | 🔄 Value change |
|---|---|---|---|---|
| Code coverage | Branch coverage | 🟩 98.8 % | 🟩 98.8 % |
443 other audits are unchanged.
12 other projects are unchanged.
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.localfilesBackground
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:
Closes #1238