File tree Expand file tree Collapse file tree 2 files changed +30
-0
lines changed Expand file tree Collapse file tree 2 files changed +30
-0
lines changed Original file line number Diff line number Diff line change 2323 "scripts" : {
2424 "build" : " pnpm build:hardhat && tsc -p tsconfig.build.json" ,
2525 "build:hardhat" : " hardhat --config hardhat.build.config.ts compile" ,
26+ "check:deployment-addresses" : " ts-node scripts/check-deployment-addresses.ts" ,
2627 "deploy:InverseApi3ReaderProxyV1" : " hardhat deploy --network $NETWORK --tags InverseApi3ReaderProxyV1" ,
2728 "deploy:NormalizedApi3ReaderProxyV1" : " hardhat deploy --network $NETWORK --tags NormalizedApi3ReaderProxyV1" ,
2829 "deploy:ProductApi3ReaderProxyV1" : " hardhat deploy --network $NETWORK --tags ProductApi3ReaderProxyV1" ,
Original file line number Diff line number Diff line change 1+ import * as fs from 'node:fs' ;
2+ import { join } from 'node:path' ;
3+
4+ import { getDeploymentAddresses } from './src/deployment-addresses' ;
5+
6+ async function main ( ) : Promise < void > {
7+ const addressesJsonPath = join ( 'deployments' , 'addresses.json' ) ;
8+ const existingAddressesJsonString = fs . existsSync ( addressesJsonPath )
9+ ? fs . readFileSync ( addressesJsonPath , 'utf8' )
10+ : '{}' ;
11+
12+ const generatedAddressesJsonString = getDeploymentAddresses ( ) ;
13+
14+ // Normalize by parsing and re-stringifying to ensure consistent formatting for comparison
15+ const normalizedExisting = `${ JSON . stringify ( JSON . parse ( existingAddressesJsonString ) , null , 2 ) } \n` ;
16+ const normalizedGenerated = `${ JSON . stringify ( JSON . parse ( generatedAddressesJsonString ) , null , 2 ) } \n` ;
17+
18+ if ( normalizedExisting !== normalizedGenerated ) {
19+ throw new Error ( `${ addressesJsonPath } is outdated. Please run "pnpm generate:deployment-addresses".` ) ;
20+ }
21+ }
22+
23+ main ( )
24+ . then ( ( ) => process . exit ( 0 ) )
25+ . catch ( ( error ) => {
26+ // eslint-disable-next-line no-console
27+ console . error ( error ) ;
28+ process . exit ( 1 ) ;
29+ } ) ;
You can’t perform that action at this time.
0 commit comments