1
0
mirror of https://github.com/vrtmrz/obsidian-livesync.git synced 2025-08-10 22:11:45 +02:00

Imprinting version numbers to boot log.

This commit is contained in:
vorotamoroz
2022-07-21 13:06:42 +09:00
parent cb406e2db6
commit bb6d787607
2 changed files with 12 additions and 2 deletions

View File

@@ -3,7 +3,7 @@ import process from "process";
import builtins from "builtin-modules";
import sveltePlugin from "esbuild-svelte";
import sveltePreprocess from "svelte-preprocess";
import fs from "node:fs";
const banner = `/*
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
if you want to view the source, please visit the github repository of this plugin
@@ -11,7 +11,8 @@ if you want to view the source, please visit the github repository of this plugi
`;
const prod = process.argv[2] === "production";
const manifestJson = JSON.parse(fs.readFileSync("./manifest.json"));
const packageJson = JSON.parse(fs.readFileSync("./package.json"));
esbuild
.build({
banner: {
@@ -19,6 +20,10 @@ esbuild
},
entryPoints: ["src/main.ts"],
bundle: true,
define: {
"MANIFEST_VERSION": `"${manifestJson.version}"`,
"PACKAGE_VERSION": `"${packageJson.version}"`,
},
external: ["obsidian", "electron", ...builtins],
format: "cjs",
watch: !prod,

View File

@@ -218,6 +218,11 @@ export default class ObsidianLiveSyncPlugin extends Plugin {
async onload() {
setLogger(this.addLog.bind(this)); // Logger moved to global.
Logger("loading plugin");
//@ts-ignore
const manifestVersion = MANIFEST_VERSION || "-";
//@ts-ignore
const packageVersion = PACKAGE_VERSION || "-";
Logger(`Self-hosted LiveSync v${manifestVersion} ${packageVersion} `);
const lsname = "obsidian-live-sync-ver" + this.getVaultName();
const last_version = localStorage.getItem(lsname);
await this.loadSettings();