only-branch

0.0.2 • Public • Published

Only Branch

Run (npm) scripts only on a certain branch

only-branch main && npm run deploy

Why

For larger projects, something like github actions can be defined to only run on a specific branch (or even tag). For smaller projects (think simple websites), where I usually deploy directly from my computer, I want the same protection against accidentally running npm run stage on the main branch or npm run deploy on the dev branch.

Usage Example

package.json

{
  "scripts": {
    "deploy": "only-branch main && your-deploy-script",
    "stage": "only-branch dev && your-stage-script"
  }
}

Package Sidebar

Install

npm i only-branch

Weekly Downloads

1

Version

0.0.2

License

MIT

Unpacked Size

2.7 kB

Total Files

3

Last publish

Collaborators

  • arnoson