6 changed files with 42 additions and 19 deletions
@ -1,9 +1,26 @@ |
|||||||
import { sveltekit } from "@sveltejs/kit/vite"; |
import { sveltekit } from "@sveltejs/kit/vite"; |
||||||
import { defineConfig } from "vite"; |
import { defineConfig } from "vite"; |
||||||
|
import { execSync } from "child_process"; |
||||||
|
|
||||||
|
// Function to get the latest git tag
|
||||||
|
function getLatestGitTag() { |
||||||
|
try { |
||||||
|
// Get the latest git tag
|
||||||
|
const tag = execSync('git describe --tags --abbrev=0').toString().trim(); |
||||||
|
return tag; |
||||||
|
} catch (error) { |
||||||
|
console.error("Failed to get git tag:", error); |
||||||
|
return "unknown"; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
export default defineConfig({ |
export default defineConfig({ |
||||||
plugins: [sveltekit()], |
plugins: [sveltekit()], |
||||||
test: { |
test: { |
||||||
include: ['./tests/unit/**/*.unit-test.js'] |
include: ['./tests/unit/**/*.unit-test.js'] |
||||||
|
}, |
||||||
|
define: { |
||||||
|
// Expose the git tag as a global variable
|
||||||
|
'import.meta.env.GIT_TAG': JSON.stringify(getLatestGitTag()) |
||||||
} |
} |
||||||
}); |
}); |
||||||
|
|||||||
Loading…
Reference in new issue