@@ -4,6 +4,8 @@ import * as fs from 'node:fs';
44import * as os from 'node:os' ;
55import * as path from 'node:path' ;
66
7+ import { localRepoPath } from './utils' ;
8+
79const NS_PER_SEC = 1e9 ;
810const LOCAL = 'local' ;
911
@@ -22,10 +24,6 @@ function runBenchmarks() {
2224 }
2325}
2426
25- function localDir ( ...paths : ReadonlyArray < string > ) {
26- return path . join ( __dirname , '..' , ...paths ) ;
27- }
28-
2927function exec ( command : string , options = { } ) {
3028 const result = cp . execSync ( command , {
3129 encoding : 'utf-8' ,
@@ -58,7 +56,7 @@ function prepareBenchmarkProjects(
5856 fs . rmSync ( projectPath , { recursive : true , force : true } ) ;
5957 fs . mkdirSync ( projectPath ) ;
6058
61- fs . cpSync ( localDir ( 'benchmark' ) , path . join ( projectPath , 'benchmark' ) , {
59+ fs . cpSync ( localRepoPath ( 'benchmark' ) , path . join ( projectPath , 'benchmark' ) , {
6260 recursive : true ,
6361 } ) ;
6462
@@ -80,7 +78,7 @@ function prepareBenchmarkProjects(
8078
8179 function prepareNPMPackage ( revision : string ) {
8280 if ( revision === LOCAL ) {
83- const repoDir = localDir ( ) ;
81+ const repoDir = localRepoPath ( ) ;
8482 const archivePath = path . join ( tmpDir , 'graphql-local.tgz' ) ;
8583 fs . renameSync ( buildNPMArchive ( repoDir ) , archivePath ) ;
8684 return archivePath ;
@@ -334,7 +332,7 @@ function getArguments(argv: ReadonlyArray<string>) {
334332
335333function findAllBenchmarks ( ) {
336334 return fs
337- . readdirSync ( localDir ( 'benchmark' ) , { withFileTypes : true } )
335+ . readdirSync ( localRepoPath ( 'benchmark' ) , { withFileTypes : true } )
338336 . filter ( ( dirent ) => dirent . isFile ( ) )
339337 . map ( ( dirent ) => dirent . name )
340338 . filter ( ( name ) => name . endsWith ( '-benchmark.js' ) )
0 commit comments