Skip to content

Commit 30cb435

Browse files
authored
ci: move zeromq.js setup into postinstall (#1136)
1 parent f15a9c0 commit 30cb435

File tree

3 files changed

+56
-143
lines changed

3 files changed

+56
-143
lines changed

package-lock.json

Lines changed: 1 addition & 141 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4164,8 +4164,7 @@
41644164
"vscode-languageserver-protocol": "^3.17.5",
41654165
"vscode-languageserver-textdocument": "^1.0.12",
41664166
"vscode-languageserver-types": "^3.17.5",
4167-
"yaml": "^2.8.0",
4168-
"zeromq": "github:rebornix/zeromq.js#a19e8e373b3abc677f91b936d3f00d49b1b61792"
4167+
"yaml": "^2.8.0"
41694168
},
41704169
"dependencies": {
41714170
"@anthropic-ai/claude-code": "^1.0.120",

script/postinstall.ts

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
*--------------------------------------------------------------------------------------------*/
55

66
import { downloadZMQ } from '@vscode/zeromq';
7+
import { spawn } from 'child_process';
78
import * as fs from 'fs';
89
import * as path from 'path';
910
import { compressTikToken } from './build/compressTikToken';
@@ -62,6 +63,56 @@ const treeSitterGrammars: ITreeSitterGrammar[] = [
6263

6364
const REPO_ROOT = path.join(__dirname, '..');
6465

66+
/**
67+
* Clones the zeromq.js repository from a specific commit into node_modules/zeromq
68+
* @param commit The git commit hash to checkout
69+
*/
70+
async function cloneZeroMQ(commit: string): Promise<void> {
71+
const zeromqPath = path.join(REPO_ROOT, 'node_modules', 'zeromq');
72+
73+
// Remove existing zeromq directory if it exists
74+
if (fs.existsSync(zeromqPath)) {
75+
await fs.promises.rm(zeromqPath, { recursive: true, force: true });
76+
}
77+
78+
return new Promise((resolve, reject) => {
79+
// Clone the repository
80+
const cloneProcess = spawn('git', ['clone', 'https://github.com/rebornix/zeromq.js.git', zeromqPath], {
81+
cwd: REPO_ROOT,
82+
stdio: 'inherit'
83+
});
84+
85+
cloneProcess.on('close', (code) => {
86+
if (code !== 0) {
87+
reject(new Error(`Git clone failed with exit code ${code}`));
88+
return;
89+
}
90+
91+
// Checkout the specific commit
92+
const checkoutProcess = spawn('git', ['checkout', commit], {
93+
cwd: zeromqPath,
94+
stdio: 'inherit'
95+
});
96+
97+
checkoutProcess.on('close', (checkoutCode) => {
98+
if (checkoutCode !== 0) {
99+
reject(new Error(`Git checkout failed with exit code ${checkoutCode}`));
100+
return;
101+
}
102+
resolve();
103+
});
104+
105+
checkoutProcess.on('error', (error) => {
106+
reject(new Error(`Git checkout error: ${error.message}`));
107+
});
108+
});
109+
110+
cloneProcess.on('error', (error) => {
111+
reject(new Error(`Git clone error: ${error.message}`));
112+
});
113+
});
114+
}
115+
65116
async function main() {
66117
await fs.promises.mkdir(path.join(REPO_ROOT, '.build'), { recursive: true });
67118

@@ -77,6 +128,9 @@ async function main() {
77128
'node_modules/@vscode/tree-sitter-wasm/wasm/tree-sitter.wasm',
78129
], 'dist');
79130

131+
// Clone zeromq.js from specific commit
132+
await cloneZeroMQ('a19e8e373b3abc677f91b936d3f00d49b1b61792');
133+
80134
await downloadZMQ();
81135

82136
// Check if the base cache file exists

0 commit comments

Comments
 (0)