mirror of
https://github.com/Nystik-gh/ignis.git
synced 2026-06-17 04:35:53 +00:00
update build process and versioning
This commit is contained in:
@@ -53,6 +53,7 @@ COPY packages/server-core/src/ ./packages/server-core/src/
|
||||
# Built artifacts from the build stage.
|
||||
COPY --from=build /app/packages/shim/dist/shim-loader.js ./packages/shim/dist/shim-loader.js
|
||||
COPY --from=build /app/packages/ui/dist/ignis-ui.js ./packages/ui/dist/ignis-ui.js
|
||||
COPY --from=build /app/apps/ignis-server/server/build-info.json ./apps/ignis-server/server/build-info.json
|
||||
COPY --from=build /app/apps/ignis-server/server/plugins/headless-sync/obsidian/dist/ ./apps/ignis-server/server/plugins/headless-sync/obsidian/dist/
|
||||
|
||||
RUN chmod +x /app/apps/ignis-server/scripts/entrypoint.sh
|
||||
|
||||
@@ -103,7 +103,6 @@ module.exports = {
|
||||
const assetsPath =
|
||||
process.env.OBSIDIAN_ASSETS_PATH ||
|
||||
path.join(__dirname, "..", "investigation", "obsidian_1.12.7_unpacked");
|
||||
q;
|
||||
try {
|
||||
const pkg = JSON.parse(
|
||||
fs.readFileSync(path.join(assetsPath, "package.json"), "utf-8"),
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"id": "ignis-headless-sync",
|
||||
"name": "Ignis Headless Sync",
|
||||
"name": "Headless Sync",
|
||||
"version": "0.3.0",
|
||||
"minAppVersion": "1.12.4",
|
||||
"description": "Client-side companion for server-side Obsidian Sync",
|
||||
|
||||
@@ -1,15 +1,14 @@
|
||||
const express = require("express");
|
||||
const { getVersion } = require("../version");
|
||||
const { getSemver, getBuild } = require("../version");
|
||||
const config = require("../config");
|
||||
|
||||
const router = express.Router();
|
||||
|
||||
// `version` is the display-friendly SemVer. `build` is the per-build stamp for cache-bust.
|
||||
router.get("/", (req, res) => {
|
||||
const pkg = require("../../package.json");
|
||||
|
||||
res.json({
|
||||
version: getVersion(),
|
||||
semver: pkg.version,
|
||||
version: getSemver(),
|
||||
build: getBuild(),
|
||||
obsidianVersion: config.obsidianVersion,
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,23 +1,51 @@
|
||||
const fs = require("fs");
|
||||
const path = require("path");
|
||||
const { execSync } = require("child_process");
|
||||
|
||||
function getVersion() {
|
||||
const pkg = JSON.parse(
|
||||
fs.readFileSync(path.join(__dirname, "..", "package.json"), "utf-8"),
|
||||
);
|
||||
const semver = pkg.version;
|
||||
let cached = null;
|
||||
|
||||
let hash;
|
||||
try {
|
||||
hash = execSync("git rev-parse --short=7 HEAD", {
|
||||
encoding: "utf-8",
|
||||
}).trim();
|
||||
} catch (e) {
|
||||
hash = Date.now().toString(36).slice(-7);
|
||||
function load() {
|
||||
if (cached) {
|
||||
return cached;
|
||||
}
|
||||
|
||||
return `${semver}-${hash}`;
|
||||
// Production: root build.js writes this next to us.
|
||||
try {
|
||||
cached = JSON.parse(
|
||||
fs.readFileSync(path.join(__dirname, "build-info.json"), "utf-8"),
|
||||
);
|
||||
return cached;
|
||||
} catch {}
|
||||
|
||||
// Local dev fallback. Read root package.json.
|
||||
try {
|
||||
const pkg = JSON.parse(
|
||||
fs.readFileSync(
|
||||
path.join(__dirname, "..", "..", "..", "package.json"),
|
||||
"utf-8",
|
||||
),
|
||||
);
|
||||
cached = {
|
||||
semver: pkg.version,
|
||||
build: "dev",
|
||||
version: `${pkg.version}-dev`,
|
||||
};
|
||||
return cached;
|
||||
} catch {}
|
||||
|
||||
cached = { semver: "0.0.0", build: "unknown", version: "0.0.0-unknown" };
|
||||
return cached;
|
||||
}
|
||||
|
||||
module.exports = { getVersion };
|
||||
function getVersion() {
|
||||
return load().version;
|
||||
}
|
||||
|
||||
function getSemver() {
|
||||
return load().semver;
|
||||
}
|
||||
|
||||
function getBuild() {
|
||||
return load().build;
|
||||
}
|
||||
|
||||
module.exports = { getVersion, getSemver, getBuild };
|
||||
|
||||
Reference in New Issue
Block a user