@@ -6,6 +6,13 @@ const fsp = require('fs/promises');
6
6
const app = express ( )
7
7
const port = 8080
8
8
9
+ let frameworkDirectory = path . join ( __dirname , ".." , "frameworks" ) ;
10
+
11
+ if ( process . argv . length === 3 ) {
12
+ console . log ( "Changing working directory to " + process . argv [ 2 ] ) ;
13
+ frameworkDirectory = process . argv [ 2 ] ;
14
+ }
15
+
9
16
async function loadFrameworkInfo ( keyedDir , directoryName ) {
10
17
let result = {
11
18
type : keyedDir ,
@@ -22,7 +29,7 @@ async function loadFrameworkInfo(keyedDir, directoryName) {
22
29
result . buttonsInShadowRoot = useShadowRoot ? ( packageJSON [ "js-framework-benchmark" ] [ "buttonsInShadowRoot" ] ?? true ) : undefined ;
23
30
}
24
31
25
- const frameworkPath = path . resolve ( ".." , "frameworks" , keyedDir , directoryName ) ;
32
+ const frameworkPath = path . resolve ( frameworkDirectory , keyedDir , directoryName ) ;
26
33
const packageJSONPath = path . resolve ( frameworkPath , "package.json" ) ;
27
34
const packageLockJSONPath = path . resolve ( frameworkPath , "package-lock.json" ) ;
28
35
if ( fs . existsSync ( packageJSONPath ) ) {
@@ -62,7 +69,7 @@ async function loadFrameworkVersionInformation(filterForFramework) {
62
69
// frameworkArgument.length == 0 || frameworkArgument.some((arg: string) => arg == directoryName);
63
70
64
71
let resultsProm = [ ] ;
65
- let frameworksPath = path . resolve ( ".." , "frameworks" ) ;
72
+ let frameworksPath = path . resolve ( frameworkDirectory ) ;
66
73
for ( keyedType of [ "keyed" , "non-keyed" ] ) {
67
74
let directories = fs . readdirSync ( path . resolve ( frameworksPath , keyedType ) ) ;
68
75
for ( let directory of directories ) {
@@ -76,8 +83,8 @@ async function loadFrameworkVersionInformation(filterForFramework) {
76
83
return Promise . all ( resultsProm ) ;
77
84
}
78
85
79
- app . use ( '/frameworks' , express . static ( path . join ( __dirname , '..' , 'frameworks' ) ) )
80
- app . use ( '/css' , express . static ( path . join ( __dirname , '..' , 'css' ) ) )
86
+ app . use ( '/frameworks' , express . static ( frameworkDirectory ) )
87
+ app . use ( '/css' , express . static ( path . join ( frameworkDirectory , '..' , 'css' ) ) )
81
88
82
89
app . get ( '/ls' , async ( req , res ) => {
83
90
let t0 = Date . now ( ) ;
0 commit comments