diff --git a/.gitignore b/.gitignore index 3c27be9..70ebde4 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,6 @@ manager/keystore workers/keystore .eslintcache config/local.* + +# automatically generated in the predist script +version.ts \ No newline at end of file diff --git a/package.json b/package.json index c5ece48..ab2a825 100644 --- a/package.json +++ b/package.json @@ -54,6 +54,7 @@ "main": "dist/index.js", "types": "dist/index.d.ts", "scripts": { + "predist": "node -p \"'export const SERVER_VERSION = ' + JSON.stringify(require('./package.json').version) + ';'\" > src/version.ts", "dist": "scripts/dist", "format": "npx prettier \"{,test/**/}*.ts\" \"{,src/**/}*.ts\" !.gitignore --list-different --no-editorconfig", "format:fix": "npm run format -- --write", diff --git a/src/RelayServer.ts b/src/RelayServer.ts index 453cfb0..5866cd1 100644 --- a/src/RelayServer.ts +++ b/src/RelayServer.ts @@ -68,8 +68,7 @@ import { EVENT_REPLENISH_CHECK_REQUIRED, registerEventHandlers, } from './events'; - -const VERSION = '2.0.1'; +import { SERVER_VERSION as version } from './version'; type HubInfo = { relayWorkerAddress: string; @@ -178,7 +177,7 @@ export class RelayServer extends EventEmitter { ); this.printServerAddresses(); - log.info('RelayServer version', VERSION); + log.info('RelayServer version', version); log.info('Using server configuration:\n', this.config); registerEventHandlers(this); } @@ -206,7 +205,7 @@ export class RelayServer extends EventEmitter { chainId: this.chainId?.toString(), networkId: this.networkId?.toString(), ready: this.isReady() ?? false, - version: VERSION, + version: version, }; }