diff --git a/build-web.js b/build-web.js index a2840c2..5ab761b 100755 --- a/build-web.js +++ b/build-web.js @@ -72,6 +72,11 @@ let buildConfig = { ".wasm": "binary", ".js": "jsx", }, + define: { + WAFORTH_VERSION: watch + ? `"dev"` + : `"${new Date().toISOString().replace(/T.*/g, "")}"`, + }, sourcemap: true, metafile: true, plugins: [wasmTextPlugin(), forthPlugin()], diff --git a/src/web/shell/shell.js b/src/web/shell/shell.js index d8476cd..5ce86cc 100644 --- a/src/web/shell/shell.js +++ b/src/web/shell/shell.js @@ -1,8 +1,12 @@ +/* global WAFORTH_VERSION */ + import WAForth from "../WAForth"; import sieve from "../../examples/sieve.f"; import "./shell.css"; document.title = "WAForth"; +const version = + typeof WAFORTH_VERSION !== "undefined" ? WAFORTH_VERSION : "dev"; const forth = new WAForth(); @@ -86,8 +90,7 @@ function startConsole() { }); } function clearConsole() { - consoleEl.innerHTML = - "WAForth\n "; + consoleEl.innerHTML = `WAForth (${version})\n `; inputEl = document.querySelector("input"); cursorEl = document.querySelector(".cursor"); }