@@ -7,6 +7,8 @@ import semver from 'semver'
7
7
8
8
import { getFrameworks } from "./helpers/frameworks.js" ;
9
9
import { rebuildSingleFramework } from "./rebuild-single-framework.js" ;
10
+ import { rebuildFramework } from "./rebuild-build-single.js" ;
11
+ import { rebuildCheckSingle } from "./rebuild-check-single.js" ;
10
12
11
13
/**
12
14
* @typedef {Object } Framework
@@ -25,7 +27,8 @@ function performUpdate(frameworkPath, frameworkName) {
25
27
cwd : frameworkPath ,
26
28
stdio : "inherit" ,
27
29
} ) ;
28
- rebuildSingleFramework ( { frameworks : [ frameworkName ] , ci : false } ) ;
30
+ rebuildFramework ( frameworkName , false ) ;
31
+ rebuildCheckSingle ( { frameworks : [ frameworkName ] } ) ;
29
32
return `Sucessfully updated ${ frameworkPath } ` ;
30
33
} catch ( error ) {
31
34
console . error ( `Failed to update ${ frameworkPath } . Error Code ${ error . status } and message: ${ error . message } ` ) ;
@@ -167,38 +170,44 @@ export function updateFrameworks({ type, debug }) {
167
170
continue ;
168
171
}
169
172
170
- const packageJSON = JSON . parse ( fs . readFileSync ( packageJSONPath , "utf8" ) ) ;
171
- const mainPackages = packageJSON ?. [ "js-framework-benchmark" ] ?. frameworkVersionFromPackage ;
173
+ try {
172
174
173
- if ( ! mainPackages ) {
174
- manualChecks . push ( `${ type } /${ name } has no frameworkVersionFromPackage` ) ;
175
- continue ;
176
- }
175
+ const packageJSON = JSON . parse ( fs . readFileSync ( packageJSONPath , "utf8" ) ) ;
176
+ const mainPackages = packageJSON ?. [ "js-framework-benchmark" ] ?. frameworkVersionFromPackage ;
177
177
178
- if ( DEBUG ) {
179
- console . log ( `Checking ${ type } /${ name } ${ mainPackages } ` ) ;
180
- }
178
+ if ( ! mainPackages ) {
179
+ manualChecks . push ( `${ type } /${ name } has no frameworkVersionFromPackage` ) ;
180
+ continue ;
181
+ }
181
182
182
- const packages = mainPackages . split ( ":" ) ;
183
- const update = shouldUpdate ( packageJSONLockPath , packages ) ;
183
+ if ( DEBUG ) {
184
+ console . log ( `Checking ${ type } /${ name } ${ mainPackages } ` ) ;
185
+ }
186
+
187
+ const packages = mainPackages . split ( ":" ) ;
188
+ const update = shouldUpdate ( packageJSONLockPath , packages ) ;
189
+
190
+ if ( update ) {
191
+ log . push ( performUpdate ( frameworkPath , type + "/" + name ) ) ;
192
+ } else {
193
+ const isPackageObsolete = packages . map ( ( element ) => maybeObsolete ( element ) ) ;
194
+ const anyPackageObsolete = isPackageObsolete . some ( ( packageFramework ) => packageFramework . isObsolete ) ;
184
195
185
- if ( update ) {
186
- log . push ( performUpdate ( frameworkPath , type + "/" + name ) ) ;
187
- } else {
188
- const isPackageObsolete = packages . map ( ( element ) => maybeObsolete ( element ) ) ;
189
- const anyPackageObsolete = isPackageObsolete . some ( ( packageFramework ) => packageFramework . isObsolete ) ;
190
-
191
- if ( anyPackageObsolete ) {
192
- const formattedPackages = isPackageObsolete
193
- . map ( ( result ) => `${ result . packageName } :${ result . lastUpdate } ` )
194
- . join ( ", " ) ;
195
-
196
- console . log ( `Last npm update for ${ type } /${ name } - ${ mainPackages } is older than a year: ${ formattedPackages } ` ) ;
197
- log . push ( `Retire ${ type } /${ name } - ${ mainPackages } is older than a year` ) ;
198
- }
199
- else if ( DEBUG ) {
200
- log . push ( `Nothing to do for ${ type } /${ name } ` ) ;
196
+ if ( anyPackageObsolete ) {
197
+ const formattedPackages = isPackageObsolete
198
+ . map ( ( result ) => `${ result . packageName } :${ result . lastUpdate } ` )
199
+ . join ( ", " ) ;
200
+
201
+ console . log ( `Last npm update for ${ type } /${ name } - ${ mainPackages } is older than a year: ${ formattedPackages } ` ) ;
202
+ log . push ( `Retire ${ type } /${ name } - ${ mainPackages } is older than a year` ) ;
203
+ }
204
+ else if ( DEBUG ) {
205
+ log . push ( `Nothing to do for ${ type } /${ name } ` ) ;
206
+ }
201
207
}
208
+ } catch ( error ) {
209
+ console . error ( `Failed to check ${ type } /${ name } . Error Code ${ error . status } and message: ${ error . message } ` ) ;
210
+ log . push ( `Error checking ${ type } /${ name } ` ) ;
202
211
}
203
212
}
204
213
0 commit comments