summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xpackages/taler-harness/build.mjs11
-rw-r--r--packages/taler-util/src/wallet-types.ts3
-rwxr-xr-xpackages/taler-wallet-cli/build-node.mjs7
-rwxr-xr-xpackages/taler-wallet-cli/build-qtart.mjs7
-rw-r--r--packages/taler-wallet-core/src/versions.ts16
-rw-r--r--packages/taler-wallet-core/src/wallet.ts2
-rwxr-xr-xpackages/taler-wallet-embedded/build.mjs65
7 files changed, 75 insertions, 36 deletions
diff --git a/packages/taler-harness/build.mjs b/packages/taler-harness/build.mjs
index 3fb411342..ef2a2b111 100755
--- a/packages/taler-harness/build.mjs
+++ b/packages/taler-harness/build.mjs
@@ -16,8 +16,8 @@
*/
import esbuild from "esbuild";
-import path from "path";
import fs from "fs";
+import path from "path";
const BASE = process.cwd();
@@ -43,7 +43,10 @@ function git_hash() {
if (rev.indexOf("/") === -1) {
return rev;
} else {
- return fs.readFileSync(path.join(GIT_ROOT, ".git", rev)).toString().trim();
+ return fs
+ .readFileSync(path.join(GIT_ROOT, ".git", rev))
+ .toString()
+ .trim();
}
}
@@ -61,7 +64,9 @@ export const buildConfig = {
define: {
__VERSION__: `"${_package.version}"`,
__GIT_HASH__: `"${GIT_HASH}"`,
- ["import.meta.url"]: "import_meta_url",
+ "walletCoreBuildInfo.implementationSemver": `"${_package.version}"`,
+ "walletCoreBuildInfo.implementationGitHash": `"${GIT_HASH}"`,
+ "import.meta.url": "import_meta_url",
},
};
diff --git a/packages/taler-util/src/wallet-types.ts b/packages/taler-util/src/wallet-types.ts
index b1fbd3d43..c2730812f 100644
--- a/packages/taler-util/src/wallet-types.ts
+++ b/packages/taler-util/src/wallet-types.ts
@@ -1092,6 +1092,9 @@ export interface ExchangeDetailedResponse {
}
export interface WalletCoreVersion {
+ implementationSemver: string;
+ implementationGitHash: string;
+
/**
* Wallet-core protocol version supported by this implementation
* of the API ("server" version).
diff --git a/packages/taler-wallet-cli/build-node.mjs b/packages/taler-wallet-cli/build-node.mjs
index 76426bc41..047fc4527 100755
--- a/packages/taler-wallet-cli/build-node.mjs
+++ b/packages/taler-wallet-cli/build-node.mjs
@@ -43,7 +43,10 @@ function git_hash() {
if (rev.indexOf("/") === -1) {
return rev;
} else {
- return fs.readFileSync(path.join(GIT_ROOT, ".git", rev)).toString().trim();
+ return fs
+ .readFileSync(path.join(GIT_ROOT, ".git", rev))
+ .toString()
+ .trim();
}
}
@@ -60,6 +63,8 @@ export const buildConfig = {
define: {
__VERSION__: `"${_package.version}"`,
__GIT_HASH__: `"${GIT_HASH}"`,
+ "walletCoreBuildInfo.implementationSemver": `"${_package.version}"`,
+ "walletCoreBuildInfo.implementationGitHash": `"${GIT_HASH}"`,
["import.meta.url"]: "import_meta_url",
},
};
diff --git a/packages/taler-wallet-cli/build-qtart.mjs b/packages/taler-wallet-cli/build-qtart.mjs
index 7042bf49e..04b2e718f 100755
--- a/packages/taler-wallet-cli/build-qtart.mjs
+++ b/packages/taler-wallet-cli/build-qtart.mjs
@@ -43,7 +43,10 @@ function git_hash() {
if (rev.indexOf("/") === -1) {
return rev;
} else {
- return fs.readFileSync(path.join(GIT_ROOT, ".git", rev)).toString().trim();
+ return fs
+ .readFileSync(path.join(GIT_ROOT, ".git", rev))
+ .toString()
+ .trim();
}
}
@@ -63,6 +66,8 @@ export const buildConfig = {
define: {
__VERSION__: `"${_package.version}"`,
__GIT_HASH__: `"${GIT_HASH}"`,
+ "walletCoreBuildInfo.implementationSemver": `"${_package.version}"`,
+ "walletCoreBuildInfo.implementationGitHash": `"${GIT_HASH}"`,
},
};
diff --git a/packages/taler-wallet-core/src/versions.ts b/packages/taler-wallet-core/src/versions.ts
index 023cbb1ff..bf8a9f7c8 100644
--- a/packages/taler-wallet-core/src/versions.ts
+++ b/packages/taler-wallet-core/src/versions.ts
@@ -68,3 +68,19 @@ export const WALLET_CORE_API_IMPLEMENTATION_VERSION = "3:0:2";
* If any interfaces have been removed or changed since the last public
* release, then set age to 0.
*/
+
+// Provided either by bundler or in the next lines.
+declare global {
+ const walletCoreBuildInfo: {
+ implementationSemver: string;
+ implementationGitHash: string;
+ };
+}
+
+// Provide walletCoreBuildInfo if the bundler does not override it.
+if (!("walletCoreBuildInfo" in globalThis)) {
+ (globalThis as any).walletCoreBuildInfo = {
+ implementationSemver: "unknown",
+ implementationGitHash: "unknown",
+ } satisfies typeof walletCoreBuildInfo;
+}
diff --git a/packages/taler-wallet-core/src/wallet.ts b/packages/taler-wallet-core/src/wallet.ts
index 831f72259..72e9750bc 100644
--- a/packages/taler-wallet-core/src/wallet.ts
+++ b/packages/taler-wallet-core/src/wallet.ts
@@ -1556,6 +1556,8 @@ async function dispatchRequestInternal<Op extends WalletApiOperation>(
export function getVersion(ws: InternalWalletState): WalletCoreVersion {
const result: WalletCoreVersion = {
+ implementationSemver: walletCoreBuildInfo.implementationSemver,
+ implementationGitHash: walletCoreBuildInfo.implementationGitHash,
hash: undefined,
version: WALLET_CORE_API_IMPLEMENTATION_VERSION,
exchange: WALLET_EXCHANGE_PROTOCOL_VERSION,
diff --git a/packages/taler-wallet-embedded/build.mjs b/packages/taler-wallet-embedded/build.mjs
index 233660af1..f2bf7b986 100755
--- a/packages/taler-wallet-embedded/build.mjs
+++ b/packages/taler-wallet-embedded/build.mjs
@@ -15,31 +15,38 @@
GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
*/
-import esbuild from 'esbuild'
-import path from "path"
-import fs from "fs"
+import esbuild from "esbuild";
+import path from "path";
+import fs from "fs";
-const BASE = process.cwd()
+const BASE = process.cwd();
-let GIT_ROOT = BASE
-while (!fs.existsSync(path.join(GIT_ROOT, '.git')) && GIT_ROOT !== '/') {
- GIT_ROOT = path.join(GIT_ROOT, '../')
+let GIT_ROOT = BASE;
+while (!fs.existsSync(path.join(GIT_ROOT, ".git")) && GIT_ROOT !== "/") {
+ GIT_ROOT = path.join(GIT_ROOT, "../");
}
-if (GIT_ROOT === '/') {
- console.log("not found")
+if (GIT_ROOT === "/") {
+ console.log("not found");
process.exit(1);
}
-const GIT_HASH = GIT_ROOT === '/' ? undefined : git_hash()
+const GIT_HASH = GIT_ROOT === "/" ? undefined : git_hash();
-
-let _package = JSON.parse(fs.readFileSync(path.join(BASE, 'package.json')));
+let _package = JSON.parse(fs.readFileSync(path.join(BASE, "package.json")));
function git_hash() {
- const rev = fs.readFileSync(path.join(GIT_ROOT, '.git', 'HEAD')).toString().trim().split(/.*[: ]/).slice(-1)[0];
- if (rev.indexOf('/') === -1) {
+ const rev = fs
+ .readFileSync(path.join(GIT_ROOT, ".git", "HEAD"))
+ .toString()
+ .trim()
+ .split(/.*[: ]/)
+ .slice(-1)[0];
+ if (rev.indexOf("/") === -1) {
return rev;
} else {
- return fs.readFileSync(path.join(GIT_ROOT, '.git', rev)).toString().trim();
+ return fs
+ .readFileSync(path.join(GIT_ROOT, ".git", rev))
+ .toString()
+ .trim();
}
}
@@ -48,26 +55,22 @@ export const buildConfig = {
outfile: "dist/taler-wallet-core-qjs.mjs",
bundle: true,
minify: false,
- target: [
- 'es2020'
- ],
+ target: ["es2020"],
external: ["os", "std", "better-sqlite3"],
- format: 'esm',
- platform: 'neutral',
+ format: "esm",
+ platform: "neutral",
mainFields: ["module", "main"],
conditions: ["qtart"],
sourcemap: true,
define: {
- '__VERSION__': `"${_package.version}"`,
- '__GIT_HASH__': `"${GIT_HASH}"`,
+ __VERSION__: `"${_package.version}"`,
+ __GIT_HASH__: `"${GIT_HASH}"`,
+ "walletCoreBuildInfo.implementationSemver": `"${_package.version}"`,
+ "walletCoreBuildInfo.implementationGitHash": `"${GIT_HASH}"`,
},
-}
-
-esbuild
- .build(buildConfig)
- .catch((e) => {
- console.log(e)
- process.exit(1)
- });
-
+};
+esbuild.build(buildConfig).catch((e) => {
+ console.log(e);
+ process.exit(1);
+});