@@ -5,7 +5,7 @@ import * as os from 'node:os';
55import * as path from 'node:path' ;
66import * as url from 'node:url' ;
77
8- import { exec , localRepoPath } from './utils' ;
8+ import { git , localRepoPath , npm } from './utils' ;
99
1010const NS_PER_SEC = 1e9 ;
1111const LOCAL = 'local' ;
@@ -63,7 +63,7 @@ function prepareBenchmarkProjects(
6363 path . join ( projectPath , 'package.json' ) ,
6464 JSON . stringify ( packageJSON , null , 2 ) ,
6565 ) ;
66- exec ( 'npm --quiet install --ignore-scripts ' , { cwd : projectPath } ) ;
66+ npm ( [ ' --quiet' , ' install' , ' --ignore-scripts' ] , { cwd : projectPath } ) ;
6767
6868 return { revision, projectPath } ;
6969 } ) ;
@@ -77,7 +77,7 @@ function prepareBenchmarkProjects(
7777 }
7878
7979 // Returns the complete git hash for a given git revision reference.
80- const hash = exec ( ` git rev-parse " ${ revision } "` ) ;
80+ const hash = git ( [ ' rev-parse' , revision ] ) ;
8181
8282 const archivePath = path . join ( tmpDir , `graphql-${ hash } .tgz` ) ;
8383 if ( fs . existsSync ( archivePath ) ) {
@@ -87,19 +87,19 @@ function prepareBenchmarkProjects(
8787 const repoDir = path . join ( tmpDir , hash ) ;
8888 fs . rmSync ( repoDir , { recursive : true , force : true } ) ;
8989 fs . mkdirSync ( repoDir ) ;
90- exec ( ` git clone --quiet " ${ localRepoPath ( ) } " " ${ repoDir } "` ) ;
91- exec ( ` git checkout --quiet --detach " ${ hash } "` , { cwd : repoDir } ) ;
92- exec ( 'npm --quiet ci --ignore-scripts', { cwd : repoDir } ) ;
90+ git ( [ ' clone' , ' --quiet' , localRepoPath ( ) , repoDir ] ) ;
91+ git ( [ ' checkout' , ' --quiet' , ' --detach' , hash ] , { cwd : repoDir } ) ;
92+ npm ( [ ' --quiet' , 'ci' , ' --ignore-scripts'] , { cwd : repoDir } ) ;
9393 fs . renameSync ( buildNPMArchive ( repoDir ) , archivePath ) ;
9494 fs . rmSync ( repoDir , { recursive : true } ) ;
9595 return archivePath ;
9696 }
9797
9898 function buildNPMArchive ( repoDir : string ) {
99- exec ( 'npm --quiet run build:npm', { cwd : repoDir } ) ;
99+ npm ( [ ' --quiet' , ' run' , ' build:npm'] , { cwd : repoDir } ) ;
100100
101101 const distDir = path . join ( repoDir , 'npmDist' ) ;
102- const archiveName = exec ( ` npm --quiet pack ${ distDir } ` , {
102+ const archiveName = npm ( [ ' --quiet' , ' pack' , distDir ] , {
103103 cwd : repoDir ,
104104 } ) ;
105105 return path . join ( repoDir , archiveName ) ;
0 commit comments