4
4
*--------------------------------------------------------------------------------------------*/
5
5
6
6
import { downloadZMQ } from '@vscode/zeromq' ;
7
+ import { spawn } from 'child_process' ;
7
8
import * as fs from 'fs' ;
8
9
import * as path from 'path' ;
9
10
import { compressTikToken } from './build/compressTikToken' ;
@@ -62,6 +63,56 @@ const treeSitterGrammars: ITreeSitterGrammar[] = [
62
63
63
64
const REPO_ROOT = path . join ( __dirname , '..' ) ;
64
65
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
+
65
116
async function main ( ) {
66
117
await fs . promises . mkdir ( path . join ( REPO_ROOT , '.build' ) , { recursive : true } ) ;
67
118
@@ -77,6 +128,9 @@ async function main() {
77
128
'node_modules/@vscode/tree-sitter-wasm/wasm/tree-sitter.wasm' ,
78
129
] , 'dist' ) ;
79
130
131
+ // Clone zeromq.js from specific commit
132
+ await cloneZeroMQ ( 'a19e8e373b3abc677f91b936d3f00d49b1b61792' ) ;
133
+
80
134
await downloadZMQ ( ) ;
81
135
82
136
// Check if the base cache file exists
0 commit comments