Browse Source

Changed logic to the sequence:

package version
git tag version
development version -> hidden

closes #162
master
Silberengel 11 months ago
parent
commit
52a353ebe1
  1. 4
      src/routes/about/+page.svelte
  2. 6
      vite.config.ts

4
src/routes/about/+page.svelte

@ -3,13 +3,16 @@ @@ -3,13 +3,16 @@
// Get the git tag version from environment variables
const appVersion = import.meta.env.APP_VERSION || 'development';
const isVersionKnown = appVersion !== 'development';
</script>
<div class='w-full flex justify-center'>
<main class='main-leather flex flex-col space-y-6 max-w-2xl w-full my-6 px-4'>
<div class="flex justify-between items-center">
<Heading tag='h1' class='h-leather mb-2'>About</Heading>
{#if isVersionKnown}
<span class="text-sm bg-gray-100 dark:bg-gray-800 px-2 py-1 rounded text-nowrap">Version: {appVersion}</span>
{/if}
</div>
<P class="mb-3">
@ -102,4 +105,3 @@ @@ -102,4 +105,3 @@
</main>
</div>

6
vite.config.ts

@ -5,7 +5,7 @@ import { execSync } from "child_process"; @@ -5,7 +5,7 @@ import { execSync } from "child_process";
// Function to get the latest git tag
function getAppVersionString() {
// if running in ci context, we can assume the package has been properly versioned
if (process.env.ALEXANDIRA_IS_CI_BUILD) {
if (process.env.ALEXANDIRA_IS_CI_BUILD && process.env.npm_package_version && process.env.npm_package_version.trim() !== '') {
return process.env.npm_package_version;
}
@ -14,9 +14,7 @@ function getAppVersionString() { @@ -14,9 +14,7 @@ function getAppVersionString() {
const tag = execSync('git describe --tags --abbrev=0').toString().trim();
return tag;
} catch (error) {
console.error("Failed to get git tag:", error);
// Fallback to package version
return process.env.npm_package_version;
return 'development';
}
}

Loading…
Cancel
Save