From 33c880eda0696f83c72d80ce2826116392deef93 Mon Sep 17 00:00:00 2001 From: Gaung Ramadhan Date: Wed, 15 May 2024 20:31:09 +0700 Subject: [PATCH] test version (#368) --- .env.example | 2 +- package.json | 9 +++++---- src/lib/components/HelperButton.svelte | 2 ++ src/version.ts | 1 + 4 files changed, 9 insertions(+), 5 deletions(-) create mode 100644 src/version.ts diff --git a/.env.example b/.env.example index 2241702..efdeb2b 100644 --- a/.env.example +++ b/.env.example @@ -1,2 +1,2 @@ PUBLIC_BASE_URL= -PUBLIC_GOOGLE_ANALYTICS= \ No newline at end of file +PUBLIC_GOOGLE_ANALYTICS= diff --git a/package.json b/package.json index f44f197..f30b276 100644 --- a/package.json +++ b/package.json @@ -5,13 +5,14 @@ "license": "MIT", "type": "module", "scripts": { - "dev": "vite dev", - "build": "vite build", - "preview": "vite preview", + "dev": "pnpm run generate:version && vite dev", + "build": "pnpm run generate:version && vite build", + "preview": "pnpm run generate:version && vite preview", "check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json", "check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch", "lint": "prettier --plugin-search-dir . --check . && eslint .", - "format": "prettier --plugin-search-dir . --write ." + "format": "prettier --plugin-search-dir . --write .", + "generate:version": "echo \"export const version = '$(git describe --exact-match --tags 2> /dev/null || echo $(git rev-parse --abbrev-ref HEAD)-$(git rev-parse --short HEAD))'\" > ./src/version.ts" }, "dependencies": { "svelte-icons": "^2.1.0" diff --git a/src/lib/components/HelperButton.svelte b/src/lib/components/HelperButton.svelte index a8d50c1..e8c6f15 100644 --- a/src/lib/components/HelperButton.svelte +++ b/src/lib/components/HelperButton.svelte @@ -1,5 +1,6 @@