Skip to content

fix: add bin wrapper and resolve Nx project discovery#1270

Merged
hanna-skryl merged 3 commits intomainfrom
create-cli-bin-and-nx-resolution
Mar 17, 2026
Merged

fix: add bin wrapper and resolve Nx project discovery#1270
hanna-skryl merged 3 commits intomainfrom
create-cli-bin-and-nx-resolution

Conversation

@hanna-skryl
Copy link
Collaborator

@hanna-skryl hanna-skryl commented Mar 17, 2026

npm init @code-pushup/cli fails in external repositories. The binary entry point broke after the esbuild-to-tsc migration because the bin field was never updated. Separately, in Nx workspaces, the wizard crashes because npx runs the package in an isolated sandbox where @nx/devkit isn't installed.

  • Simplify bin entry point from bin/index.js to bin.js in both cli and create-cli
  • Move bin asset to targetDefaults so it's copied to dist/ for all packages
  • Resolve @nx/devkit from the target workspace using createRequire
  • Add optional chaining for project.json files without a targets field

Manually verified against an external Nx workspace.

@nx-cloud
Copy link

nx-cloud bot commented Mar 17, 2026

View your CI Pipeline Execution ↗ for commit c88e7ae

Command Status Duration Result
nx affected -t int-test --parallel=3 ✅ Succeeded 54s View ↗

☁️ Nx Cloud last updated this comment at 2026-03-17 18:09:21 UTC

@pkg-pr-new
Copy link

pkg-pr-new bot commented Mar 17, 2026

Open in StackBlitz

@code-pushup/ci

npm i https://pkg.pr.new/code-pushup/cli/@code-pushup/ci@1270

@code-pushup/cli

npm i https://pkg.pr.new/code-pushup/cli/@code-pushup/cli@1270

@code-pushup/create-cli

npm i https://pkg.pr.new/code-pushup/cli/@code-pushup/create-cli@1270

@code-pushup/models

npm i https://pkg.pr.new/code-pushup/cli/@code-pushup/models@1270

@code-pushup/core

npm i https://pkg.pr.new/code-pushup/cli/@code-pushup/core@1270

@code-pushup/nx-plugin

npm i https://pkg.pr.new/code-pushup/cli/@code-pushup/nx-plugin@1270

@code-pushup/axe-plugin

npm i https://pkg.pr.new/code-pushup/cli/@code-pushup/axe-plugin@1270

@code-pushup/coverage-plugin

npm i https://pkg.pr.new/code-pushup/cli/@code-pushup/coverage-plugin@1270

@code-pushup/eslint-plugin

npm i https://pkg.pr.new/code-pushup/cli/@code-pushup/eslint-plugin@1270

@code-pushup/js-packages-plugin

npm i https://pkg.pr.new/code-pushup/cli/@code-pushup/js-packages-plugin@1270

@code-pushup/jsdocs-plugin

npm i https://pkg.pr.new/code-pushup/cli/@code-pushup/jsdocs-plugin@1270

@code-pushup/lighthouse-plugin

npm i https://pkg.pr.new/code-pushup/cli/@code-pushup/lighthouse-plugin@1270

@code-pushup/typescript-plugin

npm i https://pkg.pr.new/code-pushup/cli/@code-pushup/typescript-plugin@1270

@code-pushup/utils

npm i https://pkg.pr.new/code-pushup/cli/@code-pushup/utils@1270

commit: c88e7ae

@github-actions
Copy link
Contributor

github-actions bot commented Mar 17, 2026

Code PushUp

😟 Code PushUp report has regressed – compared current commit cf22b92 with previous commit 9a288ee.

🕵️ See full comparison in Code PushUp portal 🔍

🏷️ Categories

🏷️ Category ⭐ Previous score ⭐ Current score 🔄 Score change
Performance 🔴 36 🔴 34 ↓ −1.3
Code coverage 🟢 92 🟢 92 ↓ −0.1
Documentation 🟡 52 🟡 52 ↓ −0.1
Bug prevention 🟡 75 🟡 75 ↓ −0.1
Axe Accessibility 🟡 88 🟡 88 ↓ −0.1
Code style 🟢 100 🟢 100
Security 🔴 0 🔴 0
Updates 🟡 72 🟡 72
Type Safety 🟡 67 🟡 67
Miscellaneous 🟡 67 🟡 67
Accessibility 🟢 92 🟢 92
Best Practices 🟢 100 🟢 100
SEO 🟢 92 🟢 92
👎 3 groups regressed, 👎 7 audits regressed, 15 audits changed without impacting score

🗃️ Groups

🔌 Plugin 🗃️ Group ⭐ Previous score ⭐ Current score 🔄 Score change
Lighthouse Performance 🔴 36 🔴 34 ↓ −1.3
Code coverage Code coverage metrics 🟢 92 🟢 92 ↓ −0.1
JSDocs coverage Documentation coverage 🟡 52 🟡 52 ↓ −0.1

31 other groups are unchanged.

🛡️ Audits

