babel-plugin-shebang

1.0.0 • Public • Published

babel-plugin-shebang

Build Status CircleCI Coverage Status License

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.

Installation

$ npm install babel-plugin-shebang

Example

.babelrc

{
  "plugins": ["shebang"]
}

input

#!/usr/bin/env ./node_modules/.bin/babel-node
console.log("awesome");

output

#!/usr/bin/env node
console.log("awesome");

Usage

Via .babelrc (Recommended)

.babelrc

{
  "plugins": [
    [
      "shebang",
      {
        "replacement": "#!/usr/bin/env node",
        "force": false
      }
    ]
  ]
}

Options

  • replacement (String): Defaults to #!/usr/bin/env node
  • force (Boolean): Force prepend shebang. Defaults to false

Via CLI

$ babel --plugins shebang script.js

Via Node API

require("babel-core").transform("code", {
  plugins: ["shebang"]
});

License

MIT

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
1.0.016latest

Version History

VersionDownloads (Last 7 Days)Published
1.0.016
0.0.03

Package Sidebar

Install

npm i babel-plugin-shebang

Weekly Downloads

19

Version

1.0.0

License

MIT

Unpacked Size

4.13 kB

Total Files

4

Last publish

Collaborators

  • cap32