shell: display build date

This commit is contained in:
Remko Tronçon 2022-04-18 14:41:52 +02:00
parent ea97e51644
commit e7cf4909fa
2 changed files with 10 additions and 2 deletions

View file

@ -72,6 +72,11 @@ let buildConfig = {
".wasm": "binary", ".wasm": "binary",
".js": "jsx", ".js": "jsx",
}, },
define: {
WAFORTH_VERSION: watch
? `"dev"`
: `"${new Date().toISOString().replace(/T.*/g, "")}"`,
},
sourcemap: true, sourcemap: true,
metafile: true, metafile: true,
plugins: [wasmTextPlugin(), forthPlugin()], plugins: [wasmTextPlugin(), forthPlugin()],

View file

@ -1,8 +1,12 @@
/* global WAFORTH_VERSION */
import WAForth from "../WAForth"; import WAForth from "../WAForth";
import sieve from "../../examples/sieve.f"; import sieve from "../../examples/sieve.f";
import "./shell.css"; import "./shell.css";
document.title = "WAForth"; document.title = "WAForth";
const version =
typeof WAFORTH_VERSION !== "undefined" ? WAFORTH_VERSION : "dev";
const forth = new WAForth(); const forth = new WAForth();
@ -86,8 +90,7 @@ function startConsole() {
}); });
} }
function clearConsole() { function clearConsole() {
consoleEl.innerHTML = consoleEl.innerHTML = `<span class='header'><a target='_blank' href='https://github.com/remko/waforth'>WAForth (${version})</a>\n</span><span class="cursor"> </span><input type="text">`;
"<span class='header'><a target='_blank' href='https://github.com/remko/waforth'>WAForth</a>\n</span><span class=\"cursor\"> </span><input type=\"text\">";
inputEl = document.querySelector("input"); inputEl = document.querySelector("input");
cursorEl = document.querySelector(".cursor"); cursorEl = document.querySelector(".cursor");
} }