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
6 changes: 3 additions & 3 deletions packages/babel/package.json
Expand Up @@ -7,8 +7,8 @@
"license": "MIT",
"repository": "https://github.com/babel/babel/tree/master/packages/babel",
"bin": {
"babel": "./cli.js",
"babel-node": "./cli.js",
"babel-external-helpers": "./cli.js"
"babel": "./lib/cli.js",
"babel-node": "./lib/cli.js",
"babel-external-helpers": "./lib/cli.js"
}
}
7 changes: 5 additions & 2 deletions packages/babel/cli.js → packages/babel/src/cli.js
@@ -1,10 +1,13 @@
#!/usr/bin/env node
import path from "path";

const globalMessage = path.dirname(process.execPath) === path.dirname(process.env._ || "") ? " -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\n" +
" npm install --save-dev babel-cli\n" +
"\n" +
"See http://babeljs.io/docs/usage/cli/ for setup instructions.");
process.exit(1);