Replace or prepend shebang.
Useful to write #!/usr/bin/env ./node_modules/.bin/babel-node
modules in development env, and compile to #!/usr/bin/env node
in production env.
$ npm install babel-plugin-shebang
.babelrc
{
"plugins": ["shebang"]
}
input
#!/usr/bin/env ./node_modules/.bin/babel-node
console.log("awesome");
output
#!/usr/bin/env node
console.log("awesome");
.babelrc
{
"plugins": [
[
"shebang",
{
"replacement": "#!/usr/bin/env node",
"force": false
}
]
]
}
replacement
(String): Defaults to#!/usr/bin/env node
force
(Boolean): Force prepend shebang. Defaults tofalse
$ babel --plugins shebang script.js
require("babel-core").transform("code", {
plugins: ["shebang"]
});
MIT