Skip to content

Commit e33add1

Browse files
authored
Merge pull request #9 from neerajshukla1911/git-hooks-os-independent
Updated npm copyhooks command to make git hooks os independent
2 parents c9dbc80 + 548cf42 commit e33add1

File tree

3 files changed

+14
-2
lines changed

3 files changed

+14
-2
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
## How to run
2020
- Code
2121
- Install all the required packages: `npm install`
22-
- Start Requests Debugger with the required arguments: `npm run start -- <args>`.
22+
- Start Requests Debugger with the required arguments: `npm run start -- <args>`. On windows, use `node src\requestsDebugger.js` if npm run start fails.
2323
- Supported `args`:
2424
- `--port <port>`: Port on which the Requests Debugger Tool's Proxy will run. Default: 9687
2525
- `--reverse-proxy-port <port>`: Port on which the Requests Debugger Tool's Reverse Proxy will run. Default: 9688

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"build:linux-x64": "npm install; ./node_modules/pkg/lib-es5/bin.js -t node4-linux-x64 src/requestsDebugger.js; mv requestsDebugger RequestsDebugger-Linux-x64",
1313
"build:linux": "npm run build:linux-x86; npm run build:linux-x64",
1414
"build:win": "npm install; ./node_modules/pkg/lib-es5/bin.js -t node4-win-x86 src/requestsDebugger.js; mv requestsDebugger.exe RequestsDebugger.exe",
15-
"copyhooks": "cp hooks/* .git/hooks/; chmod +x .git/hooks/*",
15+
"copyhooks": "node ./scripts/copyhooks.js",
1616
"postinstall": "npm run copyhooks"
1717
},
1818
"bin": {

scripts/copyhooks.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
const fs = require('fs');
2+
const path = require('path');
3+
4+
const srcDir = './hooks/';
5+
const dstDir = './.git/hooks/'
6+
7+
fs.readdirSync(srcDir).forEach(file => {
8+
const srcFile = path.join(srcDir, file);
9+
const dstFile = path.join(dstDir, file);
10+
fs.createReadStream(srcFile).pipe(fs.createWriteStream(dstFile));
11+
fs.chmodSync(dstFile , '755');
12+
});

0 commit comments

Comments
 (0)