checks if babel is installed globally and displays correct cli message (#5258)
* checks if babel is installed globally and displays correct cli message - fixes #5228 * recommend local installation and fix lint errors * uses babel-cli vs babel * switch back to babel * use process.cwd() to determine if globally executed * checks for /node_module/.bin/babel * compare execPath and module execution path to determine global or local installation * Move the babel/cli.js into a 'src' so the 'const's are compiled Node < 6.
This commit is contained in:
parent
e9d7757433
commit
6ee7bf6df5
@ -7,8 +7,8 @@
|
|||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"repository": "https://github.com/babel/babel/tree/master/packages/babel",
|
"repository": "https://github.com/babel/babel/tree/master/packages/babel",
|
||||||
"bin": {
|
"bin": {
|
||||||
"babel": "./cli.js",
|
"babel": "./lib/cli.js",
|
||||||
"babel-node": "./cli.js",
|
"babel-node": "./lib/cli.js",
|
||||||
"babel-external-helpers": "./cli.js"
|
"babel-external-helpers": "./lib/cli.js"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,10 +1,13 @@
|
|||||||
#!/usr/bin/env node
|
#!/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" +
|
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" +
|
"Babel's CLI commands have been moved from the `babel` package to the `babel-cli` package.\n" +
|
||||||
"\n" +
|
"\n" +
|
||||||
" npm uninstall babel\n" +
|
" npm uninstall" + globalMessage + " babel\n" +
|
||||||
" npm install babel-cli\n" +
|
" npm install --save-dev babel-cli\n" +
|
||||||
"\n" +
|
"\n" +
|
||||||
"See http://babeljs.io/docs/usage/cli/ for setup instructions.");
|
"See http://babeljs.io/docs/usage/cli/ for setup instructions.");
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
Loading…
x
Reference in New Issue
Block a user