Skip to content

Commit

Permalink
checks if babel is installed globally and displays correct cli messag…
Browse files Browse the repository at this point in the history
…e - fixes babel#5228
  • Loading branch information
xtina-starr committed Feb 2, 2017
1 parent 283d9cb commit 0ee810c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
7 changes: 5 additions & 2 deletions packages/babel/cli.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
#!/usr/bin/env node
import isGlobal from "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\n" +
" npm install" + globalMessage + " 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
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,8 @@
"babel": "./cli.js",
"babel-node": "./cli.js",
"babel-external-helpers": "./cli.js"
},
"dependencies": {
"is-global": "^0.1.0"
}
}

0 comments on commit 0ee810c

Please sign in to comment.