update build process and versioning

This commit is contained in:
Nystik
2026-05-26 02:55:24 +02:00
parent 28effab1ed
commit d5fb9e1e1d
11 changed files with 83 additions and 36 deletions

View File

@@ -4,13 +4,8 @@ const GITHUB_URL = "https://github.com/Nystik-gh/ignis";
const GITHUB_API_LATEST =
"https://api.github.com/repos/Nystik-gh/ignis/releases/latest";
function getVersion(app) {
try {
const manifest = app.plugins.getPlugin("ignis-bridge")?.manifest;
return manifest?.version || "unknown";
} catch {
return "unknown";
}
function getVersion() {
return window.__ignis?.version || "unknown";
}
// SemVer build metadata (`+xyz`) is informational and ignored for precedence.
@@ -41,7 +36,7 @@ async function checkForUpdate(currentVersion) {
}
function display(containerEl, app) {
const version = getVersion(app);
const version = getVersion();
const header = containerEl.createDiv("ignis-header");

View File

@@ -1,7 +1,10 @@
const esbuild = require("esbuild");
const path = require("path");
const { version: ignisVersion } = require("../../package.json");
const { version: semver } = require("../../package.json");
// Root build.js sets IGNIS_BUILD_RESOLVED when it runs first; standalone invocation falls back to a dev stamp.
const build = process.env.IGNIS_BUILD_RESOLVED || "dev";
module.exports = esbuild.build({
entryPoints: [path.join(__dirname, "src", "loader.js")],
@@ -18,7 +21,8 @@ module.exports = esbuild.build({
},
external: ["obsidian", "fs"],
define: {
__IGNIS_VERSION__: JSON.stringify(ignisVersion),
__IGNIS_VERSION__: JSON.stringify(semver),
__IGNIS_BUILD__: JSON.stringify(build),
},
logLevel: "info",
});

View File

@@ -13,8 +13,8 @@ import {
import { wsClient } from "./ws-client.js";
import { installIgnisApi } from "./ignis-api.js";
// __IGNIS_VERSION__ is replaced at build time from package.json.
window.__ignis = { version: __IGNIS_VERSION__ };
// __IGNIS_VERSION__ (semver) and __IGNIS_BUILD__ are replaced at build time.
window.__ignis = { version: __IGNIS_VERSION__, build: __IGNIS_BUILD__ };
window.__ignis_registerUI = registerUI;
installIgnisApi(wsClient);