hookreplay 1.0.2 → 1.0.5
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 +17 -34
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 = {
|
|
@@ -26,7 +25,7 @@ function getPlatformKey() {
|
|
|
26
25
|
}
|
|
27
26
|
|
|
28
27
|
function getBinaryName() {
|
|
29
|
-
return process.platform === 'win32' ? 'hookreplay.exe' : 'hookreplay';
|
|
28
|
+
return process.platform === 'win32' ? 'hookreplay-bin.exe' : 'hookreplay-bin';
|
|
30
29
|
}
|
|
31
30
|
|
|
32
31
|
function getDownloadUrl(platformKey) {
|
|
@@ -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,30 +90,35 @@ 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);
|
|
97
|
+
// Rename extracted file to hookreplay-bin.exe
|
|
98
|
+
const extractedPath = path.join(binDir, 'hookreplay.exe');
|
|
99
|
+
if (fs.existsSync(extractedPath)) {
|
|
100
|
+
fs.renameSync(extractedPath, path.join(binDir, binaryName));
|
|
101
|
+
}
|
|
115
102
|
} else {
|
|
116
|
-
// For tar.gz
|
|
103
|
+
// For tar.gz files
|
|
117
104
|
const gunzip = zlib.gunzipSync(buffer);
|
|
118
105
|
|
|
119
106
|
// Simple tar extraction (single file)
|
|
120
|
-
// tar format: 512 byte header + file content
|
|
121
107
|
let offset = 0;
|
|
122
108
|
while (offset < gunzip.length) {
|
|
123
109
|
const header = gunzip.slice(offset, offset + 512);
|
|
124
|
-
if (header[0] === 0) break;
|
|
110
|
+
if (header[0] === 0) break;
|
|
125
111
|
|
|
126
112
|
const fileName = header.slice(0, 100).toString('utf8').replace(/\0/g, '').trim();
|
|
127
113
|
const fileSize = parseInt(header.slice(124, 136).toString('utf8').trim(), 8);
|
|
128
114
|
|
|
129
115
|
if (fileName && fileSize > 0) {
|
|
130
116
|
const content = gunzip.slice(offset + 512, offset + 512 + fileSize);
|
|
131
|
-
const destPath = path.join(binDir,
|
|
117
|
+
const destPath = path.join(binDir, binaryName);
|
|
132
118
|
fs.writeFileSync(destPath, content);
|
|
133
119
|
|
|
134
120
|
// Make executable on Unix
|
|
135
|
-
|
|
136
|
-
fs.chmodSync(destPath, 0o755);
|
|
137
|
-
}
|
|
121
|
+
fs.chmodSync(destPath, 0o755);
|
|
138
122
|
}
|
|
139
123
|
|
|
140
124
|
offset += 512 + Math.ceil(fileSize / 512) * 512;
|
|
@@ -149,7 +133,6 @@ async function install() {
|
|
|
149
133
|
console.error('');
|
|
150
134
|
console.error('Alternative installation methods:');
|
|
151
135
|
console.error(' - dotnet tool install --global HookReplay.Cli');
|
|
152
|
-
console.error(' - brew install hookreplay/tap/hookreplay (macOS)');
|
|
153
136
|
console.error(' - Visit https://hookreplay.dev for more options');
|
|
154
137
|
process.exit(1);
|
|
155
138
|
}
|