prantlf/rollup-plugin-shebang-bin(新しいタブで開きます)
主要言語: JavaScript
Richly configurable rollup plugin for preserving or inserting shebang (hashbang) and making scripts executable.
- star 数
- 3
- watcher 数
- 1
- fork 数
- 1
- issue 数
- 2
- 最終更新
- 2024/12/11
主要言語: JavaScript
Richly configurable rollup plugin for preserving or inserting shebang (hashbang) and making scripts executable.
Richly configurable Rollup plugin for preserving or inserting shebang (hashbang) and making scripts executable.
This plugin requires Node.js 14 or newer and Rollup 2 or newer.
This module can be installed in your project using NPM, PNPM or Yarn. Make sure, that you use Node.js version 6 or newer.
npm i -D rollup-plugin-shebang-bin pnpm i -D rollup-plugin-shebang-bin yarn add rollup-plugin-shebang-bin
Create a rollup.config.js configuration file and import the plugin:
import shebang from 'rollup-plugin-shebang-bin' export default { input: 'src/cli.js', output: { dir: 'bin', format: 'cjs' }, plugins: [shebang()] }
Then call rollup either via the command-line or programmatically.
The file bin/cli.js will be executable with the following content:
#!/usr/bin/env node
... // content of src/cli.jsThe following options can be passed in an object to the plugin function to change the default values.
Type: Array<String>
Default: ['**/*.js']
Pattern to match files which will be processed by the plugin.
Type: Array<String>
Default: []
Pattern to match files which will be ignored by the plugin.
Type: RegExp
Default: /^\s*#!.*\n*/
The regular expression to match the shebang at the beginning of an input file.
Type: String
Default: '#!/usr/bin/env node'
The shebang to insert to the beginning of an output file.
Type: String
Default: '\n\n'
The whitespace to insert after the shebang to separate if from the rest of an output file.
Type: Number
Default: 0o755
The permissions to apply to an output file. The value will be masked by the process umask.
Type: Boolean
Default: true
If the shebang will be inserted to an output file.
Type: Boolean
Default: true
If an existing shebang will be preserved in an output file.
If you set preserve to false and insert to true, the existing shebang will be removed and a new one inserted to an output file.
Type: Boolean
Default: true
If an output file should become executable permissions.
Copyright (C) 2022-2024 Ferdinand Prantl
Licensed under the MIT License.