Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

dragonwize
Copy link
Contributor

The Issue

  • npx is not an existing ddev command.
  • npx is an alias of npm exec -- that comes with the npm package, so no new code is needed.
  • npx is used to run JS code without installing it, which is often for setup, init, demos, config, and other one time executions.

How This PR Solves The Issue

This allows users to ddev npx in the same way they can do ddev npm without having to do ddev exec npx.

Manual Testing Instructions

  1. ddev config
  2. ddev start
  3. ddev npx -c 'echo hello' will say hello. Or any npx command like ddev npx @biomejs/biome init which will setup biomejs config in your project.

Automated Testing Overview

  • The change is minor in the way that this is an alias of another command, npm, that already has a test, so if the npm test passes this should as well.
  • There is also the consideration of how to make it not be flaky since it largely involves external network resources.

Because of those points, I decided to just check the simple local command execution part of npx via the -c flag. The test does a simple echo hello and checks if hello is returned. In combination with the above npm test, I think that should be sufficient without adding any network request to the system.

Release/Deployment Notes

Does this affect anything else or have ramifications for other code? Does anything have to be done on deployment?

Nope

@dragonwize dragonwize requested a review from a team as a code owner September 7, 2025 20:03
Copy link

github-actions bot commented Sep 7, 2025

Copy link
Member

@stasadev stasadev left a comment

Choose a reason for hiding this comment

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

@stasadev stasadev force-pushed the 20250908_dragonwize_add_npx_command branch from f50250f to 456c56c Compare September 12, 2025 17:08
@stasadev stasadev requested a review from a team as a code owner September 12, 2025 17:08
@stasadev stasadev changed the title feat: Add npx command feat: add ddev npx command Sep 12, 2025
Copy link
Member

@stasadev stasadev left a comment

Choose a reason for hiding this comment

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

Rebased and updated docs.

@dragonwize
Copy link
Contributor Author

@stasadev Thanks for the hand. Sorry, I wasn't able to get to it right away. I was busy and was planning to address it on the weekend. Let me know if there is more to do.

@rfay rfay merged commit f9cd19c into ddev:main Sep 14, 2025
24 checks passed
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.

3 participants