-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
yarn equivalent of npx ? #3937
Comments
For what it's worth, I think npx was inspired by "yarn create" which is similar but only works for packages prefixed with "create-". Not sure what the plans are here. |
Yup, we currently have |
I'm working on library-ifying npx. It's not a huge task to grab the existing npx code and just replace the npm-related guts with the yarn-equivalent commands. I won't add that directly to npx itself, since it's meant to be agnostic: npx performs no operations which clash with people using other package managers. It doesn't even require npm to be on the system, so you can (in re inspiration: npx is primarily inspired by this long-standing feature request: npm/npm#6053. Most of its functionality centers around fulfilling this need. The auto-install feature was added post-yarn-create, and is definitely intended to be an actual generalized solution to that particular thing -- but it does way more than that) |
@sandys - The issue @zkat referenced (npm/npm#6053) is not an issue on If you think there's a strong need, can you explain why you need it? Eg. what problem will it solve for you? |
Does anyone know if |
FWIW, npm-run is an older utility that allows one to run local |
@BYK Use case is running e.g. |
@SimenB CI usually wouldn't commit the project back to version control though, so it doesn't matter if it adds the dependencies in the process, right? |
@MarkBennett Since |
@BYK I am not the OP, but I came to this feature request because I had a package on my local machine but not in my package.json. Therefore my app would run for me, but not for anyone who did a clean install of my app. This is a feature of ruby bundler's |
My main complain about Let's say I have a tool with binary named
|
something like gist #!/usr/bin/env bash
package_name=$1
temp_dir="/tmp/ypx/$package_name/$(date +%s%N)"
mkdir -p $temp_dir
(cd $temp_dir; yarn add $package_name) && (PATH="$temp_dir/node_modules/.bin":$PATH; "$@")
rm -rf $temp_dir |
@BYK another use case is running a binary of a package that is not installed locally yet and i want to run it one time, without bothering to delete it on my own after.
this is done transparently to the user. a hypothetic
|
@BYK It does not work. |
@BYK as far as i know npx will look for your command on |
Can we get a |
@light24bulbs why in particular? Frankly I think Ideally, I would prefer |
@arcanis npx itself is comboed with npm because it's bundled with npm -- |
Just googled this issue and I think it's appropriate place to ask about any updates. Is there any existent tool/solution, or plan to add some functionality to yarn?
Both of this issues looks like perfect match to solve for yarn like @phra already mention as his third point. UPD: So basically main reason for |
I agree. I also think there is an opportunity to improve on NPMs weird API
a bit. I think calling `yarn exec COMMAND` would make more sense than
`yarnx`. Ruby bundler had a very similar command
https://bundler.io/man/bundle-exec.1.html
…On Mon, Dec 17, 2018 at 2:29 PM Pavel Prokudin ***@***.***> wrote:
Just googled this issue and I think it's appropriate place to ask about
any updates. Is there any existent tool/solution, or plan to add some
functionality to yarn?
For example my current issues with npx are:
1. it downloads absent package with dependencies every time,
2. it creates package-lock.json in Yarn oriented projects which causes
warnings and need to remove it by hands.
(specifically I just execute npx gatsby new blog
https://github.com/gatsbyjs/gatsby-starter-blog)
Both of this issues looks like perfect match to solve for yarn like @phra
<https://github.com/phra> already mention as his third point.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#3937 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAjhEng6juvpaK4xLx1KrVHccJAytnAfks5u5_CcgaJpZM4OY9aL>
.
--
-Forrest
|
|
Does the new |
Yep! Closing this issue for now, I haven't figured out yet whether we'll want to backport the feature to the v1 (probably not?). |
I'm not sure it's a worthy replacement. Also, I think stdout/stderr should not be written to by yarn unless there is an error, to allow parsing the script's output. |
@silverwind the timing difference seems quite stark. Is this reproducible in multiple runs consistently? If yes, I'd file a new issue for investigation as we surely don't want it to be slow. Regarding stdout/stderr from Yarn, I think you can use |
For all people who find some package on the web, see that installation instructions involve |
Is |
try this |
yarn create & npx & npm init
https://www.npmjs.com/package/create-react-app $ yarn create react-app
$ npx create-react-app
$ npm init react-app
|
@light24bulbs - to echo @rulatir, I got here because Storybook's quick start guide says to use |
I'm also on the same boat as @codekiln. Whenever I'm following some instructions that say run |
Same here, with capacitorjs installation guide https://capacitorjs.com/docs/getting-started, the feeling is that this persuades the user to abandon yarn and go back to npm |
404: Page Not Found |
I guess @delanym meant this page (but I don't think this replicates |
For anyone reading this trying to find a quick alternative to
|
So once you want to use |
If anyone else is wondering: you can use |
If you use |
nobody care about this? |
One command: |
how is yarn recommending we use npx (that is now core part of npm - npm/npm#17685).
Basically, it acts somewhat like ruby's "bundle exec", other than that it launches the package manager if dependencies are missing. This will sidestep yarn and switch back to npm.
Is there a plan to create a "ypx" equivalent that leverages yarn to do this ?
The text was updated successfully, but these errors were encountered: