fix version substitution

This commit is contained in:
Florian Dold 2023-08-03 18:58:44 +02:00
parent 3d7df63c59
commit 0b5d0cdc71
No known key found for this signature in database
GPG Key ID: D2E4F00F29D02A4B
3 changed files with 11 additions and 3 deletions

View File

@ -12,7 +12,7 @@
"author": "Florian Dold", "author": "Florian Dold",
"license": "GPL-3.0", "license": "GPL-3.0",
"scripts": { "scripts": {
"compile": "jq '{version}' package.json > src/version.json && tsc --build", "compile": "tsc --build",
"pretty": "prettier --write src", "pretty": "prettier --write src",
"test": "tsc && ava", "test": "tsc && ava",
"coverage": "tsc && c8 --src src --all ava", "coverage": "tsc && c8 --src src --all ava",

View File

@ -34,3 +34,11 @@ export const WALLET_MERCHANT_PROTOCOL_VERSION = "2:0:1";
* Uses libtool's current:revision:age versioning. * Uses libtool's current:revision:age versioning.
*/ */
export const WALLET_BANK_INTEGRATION_PROTOCOL_VERSION = "0:0:0"; export const WALLET_BANK_INTEGRATION_PROTOCOL_VERSION = "0:0:0";
/**
* Semver of the wallet-core implementation.
* Will be replaced with the value from package.json in a
* post-compilation step (inside lib/).
*/
export const WALLET_CORE_IMPLEMENTATION_VERSION =
"__WALLET_CORE_IMPLEMENTATION_VERSION__";

View File

@ -300,6 +300,7 @@ import {
import { TimerAPI, TimerGroup } from "./util/timer.js"; import { TimerAPI, TimerGroup } from "./util/timer.js";
import { import {
WALLET_BANK_INTEGRATION_PROTOCOL_VERSION, WALLET_BANK_INTEGRATION_PROTOCOL_VERSION,
WALLET_CORE_IMPLEMENTATION_VERSION,
WALLET_EXCHANGE_PROTOCOL_VERSION, WALLET_EXCHANGE_PROTOCOL_VERSION,
WALLET_MERCHANT_PROTOCOL_VERSION, WALLET_MERCHANT_PROTOCOL_VERSION,
} from "./versions.js"; } from "./versions.js";
@ -310,7 +311,6 @@ import {
WalletCoreApiClient, WalletCoreApiClient,
WalletCoreResponseType, WalletCoreResponseType,
} from "./wallet-api-types.js"; } from "./wallet-api-types.js";
import versionInfo from "./version.json";
const logger = new Logger("wallet.ts"); const logger = new Logger("wallet.ts");
@ -1587,7 +1587,7 @@ async function dispatchRequestInternal<Op extends WalletApiOperation>(
export function getVersion(ws: InternalWalletState): WalletCoreVersion { export function getVersion(ws: InternalWalletState): WalletCoreVersion {
const result: WalletCoreVersion = { const result: WalletCoreVersion = {
hash: undefined, hash: undefined,
version: versionInfo.version, version: WALLET_CORE_IMPLEMENTATION_VERSION,
exchange: WALLET_EXCHANGE_PROTOCOL_VERSION, exchange: WALLET_EXCHANGE_PROTOCOL_VERSION,
merchant: WALLET_MERCHANT_PROTOCOL_VERSION, merchant: WALLET_MERCHANT_PROTOCOL_VERSION,
bank: WALLET_BANK_INTEGRATION_PROTOCOL_VERSION, bank: WALLET_BANK_INTEGRATION_PROTOCOL_VERSION,