Skip to content
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

feat: add npx conversions #53

Closed
wants to merge 14 commits into from

Conversation

Jay-Karia
Copy link
Contributor

@Jay-Karia Jay-Karia commented Aug 3, 2024

This PR adds a new type of conversions (for npx).

The command npx create-next-app is converted into:
yarn dlx create-next-app (yarn)
pnpm dlx create-next-app (pnpm)
bun x create-next-app (bun)

Automatically detects executor commands and converts it

Here's a code example.

convert("npx create-next-app", "yarn");
// yarn dlx create-next-app

Closes #48

@Jay-Karia
Copy link
Contributor Author

@nebrelbug should I add tests before merging ?

@nebrelbug
Copy link
Owner

@Jay-Karia Yeah tests would be great, thanks

@nebrelbug
Copy link
Owner

@slorber, I'd love to hear your thoughts about this proposal since Docusaurus is one of the main users of npm-to-yarn.

@Jay-Karia
Copy link
Contributor Author

@slorber
Copy link
Collaborator

slorber commented Aug 13, 2024

Yes that looks like a useful feature to add that we could use on the Docusaurus website

@nebrelbug
Copy link
Owner

@Jay-Karia I think for ease of use, it should detect whether or not it is an executor command (test for npx|pnpm dlx|...) automatically rather than requiring an extra argument flag.

Instead of giving additional parameter for npx conversions, now it automatically detects for this type of conversion
Now `yarn dlx`, `pnpm dlx` and `bun x` commands can be converted internally.
Previously it was only `npx`
@Jay-Karia
Copy link
Contributor Author

@nebrelbug Should we consider updating the version to: 2.3.0 or 3.0.0 after this feature?

added to new tests and updated the existing tests for `npx` conversions.
Removed extra argument in API usage as it now auto detects npx conversions
@Jay-Karia
Copy link
Contributor Author

@nebrelbug Removed extra argument

@Jay-Karia Jay-Karia mentioned this pull request Aug 24, 2024
@lishaduck

This comment was marked as outdated.

@Jay-Karia
Copy link
Contributor Author

bunx has bugs in windows.
pnpmx does not exists, it's either pnpm exec or pnpm dlx. Same goes with yarn

@lishaduck

This comment was marked as resolved.

@nebrelbug
Copy link
Owner

@Jay-Karia thanks for the great work! I think we should probably update to a major version. Do you think this is ready to merge?

@Jay-Karia
Copy link
Contributor Author

Yes

@nebrelbug
Copy link
Owner

I just merged this (with the CLI, not through the web client) and released in https://github.com/nebrelbug/npm-to-yarn/releases/tag/v3.0.0! Thanks for your help!

@nebrelbug nebrelbug closed this Aug 29, 2024
@Jay-Karia Jay-Karia deleted the feat/npx-conversions branch August 29, 2024 10:16
@slorber
Copy link
Collaborator

slorber commented Aug 29, 2024

Note: that's a bit unfortunate but it looks like yarn dlx is not supported by Yarn 1

For this reason the limits the adoption of this feature. I don't think it's a good idea to use it on the Docusaurus website because many users use Yarn 1 (including ourselves)

@Jay-Karia
Copy link
Contributor Author

is yarn exec supported in Yarn 1 ?

@slorber
Copy link
Collaborator

slorber commented Aug 29, 2024

I don't see it listed here: https://classic.yarnpkg.com/en/docs/cli/

However yarn exec echo "Hello" works but it doesn't seem to be a decent alternative to npx

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature request: add npx conversions
4 participants