Skip to content

Cap32/babel-plugin-shebang

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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