hookreplay 1.0.2 → 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -15
- package/package.json +1 -1
- package/scripts/install.js +10 -32
package/README.md
CHANGED
|
@@ -5,14 +5,14 @@ Debug webhooks locally. Capture, inspect, and replay webhooks to your local deve
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
|
-
# npm
|
|
9
8
|
npm install -g hookreplay
|
|
9
|
+
```
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
yarn global add hookreplay
|
|
11
|
+
### Alternative Installation
|
|
13
12
|
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
```bash
|
|
14
|
+
# .NET Tool (requires .NET 9+)
|
|
15
|
+
dotnet tool install --global HookReplay.Cli
|
|
16
16
|
```
|
|
17
17
|
|
|
18
18
|
## Quick Start
|
|
@@ -54,16 +54,6 @@ Webhook Provider → HookReplay → CLI → localhost:3000
|
|
|
54
54
|
4. Connect CLI and click "Send to CLI" to forward to localhost
|
|
55
55
|
5. Debug with your IDE's breakpoints
|
|
56
56
|
|
|
57
|
-
## Alternative Installation
|
|
58
|
-
|
|
59
|
-
```bash
|
|
60
|
-
# .NET Tool (requires .NET 9+)
|
|
61
|
-
dotnet tool install --global HookReplay.Cli
|
|
62
|
-
|
|
63
|
-
# Homebrew (macOS)
|
|
64
|
-
brew install hookreplay/tap/hookreplay
|
|
65
|
-
```
|
|
66
|
-
|
|
67
57
|
## Links
|
|
68
58
|
|
|
69
59
|
- **Website:** https://hookreplay.dev
|
package/package.json
CHANGED
package/scripts/install.js
CHANGED
|
@@ -3,11 +3,10 @@
|
|
|
3
3
|
const https = require('https');
|
|
4
4
|
const fs = require('fs');
|
|
5
5
|
const path = require('path');
|
|
6
|
-
const { execSync } = require('child_process');
|
|
7
6
|
const zlib = require('zlib');
|
|
8
7
|
|
|
9
8
|
const VERSION = require('../package.json').version;
|
|
10
|
-
const
|
|
9
|
+
const DOWNLOAD_BASE_URL = 'https://hookreplay.dev/downloads/cli';
|
|
11
10
|
|
|
12
11
|
// Platform mapping
|
|
13
12
|
const PLATFORMS = {
|
|
@@ -36,7 +35,7 @@ function getDownloadUrl(platformKey) {
|
|
|
36
35
|
}
|
|
37
36
|
|
|
38
37
|
const ext = process.platform === 'win32' ? 'zip' : 'tar.gz';
|
|
39
|
-
return
|
|
38
|
+
return `${DOWNLOAD_BASE_URL}/v${VERSION}/hookreplay-${VERSION}-${rid}.${ext}`;
|
|
40
39
|
}
|
|
41
40
|
|
|
42
41
|
function downloadFile(url) {
|
|
@@ -49,7 +48,7 @@ function downloadFile(url) {
|
|
|
49
48
|
}
|
|
50
49
|
|
|
51
50
|
if (response.statusCode !== 200) {
|
|
52
|
-
reject(new Error(`Failed to download: ${response.statusCode}`));
|
|
51
|
+
reject(new Error(`Failed to download: HTTP ${response.statusCode}`));
|
|
53
52
|
return;
|
|
54
53
|
}
|
|
55
54
|
|
|
@@ -63,26 +62,6 @@ function downloadFile(url) {
|
|
|
63
62
|
});
|
|
64
63
|
}
|
|
65
64
|
|
|
66
|
-
async function extractTarGz(buffer, destDir) {
|
|
67
|
-
const tar = require('tar');
|
|
68
|
-
const tmpFile = path.join(destDir, 'temp.tar.gz');
|
|
69
|
-
|
|
70
|
-
fs.writeFileSync(tmpFile, buffer);
|
|
71
|
-
|
|
72
|
-
await tar.extract({
|
|
73
|
-
file: tmpFile,
|
|
74
|
-
cwd: destDir
|
|
75
|
-
});
|
|
76
|
-
|
|
77
|
-
fs.unlinkSync(tmpFile);
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
function extractZip(buffer, destDir) {
|
|
81
|
-
const AdmZip = require('adm-zip');
|
|
82
|
-
const zip = new AdmZip(buffer);
|
|
83
|
-
zip.extractAllTo(destDir, true);
|
|
84
|
-
}
|
|
85
|
-
|
|
86
65
|
async function install() {
|
|
87
66
|
const platformKey = getPlatformKey();
|
|
88
67
|
const binDir = path.join(__dirname, '..', 'bin');
|
|
@@ -111,17 +90,19 @@ async function install() {
|
|
|
111
90
|
|
|
112
91
|
// Extract based on platform
|
|
113
92
|
if (process.platform === 'win32') {
|
|
114
|
-
|
|
93
|
+
// For Windows ZIP files
|
|
94
|
+
const AdmZip = require('adm-zip');
|
|
95
|
+
const zip = new AdmZip(buffer);
|
|
96
|
+
zip.extractAllTo(binDir, true);
|
|
115
97
|
} else {
|
|
116
|
-
// For tar.gz
|
|
98
|
+
// For tar.gz files
|
|
117
99
|
const gunzip = zlib.gunzipSync(buffer);
|
|
118
100
|
|
|
119
101
|
// Simple tar extraction (single file)
|
|
120
|
-
// tar format: 512 byte header + file content
|
|
121
102
|
let offset = 0;
|
|
122
103
|
while (offset < gunzip.length) {
|
|
123
104
|
const header = gunzip.slice(offset, offset + 512);
|
|
124
|
-
if (header[0] === 0) break;
|
|
105
|
+
if (header[0] === 0) break;
|
|
125
106
|
|
|
126
107
|
const fileName = header.slice(0, 100).toString('utf8').replace(/\0/g, '').trim();
|
|
127
108
|
const fileSize = parseInt(header.slice(124, 136).toString('utf8').trim(), 8);
|
|
@@ -132,9 +113,7 @@ async function install() {
|
|
|
132
113
|
fs.writeFileSync(destPath, content);
|
|
133
114
|
|
|
134
115
|
// Make executable on Unix
|
|
135
|
-
|
|
136
|
-
fs.chmodSync(destPath, 0o755);
|
|
137
|
-
}
|
|
116
|
+
fs.chmodSync(destPath, 0o755);
|
|
138
117
|
}
|
|
139
118
|
|
|
140
119
|
offset += 512 + Math.ceil(fileSize / 512) * 512;
|
|
@@ -149,7 +128,6 @@ async function install() {
|
|
|
149
128
|
console.error('');
|
|
150
129
|
console.error('Alternative installation methods:');
|
|
151
130
|
console.error(' - dotnet tool install --global HookReplay.Cli');
|
|
152
|
-
console.error(' - brew install hookreplay/tap/hookreplay (macOS)');
|
|
153
131
|
console.error(' - Visit https://hookreplay.dev for more options');
|
|
154
132
|
process.exit(1);
|
|
155
133
|
}
|