Skip to content

Commit 3c0c161

Browse files
committed
Update server for assorted small bugfixes
Includes a fix to workaround node-gyp bug that includes build-tool symlinks in the server node_modules, which is rejected by Mac code signing. I'm going to fix this in the server too, and hopefully it'll get fixed in node-gyp eventually as well, but this quick fix should let us use the existing server build regardless. Once this is fixed somewhere upstream, we can drop this workaround here.
1 parent 72bcbcc commit 3c0c161

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

package.json

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,20 @@
88
"main": "build/index.js",
99
"scripts": {
1010
"postinstall": "electron-builder install-app-deps",
11+
"server:setup": "ts-node ./setup-server.ts",
1112
"build": "npm run build:src && npm run build:electron",
1213
"build:src": "tsc",
13-
"build:electron": "ts-node ./setup-server.ts && electron-builder build",
14-
"build:dir-only": "ts-node ./setup-server.ts && electron-builder --dir",
15-
"start": "ts-node ./setup-server.ts && npm run start:app",
14+
"build:electron": "npm run server:setup && electron-builder build",
15+
"build:dir-only": "npm run server:setup && electron-builder --dir",
16+
"start": "npm run server:setup && npm run start:app",
1617
"start:dev": "ts-node ./skip-server.ts && cross-env HTK_DEV=true APP_URL='http://local.httptoolkit.tech:8080' npm run start:app",
1718
"start:app": "tsc-watch --onSuccess 'electron .'"
1819
},
1920
"keywords": [],
2021
"author": "Tim Perry",
2122
"license": "AGPL-3.0-or-later",
2223
"config": {
23-
"httptoolkit-server-version": "1.10.0"
24+
"httptoolkit-server-version": "1.10.1"
2425
},
2526
"build": {
2627
"appId": "tech.httptoolkit.desktop",

setup-server.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import * as semver from 'semver';
1010
import fetch from 'node-fetch';
1111
import * as rimraf from 'rimraf';
1212
import * as targz from 'targz';
13+
import { execSync } from 'child_process';
1314

1415
const extractTarGz = promisify(targz.decompress);
1516
const deleteFile = promisify(fs.unlink);
@@ -33,6 +34,14 @@ async function setUpLocalEnv() {
3334
} else {
3435
console.log('Correct server already downloaded.');
3536
}
37+
38+
if (os.platform() !== 'win32') {
39+
// To work around https://github.com/nodejs/node-gyp/issues/2713,
40+
// caused by https://github.com/nodejs/node-gyp/commit/b9ddcd5bbd93b05b03674836b6ebdae2c2e74c8c,
41+
// we manually remove node_gyp_bins subdirectories. Done by shell just
42+
// because it's a quick easy fix:
43+
execSync('find httptoolkit-server/node_modules -type d -name node_gyp_bins -prune -exec rm -r {} \\;');
44+
}
3645
}
3746

3847
/*

0 commit comments

Comments
 (0)