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

Babel-cli: allow to install globally, with ability to invoke local babel #5091

Closed
7 tasks
Strate opened this issue Jan 11, 2017 · 9 comments
Closed
7 tasks
Labels
claimed good first issue Has PR i: enhancement outdated A closed issue/PR that is archived due to age. Recommended to make a new issue PR: New Feature 🚀 A type of pull request used for our changelog categories

Comments

@Strate
Copy link

Strate commented Jan 11, 2017

As many nodejs-related tools, it would be good to allow global babel-cli installation, which will invoke local (related to process.cwd()) babel installation.

EDIT by @hzoo

@babel-bot
Copy link
Collaborator

Hey @Strate! We really appreciate you taking the time to report an issue. The collaborators
on this project attempt to help as many people as possible, but we're a limited number of volunteers,
so it's possible this won't be addressed swiftly.

If you need any help, or just have general Babel or JavaScript questions, we have a vibrant Slack
community that typically always has someone willing to help. You can sign-up here
for an invite.

@sindresorhus
Copy link
Member

👍 Feel free to borrow our implementation of this in @avajs: https://github.com/avajs/ava/blob/ad5122d507bfaa044fc3a2e51e467238e16dba11/cli.js#L7-L16

@varemenos
Copy link
Contributor

I'd like to work on this

@varemenos
Copy link
Contributor

varemenos commented Jan 29, 2017

I've got a couple of questions about this feature's implementation.

  1. Should we inform the user every time they invoke a local copy of babel? (Will they get confused if we don't? Will they get annoyed if we do this every single time?)

  2. Should the babel-cli try to resolve the ./node_modules/babel-core based only on the cwd or should it try to find the closest parent's directory that contains a package.json based on the cwd and then try to resolve the path ./node_modules/babel-core?

Before merging: We should update this part of the documentation website

Note: Since it's generally a bad idea to run Babel globally you may want to uninstall the global copy by running npm uninstall --global babel-cli.

https://github.com/babel/babel.github.io/blob/27a5d2c894af56ad49e8504b6ada2d1739fba829/_includes/tools/babel_cli/install.md

@sindresorhus
Copy link
Member

Should the babel-cli try to resolve the ./node_modules/babel-core based on the cwd only or should it try to find the closest package.json based on the cwd and then try to resolve the path ./node_modules/babel-core?

Should walk up. That's how require works and would IMHO be the expected behavior.

@loganfsmyth
Copy link
Member

Is the proposal here that this call a local babel-core or a local babel-cli? I don't think I'd want it to have any knowledge of babel-core at all, since then we're way more likely to run into versioning mismatches, whereas if it proxies through to a local babel-cli things will likely work alright.

Should we inform the user every time they invoke a local copy of babel?

I'd be in favor of printing a message, we'll just have to make sure that we disable the message when Babel is set up to output transpiled output to stdout or else the message would corrupt the output JS.

@sindresorhus
Copy link
Member

Call the local babel-cli.

@varemenos
Copy link
Contributor

varemenos commented Feb 4, 2017

Sorry for the delay with this issue, I've had some personal issue the past few days.
Yep, as it seems, I've misunderstood the purpose of the issue. Ok so, I'll replace the invocation of babel-core to babel-cli and add log a message when babel's is not set up to output transpiled output to stdout.

Are there any conflicts between this issue and #5258?

@loganfsmyth
Copy link
Member

I don't think there are any conflicts, I wouldn't worry about it.

@lock lock bot added the outdated A closed issue/PR that is archived due to age. Recommended to make a new issue label May 4, 2018
@lock lock bot locked as resolved and limited conversation to collaborators May 4, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
claimed good first issue Has PR i: enhancement outdated A closed issue/PR that is archived due to age. Recommended to make a new issue PR: New Feature 🚀 A type of pull request used for our changelog categories
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants