@@ -40,10 +40,15 @@ export default class GenerateBundlestats extends BaseCommand<typeof GenerateBund
4040 this . error ( "failed to get package information" ) ;
4141 }
4242
43- // Check each package location for a bundleAnalysis folder
44- // and copy it to a central location
43+ // Check each package location for a bundleAnalysis folder (telemetry-feeding
44+ // artifact: report.html, report.json, bundleStats.msp.gz) and a sibling
45+ // bundleAnalyzerJson folder (PR-comparison-feeding artifact: analyzer.json),
46+ // and copy each to its own central staging location. The two artifacts are
47+ // kept separate because the FF-internal telemetry handler walks every .json
48+ // under the bundleAnalysis artifact and would mis-parse analyzer.json.
4549 let hasSmallAssetError = false ;
4650 const analysesDestPath = path . join ( process . cwd ( ) , "artifacts/bundleAnalysis" ) ;
51+ const analyzerJsonDestPath = path . join ( process . cwd ( ) , "artifacts/bundleAnalyzerJson" ) ;
4752
4853 for ( const pkg of pkgList ) {
4954 if ( pkg . path === undefined ) {
@@ -82,6 +87,12 @@ export default class GenerateBundlestats extends BaseCommand<typeof GenerateBund
8287
8388 copySync ( packageAnalysisPath , path . join ( analysesDestPath , pkg . name ) ) ;
8489 }
90+
91+ const packageAnalyzerJsonPath = path . join ( pkg . path , "bundleAnalyzerJson" ) ;
92+ if ( existsSync ( packageAnalyzerJsonPath ) ) {
93+ this . log ( `found bundleAnalyzerJson for ${ pkg . name } ` ) ;
94+ copySync ( packageAnalyzerJsonPath , path . join ( analyzerJsonDestPath , pkg . name ) ) ;
95+ }
8596 }
8697
8798 if ( hasSmallAssetError ) {
0 commit comments