@@ -5,7 +5,7 @@ import * as os from 'node:os';
5
5
import * as path from 'node:path' ;
6
6
import * as url from 'node:url' ;
7
7
8
- import { exec , localRepoPath } from './utils' ;
8
+ import { git , localRepoPath , npm } from './utils' ;
9
9
10
10
const NS_PER_SEC = 1e9 ;
11
11
const LOCAL = 'local' ;
@@ -63,7 +63,7 @@ function prepareBenchmarkProjects(
63
63
path . join ( projectPath , 'package.json' ) ,
64
64
JSON . stringify ( packageJSON , null , 2 ) ,
65
65
) ;
66
- exec ( 'npm --quiet install --ignore-scripts ' , { cwd : projectPath } ) ;
66
+ npm ( [ ' --quiet' , ' install' , ' --ignore-scripts' ] , { cwd : projectPath } ) ;
67
67
68
68
return { revision, projectPath } ;
69
69
} ) ;
@@ -77,7 +77,7 @@ function prepareBenchmarkProjects(
77
77
}
78
78
79
79
// 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 ] ) ;
81
81
82
82
const archivePath = path . join ( tmpDir , `graphql-${ hash } .tgz` ) ;
83
83
if ( fs . existsSync ( archivePath ) ) {
@@ -87,19 +87,19 @@ function prepareBenchmarkProjects(
87
87
const repoDir = path . join ( tmpDir , hash ) ;
88
88
fs . rmSync ( repoDir , { recursive : true , force : true } ) ;
89
89
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 } ) ;
93
93
fs . renameSync ( buildNPMArchive ( repoDir ) , archivePath ) ;
94
94
fs . rmSync ( repoDir , { recursive : true } ) ;
95
95
return archivePath ;
96
96
}
97
97
98
98
function buildNPMArchive ( repoDir : string ) {
99
- exec ( 'npm --quiet run build:npm', { cwd : repoDir } ) ;
99
+ npm ( [ ' --quiet' , ' run' , ' build:npm'] , { cwd : repoDir } ) ;
100
100
101
101
const distDir = path . join ( repoDir , 'npmDist' ) ;
102
- const archiveName = exec ( ` npm --quiet pack ${ distDir } ` , {
102
+ const archiveName = npm ( [ ' --quiet' , ' pack' , distDir ] , {
103
103
cwd : repoDir ,
104
104
} ) ;
105
105
return path . join ( repoDir , archiveName ) ;
0 commit comments