-
Notifications
You must be signed in to change notification settings - Fork 14
chore: use tsx when execution nx to have local plugins working #1242
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
View your CI Pipeline Execution ↗ for commit d73b906
☁️ Nx Cloud last updated this comment at |
@code-pushup/ci
@code-pushup/cli
@code-pushup/core
@code-pushup/create-cli
@code-pushup/nx-plugin
@code-pushup/axe-plugin
@code-pushup/models
@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: |
Code PushUp🤨 Code PushUp report has both improvements and regressions – compared current commit 6e8a766 with previous commit 3137af7. 🕵️ See full comparison in Code PushUp portal 🔍 🏷️ Categories👎 2 groups regressed, 👍 3 audits improved, 👎 6 audits regressed, 21 audits changed without impacting score🗃️ Groups
32 other groups are unchanged. 🛡️ Audits
649 other audits are unchanged. |
Code PushUp🤨 Code PushUp report has both improvements and regressions – compared current commit 6e8a766 with previous commit 3137af7. 💼 Project
|
| 🏷️ Category | ⭐ Previous score | ⭐ Current score | 🔄 Score change |
|---|---|---|---|
| Code coverage | 🟢 91 | 🟢 92 |
5 other categories are unchanged.
👍 1 group improved, 👍 1 audit improved, 👎 2 audits regressed
🗃️ Groups
| 🔌 Plugin | 🗃️ Group | ⭐ Previous score | ⭐ Current score | 🔄 Score change |
|---|---|---|---|---|
| Code coverage | Code coverage metrics | 🟢 91 | 🟢 92 |
14 other groups are unchanged.
🛡️ Audits
| 🔌 Plugin | 🛡️ Audit | 📏 Previous value | 📏 Current value | 🔄 Value change |
|---|---|---|---|---|
| Code coverage | Branch coverage | 🟨 80.8 % | 🟨 81.7 % | |
| Code coverage | Line coverage | 🟩 93.2 % | 🟩 93 % | |
| Code coverage | Function coverage | 🟩 96.4 % | 🟩 96.3 % |
445 other audits are unchanged.
💼 Project utils
🥳 Code PushUp report has improved.
🕵️ See full comparison in Code PushUp portal 🔍
| 🏷️ 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.
11 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