Skip to content

fix(cli): ensure consistent spacing for npx of node 20+#5791

Merged
chenjiahan merged 1 commit intomainfrom
node_24_npx_0807
Aug 7, 2025
Merged

fix(cli): ensure consistent spacing for npx of node 20+#5791
chenjiahan merged 1 commit intomainfrom
node_24_npx_0807

Conversation

@chenjiahan
Copy link
Copy Markdown
Member

Summary

In Node.js >= 20, we can no longer use npm_execpath.includes('npx-cli.js') to identify npx.

This PR uses process.env.npm_lifecycle_event === 'npx' instead.

Before

Screenshot 2025-08-07 at 20 56 42

After

Screenshot 2025-08-07 at 20 55 53

Checklist

  • Tests updated (or not required).
  • Documentation updated (or not required).

Copilot AI review requested due to automatic review settings August 7, 2025 12:58
@netlify
Copy link
Copy Markdown

netlify bot commented Aug 7, 2025

Deploy Preview for rsbuild ready!

Name Link
🔨 Latest commit 545746b
🔍 Latest deploy log https://app.netlify.com/projects/rsbuild/deploys/6894a2f4a9db440008772d5c
😎 Deploy Preview https://deploy-preview-5791--rsbuild.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 71 (🟢 up 6 from production)
Accessibility: 97 (no change from production)
Best Practices: 100 (no change from production)
SEO: 100 (no change from production)
PWA: 60 (no change from production)
View the detailed breakdown and full score reports

To edit notification comments on pull requests, go to your Netlify project configuration.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes CLI spacing inconsistencies in Node.js 20+ by updating the npx detection logic. The previous method using npm_execpath.includes('npx-cli.js') no longer works in newer Node.js versions.

  • Updates npx detection to use process.env.npm_lifecycle_event === 'npx' instead of checking the execpath
  • Simplifies the spacing logic by adding a prefix to the greeting message rather than logging a separate blank line
  • Maintains consistent output formatting across different package managers

@chenjiahan chenjiahan merged commit 2214515 into main Aug 7, 2025
12 checks passed
@chenjiahan chenjiahan deleted the node_24_npx_0807 branch August 7, 2025 23:41
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