You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
779 B
32 lines
779 B
import { sveltekit } from "@sveltejs/kit/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({ |
|
plugins: [sveltekit()], |
|
resolve: { |
|
alias: { |
|
$lib: './src/lib', |
|
$components: './src/components' |
|
} |
|
}, |
|
test: { |
|
include: ['./tests/unit/**/*.unit-test.js'] |
|
}, |
|
define: { |
|
// Expose the git tag as a global variable |
|
'import.meta.env.GIT_TAG': JSON.stringify(getLatestGitTag()) |
|
} |
|
});
|
|
|