import { ADOSizeComparator , BundleComparisonResult , bundlesContainNoChanges , getAzureDevopsApi , } from "@fluidframework/bundle-size-tools" ; declare function markdown ( message , file ? , line ? ) ; const adoConstants = { orgUrl : 'https://dev.azure.com/fluidframework' , projectName : 'public' , ciBuildDefinitionId : 48 , bundleAnalysisArtifactName : 'bundleAnalysis' , } ; const localReportPath = "./artifacts/bundleAnalysis" ; ( async function ( ) { if ( process . env [ "ADO_API_TOKEN" ] == undefined ) { throw new Error ( "no env ado api token provided" ) ; } if ( process . env [ "DANGER_GITHUB_API_TOKEN" ] == undefined ) { throw new Error ( "no env github api token provided" ) ; } const adoConnection = getAzureDevopsApi ( process . env [ "ADO_API_TOKEN" ] , adoConstants . orgUrl ) ; const sizeComparator = new ADOSizeComparator ( adoConstants , adoConnection , localReportPath , undefined , ADOSizeComparator . naiveFallbackCommitGenerator ) ; const result = await sizeComparator . createSizeComparisonMessage ( false ) ; if ( result . comparison === undefined || ! bundlesContainNoChanges ( result . comparison ) ) { markdown ( result . message ) ; } else { console . log ( "No size changes detected, skipping posting PR comment" ) ; } } ) ( ) ;