From a3b1408c81d019c1a154b9cfccbd8a8582f17047 Mon Sep 17 00:00:00 2001 From: vnugent Date: Mon, 7 Apr 2025 13:56:25 -0400 Subject: [PATCH 1/3] refactor(app): #162 change version variable name and disable wrapping --- src/routes/about/+page.svelte | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/routes/about/+page.svelte b/src/routes/about/+page.svelte index 00a14c8..38ba29d 100644 --- a/src/routes/about/+page.svelte +++ b/src/routes/about/+page.svelte @@ -2,14 +2,14 @@ import { Heading } from "flowbite-svelte"; // Get the git tag version from environment variables - const gitTagVersion = import.meta.env.GIT_TAG || 'development'; + const appVersion = import.meta.env.APP_VERSION || 'development';
About - Version: {gitTagVersion} + Version: {appVersion}

Alexandria is a reader and writer for curated publications (in Asciidoc), and will eventually also support long-form articles (Markdown) and wiki pages (Asciidoc). It is produced by the GitCitadel project team.

From 173d8942ca2a849ea5f25e64d61b1cc874008bf6 Mon Sep 17 00:00:00 2001 From: vnugent Date: Mon, 7 Apr 2025 14:00:45 -0400 Subject: [PATCH 2/3] refactor: #162 Use package version in CI, update var, and fallbacks --- vite.config.ts | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/vite.config.ts b/vite.config.ts index 7a6e207..9074493 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -3,14 +3,21 @@ import { defineConfig } from "vite"; import { execSync } from "child_process"; // Function to get the latest git tag -function getLatestGitTag() { +function getAppVersionString() { + // if running in ci context, we can assume the package has been properly versioned + if (process.env.ALEXANDIRA_IS_CI_BUILD) { + console.info("Running in CI context, using package version"); + return process.env.npm_package_version; + } + try { - // Get the latest git tag + // Get the latest git tag, assuming git is installed and tagged branch is available const tag = execSync('git describe --tags --abbrev=0').toString().trim(); return tag; } catch (error) { console.error("Failed to get git tag:", error); - return "unknown"; + // Fallback to package version + return process.env.npm_package_version; } } @@ -20,7 +27,7 @@ export default defineConfig({ include: ['./tests/unit/**/*.unit-test.js'] }, define: { - // Expose the git tag as a global variable - 'import.meta.env.GIT_TAG': JSON.stringify(getLatestGitTag()) + // Expose the app version as a global variable + 'import.meta.env.APP_VERSION': JSON.stringify(getAppVersionString()) } }); From d119d304577a10467b98190409ac3c80c4615e9d Mon Sep 17 00:00:00 2001 From: vnugent Date: Mon, 7 Apr 2025 14:15:45 -0400 Subject: [PATCH 3/3] remove debug console log --- vite.config.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/vite.config.ts b/vite.config.ts index 9074493..f62eb54 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -6,7 +6,6 @@ import { execSync } from "child_process"; function getAppVersionString() { // if running in ci context, we can assume the package has been properly versioned if (process.env.ALEXANDIRA_IS_CI_BUILD) { - console.info("Running in CI context, using package version"); return process.env.npm_package_version; }