🔌 Plugin 🛡️ Audit 📏 Previous value 📏 Current value 🔄 Value change
Lighthouse Speed Index 🟥 5.9 s 🟥 6.6 s ↑ +11.1 %
Lighthouse First Contentful Paint 🟥 3.1 s 🟥 3.2 s ↑ +3.3 %
Lighthouse Time to Interactive 🟥 13.8 s 🟥 14.5 s ↑ +4.7 %
Code coverage Line coverage 🟩 92.6 % 🟩 92.5 % ↓ −0.2 %
Code coverage Function coverage 🟩 94.1 % 🟩 94 % ↓ −0.1 %
JSDocs coverage Functions coverage 🟥 632 undocumented functions 🟥 633 undocumented functions ↑ +0.2 %
Code coverage Branch coverage 🟨 89.2 % 🟨 89.1 % ↓ −0.1 %
Lighthouse Avoids enormous network payloads 🟩 Total size was 2,406 KiB 🟩 Total size was 2,414 KiB ↑ +0.3 %
Lighthouse Minimizes main-thread work 🟥 10.5 s 🟥 13.0 s ↑ +24.5 %
Lighthouse Server Backend Latencies 🟩 1,770 ms 🟩 250 ms ↓ −86.1 %
Lighthouse Metrics 🟩 100% 🟩 100% ↑ +4.7 %
Lighthouse Max Potential First Input Delay 🟥 840 ms 🟥 1,370 ms ↑ +63.9 %
Lighthouse Largest Contentful Paint 🟥 11.3 s 🟥 10.9 s ↓ −4 %
Lighthouse Uses efficient cache policy on static assets 🟨 31 resources found 🟨 31 resources found ↓ −0.1 %
Lighthouse Reduce unused CSS 🟥 Potential savings of 111 KiB 🟥 Potential savings of 111 KiB ↓ −24.2 %
Lighthouse Total Blocking Time 🟥 2,540 ms 🟥 2,660 ms ↑ +4.9 %
Lighthouse Initial server response time was short 🟩 Root document took 560 ms 🟩 Root document took 470 ms ↓ −16.9 %
Lighthouse JavaScript execution time 🟥 4.0 s 🟥 4.0 s ↓ −0.8 %
Lighthouse Network Round Trip Times 🟩 10 ms 🟩 10 ms ↑ +89.5 %
Lighthouse Avoids an excessive DOM size 🟥 2,341 elements 🟥 2,345 elements ↑ +0.2 %
Axe ARIA hidden element must not be focusable or contain focusable elements 🟩 194 elements 🟩 195 elements ↑ +0.5 %
Lighthouse Cumulative Layout Shift 🟩 0.001 🟩 0 ↓ −100 %

656 other audits are unchanged.

@github-actions
Copy link
Contributor

github-actions bot commented Mar 17, 2026

Code PushUp

😟 Code PushUp report has regressed – compared current commit cf22b92 with previous commit 9a288ee.

💼 Project create-cli

😟 Code PushUp report has regressed.

🕵️ See full comparison in Code PushUp portal 🔍

🏷️ Category ⭐ Previous score ⭐ Current score 🔄 Score change
Code coverage 🟢 91 🟢 90 ↓ −1.2
Documentation 🔴 23 🔴 23 ↓ −0.1

4 other categories are unchanged.

👎 2 groups regressed, 👎 4 audits regressed

🗃️ Groups

🔌 Plugin 🗃️ Group ⭐ Previous score ⭐ Current score 🔄 Score change
Code coverage Code coverage metrics 🟢 91 🟢 90 ↓ −1.2
JSDocs coverage Documentation coverage 🔴 23 🔴 23 ↓ −0.1

13 other groups are unchanged.

🛡️ Audits

🔌 Plugin 🛡️ Audit 📏 Previous value 📏 Current value 🔄 Value change
Code coverage Line coverage 🟩 94.3 % 🟩 91.5 % ↓ −3 %
Code coverage Function coverage 🟩 91.2 % 🟨 89.9 % ↓ −1.4 %
Code coverage Branch coverage 🟩 91.1 % 🟩 90.8 % ↓ −0.3 %
JSDocs coverage Functions coverage 🟥 50 undocumented functions 🟥 51 undocumented functions ↑ +2 %

439 other audits are unchanged.

💼 Project cli

😟 Code PushUp report has regressed.

🕵️ See full comparison in Code PushUp portal 🔍

🏷️ Category ⭐ Previous score ⭐ Current score 🔄 Score change
Code coverage 🟢 94 🟢 94 ↓ −0.1

5 other categories are unchanged.

👎 1 group regressed, 👎 2 audits regressed

🗃️ Groups

🔌 Plugin 🗃️ Group ⭐ Previous score ⭐ Current score 🔄 Score change
Code coverage Code coverage metrics 🟢 94 🟢 94 ↓ −0.1

14 other groups are unchanged.

🛡️ Audits

🔌 Plugin 🛡️ Audit 📏 Previous value 📏 Current value 🔄 Value change
Code coverage Line coverage 🟩 94.5 % 🟩 93.9 % ↓ −0.7 %
Code coverage Branch coverage 🟨 87.3 % 🟨 87 % ↓ −0.3 %

442 other audits are unchanged.


12 other projects are unchanged.

@hanna-skryl hanna-skryl marked this pull request as ready for review March 17, 2026 16:39
@hanna-skryl hanna-skryl requested a review from matejchalk March 17, 2026 16:39
Copy link
Collaborator

@matejchalk matejchalk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fix. 👍

@hanna-skryl hanna-skryl changed the title fix(create-cli): add bin wrapper and fix Nx project discovery fix: add bin wrapper and resolve Nx project discovery Mar 17, 2026
@hanna-skryl hanna-skryl merged commit 771ecb2 into main Mar 17, 2026
37 of 38 checks passed
@hanna-skryl hanna-skryl deleted the create-cli-bin-and-nx-resolution branch March 17, 2026 18:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants