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

checks if babel is installed globally and displays correct cli message #5258

Merged
merged 8 commits into from Feb 6, 2017
7 changes: 5 additions & 2 deletions packages/babel/cli.js
@@ -1,10 +1,13 @@
#!/usr/bin/env node
const isGlobal = require("is-global");

const globalMessage = isGlobal() ? " -g" : "";

console.error("You have mistakenly installed the `babel` package, which is a no-op in Babel 6.\n" +
"Babel's CLI commands have been moved from the `babel` package to the `babel-cli` package.\n" +
"\n" +
" npm uninstall babel\n" +
" npm install babel-cli\n" +
" npm uninstall" + globalMessage + " babel-cli\n" +
Copy link
Member

Choose a reason for hiding this comment

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

I think there was a miscommunication, having this be babel and not babel-cli is on purpose, because babel is the package that contains the script that prints this warning, and we want to tell people to remove it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah, I see. Other than changing babel-cli back to babel is there any other feedback for this PR? Also is it okay just to add another commit to make this change or do you prefer I rebase to keep the commit history clean?

Copy link
Member

Choose a reason for hiding this comment

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

For PRs with a few work-in-progress commits like this, we'll probably github's squash-and-merge behavior, so you are free to push another commit and it'll all get squashed in the end.

I don't have any other comments, looks solid :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sweet, thx!

" npm install --save-dev babel-cli\n" +
"\n" +
"See http://babeljs.io/docs/usage/cli/ for setup instructions.");
process.exit(1);
3 changes: 3 additions & 0 deletions packages/babel/package.json
Expand Up @@ -10,5 +10,8 @@
"babel": "./cli.js",
"babel-node": "./cli.js",
"babel-external-helpers": "./cli.js"
},
"dependencies": {
"is-global": "^0.1.0"
}
}