gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[taler-wallet-core] branch master updated: adding version and commit int


From: gnunet
Subject: [taler-wallet-core] branch master updated: adding version and commit into the setting section
Date: Mon, 05 Sep 2022 04:09:37 +0200

This is an automated email from the git hooks/post-receive script.

sebasjm pushed a commit to branch master
in repository wallet-core.

The following commit(s) were added to refs/heads/master by this push:
     new d439c3e1 adding version and commit into the setting section
d439c3e1 is described below

commit d439c3e1bc743f2aa47de4457953dba6ecb0e20f
Author: Sebastian <sebasjm@gmail.com>
AuthorDate: Sun Sep 4 23:08:45 2022 -0300

    adding version and commit into the setting section
---
 .../build-fast-with-linaria.mjs                    | 34 ++++++++++++++++++----
 packages/taler-wallet-webextension/src/custom.d.ts |  2 ++
 .../src/wallet/Settings.tsx                        | 16 ++++++++++
 3 files changed, 47 insertions(+), 5 deletions(-)

diff --git a/packages/taler-wallet-webextension/build-fast-with-linaria.mjs 
b/packages/taler-wallet-webextension/build-fast-with-linaria.mjs
index dc6f7b2b..25e5e78d 100755
--- a/packages/taler-wallet-webextension/build-fast-with-linaria.mjs
+++ b/packages/taler-wallet-webextension/build-fast-with-linaria.mjs
@@ -40,9 +40,10 @@ function getFilesInDirectory(startPath, regex) {
   return result
 }
 
-const allTestFiles = getFilesInDirectory(path.join(process.cwd(), 'src'), 
/.test.ts$/)
+const BASE = process.cwd()
+const allTestFiles = getFilesInDirectory(path.join(BASE, 'src'), /.test.ts$/)
 
-const preact = path.join(process.cwd(), "node_modules", "preact", "compat", 
"dist", "compat.module.js");
+const preact = path.join(BASE, "node_modules", "preact", "compat", "dist", 
"compat.module.js");
 const preactCompatPlugin = {
   name: "preact-compat",
   setup(build) {
@@ -61,6 +62,28 @@ const entryPoints = [
   'src/browserWorkerEntry.ts'
 ]
 
+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")
+  process.exit(1);
+}
+const GIT_HASH = GIT_ROOT === '/' ? undefined : git_hash()
+
+
+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) {
+    return rev;
+  } else {
+    return fs.readFileSync(path.join(GIT_ROOT, '.git', rev)).toString().trim();
+  }
+}
+
 export const buildConfig = {
   entryPoints: [...entryPoints, ...allTestFiles],
   bundle: true,
@@ -79,9 +102,10 @@ export const buildConfig = {
   sourcemap: true,
   jsxFactory: 'h',
   jsxFragment: 'Fragment',
-  // define: {
-  //   'process.env.NODE_ENV': '"development"',
-  // },
+  define: {
+    '__VERSION__': `"${_package.version}"`,
+    '__GIT_HASH__': `"${GIT_HASH}"`,
+  },
   plugins: [
     preactCompatPlugin,
     linaria.default({
diff --git a/packages/taler-wallet-webextension/src/custom.d.ts 
b/packages/taler-wallet-webextension/src/custom.d.ts
index 7f4a10cf..1bcd2a8d 100644
--- a/packages/taler-wallet-webextension/src/custom.d.ts
+++ b/packages/taler-wallet-webextension/src/custom.d.ts
@@ -29,3 +29,5 @@ declare module "*.svg" {
   const content: any;
   export default content;
 }
+declare const __VERSION__: string;
+declare const __GIT_HASH__: string;
diff --git a/packages/taler-wallet-webextension/src/wallet/Settings.tsx 
b/packages/taler-wallet-webextension/src/wallet/Settings.tsx
index 90e8518a..1b75ee6c 100644
--- a/packages/taler-wallet-webextension/src/wallet/Settings.tsx
+++ b/packages/taler-wallet-webextension/src/wallet/Settings.tsx
@@ -19,6 +19,7 @@ import { Fragment, h, VNode } from "preact";
 import { Checkbox } from "../components/Checkbox.js";
 import { ErrorTalerOperation } from "../components/ErrorTalerOperation.js";
 import { JustInDevMode } from "../components/JustInDevMode.js";
+import { Part } from "../components/Part.js";
 import { SelectList } from "../components/SelectList.js";
 import {
   DestructiveText,
@@ -69,6 +70,8 @@ export interface ViewProps {
   toggleDeveloperMode: () => Promise<void>;
   knownExchanges: Array<ExchangeListItem>;
 }
+const VERSION = typeof __VERSION__ !== "undefined" ? __VERSION__ : "dev";
+const GIT_HASH = typeof __GIT_HASH__ !== "undefined" ? __GIT_HASH__ : 
undefined;
 
 export function SettingsView({
   knownExchanges,
@@ -210,6 +213,19 @@ export function SettingsView({
             />
           </Input>
         </JustInDevMode>
+        <SubTitle>
+          <i18n.Translate>Version</i18n.Translate>
+        </SubTitle>
+        <Part
+          title={<i18n.Translate>Release</i18n.Translate>}
+          text={<span>{VERSION}</span>}
+        />
+        {GIT_HASH && (
+          <Part
+            title={<i18n.Translate>Hash</i18n.Translate>}
+            text={<span>{GIT_HASH}</span>}
+          />
+        )}
       </section>
     </Fragment>
   );

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]