From d2758c7fa28a65e53665871f06e58c58cf5a2d26 Mon Sep 17 00:00:00 2001 From: Timothy Jaeryang Baek Date: Mon, 19 May 2025 14:35:51 +0400 Subject: [PATCH 1/3] refac: pypi --- .github/workflows/release-pypi.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/release-pypi.yml b/.github/workflows/release-pypi.yml index 5bf3973b3..d6171aae3 100644 --- a/.github/workflows/release-pypi.yml +++ b/.github/workflows/release-pypi.yml @@ -17,6 +17,8 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@v4 + - name: Install Git + run: sudo apt-get update && sudo apt-get install -y git - uses: actions/setup-node@v4 with: node-version: 22 From fd91b277a44b4c53dc53a18809d6c31ca0333b7c Mon Sep 17 00:00:00 2001 From: Timothy Jaeryang Baek Date: Mon, 19 May 2025 14:48:55 +0400 Subject: [PATCH 2/3] refac: pypi --- .github/workflows/release-pypi.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/release-pypi.yml b/.github/workflows/release-pypi.yml index d6171aae3..fd1adab3a 100644 --- a/.github/workflows/release-pypi.yml +++ b/.github/workflows/release-pypi.yml @@ -17,6 +17,8 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@v4 + with: + fetch-depth: 0 - name: Install Git run: sudo apt-get update && sudo apt-get install -y git - uses: actions/setup-node@v4 From ed0659aca60eedadadba4362b309015b4a8368c6 Mon Sep 17 00:00:00 2001 From: Timothy Jaeryang Baek Date: Mon, 19 May 2025 19:17:08 +0400 Subject: [PATCH 3/3] refac --- svelte.config.js | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/svelte.config.js b/svelte.config.js index 19b397286..82e05951f 100644 --- a/svelte.config.js +++ b/svelte.config.js @@ -1,6 +1,7 @@ import adapter from '@sveltejs/adapter-static'; import * as child_process from 'node:child_process'; import { vitePreprocess } from '@sveltejs/vite-plugin-svelte'; +import fs from 'node:fs'; /** @type {import('@sveltejs/kit').Config} */ const config = { @@ -18,7 +19,22 @@ const config = { }), // poll for new version name every 60 seconds (to trigger reload mechanic in +layout.svelte) version: { - name: child_process.execSync('git rev-parse HEAD').toString().trim(), + name: (() => { + try { + return child_process.execSync('git rev-parse HEAD').toString().trim(); + } catch { + // if git is not available, fallback to package.json version + // or current timestamp + try { + return ( + JSON.parse(fs.readFileSync(new URL('./package.json', import.meta.url), 'utf8')) + ?.version || Date.now().toString() + ); + } catch { + return Date.now().toString(); + } + } + })(), pollInterval: 60000 } },