Skip to content

Commit

Permalink
fix: retrieve server version from package.json
Browse files Browse the repository at this point in the history
  • Loading branch information
antomor committed Sep 26, 2023
1 parent e1c7a07 commit 8a7ffe2
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,6 @@ manager/keystore
workers/keystore
.eslintcache
config/local.*

# automatically generated in the predist script
version.ts
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
7 changes: 3 additions & 4 deletions src/RelayServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}
Expand Down Expand Up @@ -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,
};
}

Expand Down

0 comments on commit 8a7ffe2

Please sign in to comment.