0.0.2 • Published 9 months ago

only-branch v0.0.2

Weekly downloads
-
License
MIT
Repository
-
Last release
9 months ago

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"
  }
}
0.0.2

9 months ago

0.0.1

12 months ago