shebang-trim

1.2.0 • Public • Published

shebang-trim

version license build coverage code style

Replace ts-node-script and ts-node shebangs with node shebangs in compiled scripts.

{
  "scripts": {
    "build": "tsc",
    "postbuild": "shebang-trim dist/cli.js"
  }
}

Before:

#!/usr/bin/env ts-node-script
'use strict';
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
...
#!/usr/bin/env node
'use strict';
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
...

Background

When creating a TypeScript CLI it's helpful to use ts-node-script during development. In production, the CLI ships with compiled sources which are runnable using node. If the compiled source still depends on ts-node-script, it won't run unless ts-node is installed. tsc passes through the existing shebang line at compile-time. This script rewrites it.

Contribute

Pull requests welcome!

Support

If you are having issues, please let me know.

License

The project is licensed under the MIT license.

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.2.0
    25
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.2.0
    25
  • 1.1.0
    1
  • 1.0.0
    0
  • 0.1.0
    0

Package Sidebar

Install

npm i shebang-trim

Weekly Downloads

26

Version

1.2.0

License

MIT

Unpacked Size

6.26 kB

Total Files

5

Last publish

Collaborators

  • paulmelnikow