Skip to content

Commit

Permalink
Merge pull request #1444 from dusk-network/feature-1441
Browse files Browse the repository at this point in the history
web-wallet: Add visible version, commit hash and build date
  • Loading branch information
ascartabelli authored Feb 22, 2024
2 parents a6a5a7f + d3c5760 commit b790655
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 1 deletion.
6 changes: 6 additions & 0 deletions web-wallet/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Added

- Add visible version, commit hash and build date [#1441]

### Changed

### Removed
Expand Down Expand Up @@ -105,7 +107,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
[#1423]: https://github.com/dusk-network/rusk/issues/1423
[#1391]: https://github.com/dusk-network/rusk/issues/1391
[#1417]: https://github.com/dusk-network/rusk/issues/1417
<<<<<<< HEAD
[#1445]: https://github.com/dusk-network/rusk/issues/1445
=======
[#1441]: https://github.com/dusk-network/rusk/issues/1441
>>>>>>> e0c2a641 (web-wallet: Add visible version, commit hash and build date)
<!-- VERSIONS -->
[Unreleased]: https://github.com/dusk-network/rusk/tree/master/web-wallet
Expand Down
2 changes: 1 addition & 1 deletion web-wallet/src/app.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>Wallet - Dusk</title>
<title>Dusk Web Wallet - v%sveltekit.env.PUBLIC_APP_VERSION%</title>
<meta charset="utf-8"/>
<link rel="icon" type="image/png" href="%sveltekit.assets%/favicon.png"/>
<link rel="icon" type="image/svg+xml" href="%sveltekit.assets%/favicon.svg"/>
Expand Down
8 changes: 8 additions & 0 deletions web-wallet/src/routes/(welcome)/setup/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@
</div>
</section>

<footer class="setup-footer">
<span>Web Wallet v{import.meta.env.APP_VERSION} ({import.meta.env.APP_BUILD_INFO})</span>
</footer>

<style lang="postcss">
.setup-content {
flex: 1;
Expand Down Expand Up @@ -69,4 +73,8 @@
.setup-heading {
position: relative;
}
.setup-footer {
font-size: .75em;
}
</style>
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,20 @@ exports[`Setup > should render the Setup page 1`] = `
</div>
</div>
</section>
<footer
class="setup-footer s-yhWmfXbY838u"
>
<span
class="s-yhWmfXbY838u"
>
Web Wallet v
0.1.5
(
hash1234 2024-01-12
)
</span>
</footer>
<!--&lt;+page&gt;-->
</div>
`;
12 changes: 12 additions & 0 deletions web-wallet/vite.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,14 @@ import { sveltekit } from "@sveltejs/kit/vite";
import { defineConfig, loadEnv } from "vite";
import basicSsl from "@vitejs/plugin-basic-ssl";
import { nodePolyfills } from "vite-plugin-node-polyfills";
import * as childProcess from "child_process";

export default defineConfig(({ mode }) => {
const env = loadEnv(mode, process.cwd());
const buildDate = new Date().toISOString().substring(0, 10);
const buildHash = childProcess.execSync("git log -1 --grep='web-wallet:' --format=format:'%h'");
const APP_VERSION = process.env.npm_package_version ?? "unknown";
const APP_BUILD_INFO = `${buildHash.toString() || "unknown"} ${buildDate}`;
const commonPlugins = [
sveltekit(),
nodePolyfills({
Expand All @@ -14,11 +19,16 @@ export default defineConfig(({ mode }) => {
})
];

// needed to use %sveltekit.env.PUBLIC_APP_VERSION% in app.html
process.env.PUBLIC_APP_VERSION = APP_VERSION;

return {
define: {
"CONFIG": {
LOCAL_STORAGE_APP_KEY: process.env.npm_package_name
},
"import.meta.env.APP_BUILD_INFO": JSON.stringify(APP_BUILD_INFO),
"import.meta.env.APP_VERSION": JSON.stringify(APP_VERSION),
"process.env": {
CURRENT_NODE: env.VITE_CURRENT_NODE,
CURRENT_PROVER_NODE: env.VITE_CURRENT_PROVER_NODE,
Expand Down Expand Up @@ -62,6 +72,8 @@ export default defineConfig(({ mode }) => {
include: ["src/**"]
},
env: {
APP_BUILD_INFO: "hash1234 2024-01-12",
APP_VERSION: "0.1.5",
CURRENT_NODE: "http://127.0.0.1:8080/",
CURRENT_PROVER_NODE: "http://127.0.0.1:8080/",
LOCAL_NODE: "http://127.0.0.1:8080/",
Expand Down

0 comments on commit b790655

Please sign in to comment.