Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/autosseyai/autobin

Prepare bin scripts for publishing.
https://github.com/autosseyai/autobin

auto bin binary build node npm package typescript

Last synced: about 1 month ago
JSON representation

Prepare bin scripts for publishing.

Awesome Lists containing this project

README

        


autobin



npm


typescript


Prepare bin scripts for publishing.

_If you find this repo useful, stars are appreciated ⭐️_

GitHub stars

_DM me on [Twitter](https://twitter.com/bconnorwhite) if you have questions or suggestions._

Twitter Follow

---

## About

### Hashbang

Bin scripts require a hashbang to run properly:
```js
#!/usr/bin/env node
```

However, if you're using TypeScript, you'll need to compile to JavaScript before publishing.

This package searches for each file in the `bin` field of your `package.json`, and prepends the Node shebang to the file if it doesn't already have one.

### Executable Bits

Additionally, autobin sets the executable bits on the file. Although this is not required as package managers set the executable bits when installing, it allows you to run the script directly before publishing.

## Installation

```sh
yarn add --dev autobin
```

```sh
npm install --save-dev autobin
```

```sh
pnpm add --save-dev autobin
```

## Usage

### Package Scripts

In your `package.json` file:

```json
{
"scripts": {
"postbuild": "autobin"
}
}
```

> The "postbuild" script automatically runs after the "build" script is run.

### Command Line

Alternatively, you can run `autobin` directly from the command line:

```sh
yarn autobin
```

```sh
npm run autobin
```

```sh
pnpm run autobin
```


---



Have fun! 🎉


---


Dependenciesdependencies

- [@bconnorwhite/package](https://www.npmjs.com/package/@bconnorwhite/package): A utility for reading package.json of a project, and forming paths relative to it.
- [clee](https://www.npmjs.com/package/clee): Create CLI applications with glee 🎉
- [make-executable](https://www.npmjs.com/package/make-executable): Set the executable bits on a file
- [read-file-safe](https://www.npmjs.com/package/read-file-safe): Read files without try catch
- [write-file-safe](https://www.npmjs.com/package/write-file-safe): Write files atomically and create parent directories if necessary

Dev Dependencies

- [@autossey/eslint-config](https://www.npmjs.com/package/@autossey/eslint-config): A base for projects that use ESLint.
- [@autossey/tsconfig](https://www.npmjs.com/package/@autossey/tsconfig): A collection of base TSConfigs for various types of projects.
- [npm-package-json-lint-config-auto](https://www.npmjs.com/package/npm-package-json-lint-config-auto): NPM Package.json Lint Config


License license

[MIT](https://opensource.org/licenses/MIT) - _The MIT License_


See Also

- [autorepo](https://www.npmjs.com/package/autorepo): Autorepo abstracts away your dev dependencies, providing a single command to run all of your scripts.