Skip to content

Commit a811dff

Browse files
authored
Added ability to run node script as binary.
2 parents 16512d2 + cb21d31 commit a811dff

File tree

3 files changed

+31
-1
lines changed

3 files changed

+31
-1
lines changed

README.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ It then:
1818

1919
## 🚀 Usage
2020

21+
### Method 1: Local Installation
22+
2123
```bash
2224
# Install dependencies
2325
npm install
@@ -26,6 +28,30 @@ npm install
2628
npm start
2729
```
2830

31+
### Method 2: Command Line Installation
32+
33+
You can install this tool globally to use it from anywhere:
34+
35+
```bash
36+
# Install globally
37+
npm install -g .
38+
39+
# Run from anywhere
40+
gh-pr
41+
```
42+
43+
### Method 3: Bash Alias
44+
45+
You can also create a bash alias to run the tool:
46+
47+
```bash
48+
# Add to your ~/.bashrc or ~/.zshrc
49+
alias gh-pr="node /path/to/github-pr-builder/index.js"
50+
51+
# Then reload your shell
52+
source ~/.bashrc # or source ~/.zshrc
53+
```
54+
2955
## 🧪 Development
3056

3157
```bash

index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#!/usr/bin/env node
12

23
import { execSync } from 'child_process';
34
import { input, confirm } from '@inquirer/prompts';
@@ -240,4 +241,4 @@ if (import.meta.url === `file://${process.argv[1]}`) {
240241
console.error('An error occurred:', error);
241242
process.exit(1);
242243
});
243-
}
244+
}

package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
"description": "GitHub PR Maker generates a PR using a standard PR template and your input.",
55
"main": "index.js",
66
"type": "module",
7+
"bin": {
8+
"gh-pr": "./index.js"
9+
},
710
"scripts": {
811
"test": "node --experimental-vm-modules node_modules/jest/bin/jest.js",
912
"lint": "eslint .",

0 commit comments

Comments
 (0)