Browse Source

bug-fixes for the build and profile badge

master
Silberengel 4 weeks ago
parent
commit
fbb050c59c
  1. 4
      Dockerfile
  2. 4
      package-lock.json
  3. 2
      package.json
  4. 8
      public/healthz.json
  5. 2
      scripts/generate-healthz.js
  6. 1
      src/app.d.ts
  7. 45
      src/lib/components/layout/ProfileBadge.svelte
  8. 30
      src/lib/services/version-manager.ts
  9. 4
      src/routes/about/+page.svelte
  10. 12
      src/routes/changelog.yaml/+server.ts
  11. 4
      src/routes/healthz.json/+server.ts
  12. 1
      src/vite-env.d.ts
  13. 0
      static/aither.png
  14. 0
      static/apple-touch-icon-114x114.png
  15. 0
      static/apple-touch-icon-120x120.png
  16. 0
      static/apple-touch-icon-144x144.png
  17. 0
      static/apple-touch-icon-152x152.png
  18. 0
      static/apple-touch-icon-180x180.png
  19. 0
      static/apple-touch-icon-57x57.png
  20. 0
      static/apple-touch-icon-60x60.png
  21. 0
      static/apple-touch-icon-72x72.png
  22. 0
      static/apple-touch-icon-76x76.png
  23. 2
      static/changelog.yaml
  24. 0
      static/favicon.ico
  25. 8
      static/healthz.json
  26. 0
      static/icons/arrow-left.svg
  27. 0
      static/icons/bookmark.svg
  28. 0
      static/icons/check.svg
  29. 0
      static/icons/chevron-down.svg
  30. 0
      static/icons/chevron-up.svg
  31. 0
      static/icons/code.svg
  32. 0
      static/icons/copy.svg
  33. 0
      static/icons/database.svg
  34. 0
      static/icons/download.svg
  35. 0
      static/icons/edit.svg
  36. 0
      static/icons/eye.svg
  37. 0
      static/icons/file-text.svg
  38. 0
      static/icons/heart.svg
  39. 0
      static/icons/highlight.svg
  40. 0
      static/icons/image.svg
  41. 0
      static/icons/key.svg
  42. 0
      static/icons/link.svg
  43. 0
      static/icons/log-in.svg
  44. 0
      static/icons/log-out.svg
  45. 0
      static/icons/message-square.svg
  46. 0
      static/icons/moon.svg
  47. 0
      static/icons/plus.svg
  48. 0
      static/icons/radio.svg
  49. 0
      static/icons/search.svg
  50. 0
      static/icons/send.svg
  51. 0
      static/icons/settings.svg
  52. 0
      static/icons/share.svg
  53. 0
      static/icons/smile.svg
  54. 0
      static/icons/sun.svg
  55. 0
      static/icons/trash.svg
  56. 0
      static/icons/upload.svg
  57. 0
      static/icons/user.svg
  58. 0
      static/icons/video.svg
  59. 0
      static/icons/volume.svg
  60. 0
      static/icons/x.svg
  61. 0
      static/icons/zap.svg
  62. 0
      static/og-image.png
  63. 2
      svelte.config.js
  64. 28
      vite.config.js
  65. 1
      vite.config.js.map
  66. 20
      vite.config.ts

4
Dockerfile

@ -25,8 +25,8 @@ RUN npm ci --only=production && npm cache clean --force @@ -25,8 +25,8 @@ RUN npm ci --only=production && npm cache clean --force
# Copy built application from builder stage
COPY --from=builder /app/build ./build
# Copy public directory (for static assets like changelog.yaml, healthz.json)
COPY --from=builder /app/public ./public
# Copy static directory (for static assets like changelog.yaml, healthz.json)
COPY --from=builder /app/static ./static
# Copy entrypoint script
COPY docker-entrypoint.sh /usr/local/bin/

4
package-lock.json generated

@ -1,12 +1,12 @@ @@ -1,12 +1,12 @@
{
"name": "aitherboard",
"version": "0.3.1",
"version": "0.3.2",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "aitherboard",
"version": "0.3.1",
"version": "0.3.2",
"license": "MIT",
"dependencies": {
"@codemirror/autocomplete": "^6.20.0",

2
package.json

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
{
"name": "aitherboard",
"version": "0.3.1",
"version": "0.3.2",
"type": "module",
"author": "silberengel@gitcitadel.com",
"description": "A decentralized messageboard built on the Nostr protocol.",

8
public/healthz.json

@ -1,8 +0,0 @@ @@ -1,8 +0,0 @@
{
"status": "ok",
"service": "aitherboard",
"version": "0.3.1",
"buildTime": "2026-02-14T07:05:05.090Z",
"gitCommit": "unknown",
"timestamp": 1771052705090
}

2
scripts/generate-healthz.js

@ -25,7 +25,7 @@ const healthz = { @@ -25,7 +25,7 @@ const healthz = {
timestamp: Date.now()
};
const outputPath = join(process.cwd(), 'public', 'healthz.json');
const outputPath = join(process.cwd(), 'static', 'healthz.json');
writeFileSync(outputPath, JSON.stringify(healthz, null, 2));
console.log('Generated healthz.json');

1
src/app.d.ts vendored

@ -17,6 +17,7 @@ interface ImportMetaEnv { @@ -17,6 +17,7 @@ interface ImportMetaEnv {
readonly VITE_DEFAULT_RELAYS?: string;
readonly VITE_ZAP_THRESHOLD?: string;
readonly VITE_THREAD_TIMEOUT_DAYS?: string;
readonly VITE_APP_VERSION?: string;
}
interface ImportMeta {

45
src/lib/components/layout/ProfileBadge.svelte

@ -137,13 +137,14 @@ @@ -137,13 +137,14 @@
}
});
// Always show NIP-05 if it exists (it's a verified identifier, different from display name)
// Show NIP-05 if it exists (it's a verified identifier, different from display name)
// Note: NIP-05 is automatically hidden when inline={true} to avoid breaking sentence flow
let shouldShowNip05 = $derived.by(() => {
return !!(profile?.nip05 && profile.nip05.length > 0);
});
</script>
<a href="/profile/{pubkey}" class="profile-badge inline-flex items-start gap-2 min-w-0 max-w-full" class:picture-only={pictureOnly}>
<a href="/profile/{pubkey}" class="profile-badge inline-flex min-w-0 max-w-full" class:picture-only={pictureOnly} class:inline-badge={inline} class:gap-2={!inline}>
{#if !inline || pictureOnly}
{#if profile?.picture && !imageError}
{@const compressedPictureUrl = (() => {
@ -202,7 +203,7 @@ @@ -202,7 +203,7 @@
<span class="profile-name min-w-0">
{profile?.name || shortenedNpub}
</span>
{#if !hideNip05 && shouldShowNip05 && profile?.nip05}
{#if !hideNip05 && !inline && shouldShowNip05 && profile?.nip05}
<span class="nip05-text text-fog-text-light dark:text-fog-dark-text-light min-w-0 break-nip05">
{profile.nip05[0]}
</span>
@ -226,6 +227,18 @@ @@ -226,6 +227,18 @@
box-sizing: border-box !important;
display: inline-flex !important;
flex-shrink: 1 !important;
align-items: flex-start; /* Default: align to top for non-inline badges */
vertical-align: top; /* Default vertical alignment */
}
/* For inline badges in text, align to text bottom for proper text flow */
.profile-badge.inline-badge {
vertical-align: text-bottom; /* Align to bottom of text line */
line-height: 1; /* Minimal line-height to prevent extra spacing */
align-items: flex-end; /* Align flex items to bottom */
margin: 0; /* Remove any margin */
padding: 0; /* Remove any padding */
gap: 0; /* Remove gap for inline badges */
}
.profile-badge-content {
@ -233,6 +246,21 @@ @@ -233,6 +246,21 @@
max-width: 100% !important;
width: 100% !important;
box-sizing: border-box !important;
display: flex;
flex-direction: column;
}
/* For inline badges, ensure content aligns properly */
.profile-badge.inline-badge .profile-badge-content {
line-height: 1;
margin: 0;
padding: 0;
}
.profile-badge.inline-badge .nip05-container {
line-height: 1;
margin: 0;
padding: 0;
}
.nip05-container {
@ -250,6 +278,17 @@ @@ -250,6 +278,17 @@
text-overflow: ellipsis !important;
flex-shrink: 1 !important;
min-width: 0 !important;
line-height: inherit; /* Match surrounding text line-height */
vertical-align: baseline; /* Align to text baseline */
}
/* For inline badges, ensure name aligns properly with text */
.profile-badge.inline-badge .profile-name {
line-height: 1; /* Match parent line-height exactly */
vertical-align: baseline;
display: inline; /* Inline for proper text flow */
margin: 0;
padding: 0;
}
.profile-badge:hover {

30
src/lib/services/version-manager.ts

@ -38,18 +38,22 @@ export async function getAppVersion(): Promise<string> { @@ -38,18 +38,22 @@ export async function getAppVersion(): Promise<string> {
}
// Fallback version (should match package.json)
// Try to read from package.json if available (for dev mode)
// Try to read from Vite environment variable (injected at build time from package.json)
try {
if (typeof window !== 'undefined') {
// In browser, we can't read package.json directly, so use fallback
cachedVersion = '0.2.1'; // Update this to match package.json version
// Use version from Vite env variable (set at build time from package.json)
const envVersion = import.meta.env.VITE_APP_VERSION;
if (envVersion && typeof envVersion === 'string') {
cachedVersion = envVersion;
}
}
} catch (error) {
// Ignore
}
if (!cachedVersion) {
cachedVersion = '0.2.1'; // Fallback to current package.json version
// Final fallback - should match current package.json version
cachedVersion = import.meta.env.VITE_APP_VERSION || '';
}
return cachedVersion;
}
@ -78,7 +82,7 @@ export async function getBuildTimestamp(): Promise<number | null> { @@ -78,7 +82,7 @@ export async function getBuildTimestamp(): Promise<number | null> {
* Get the current app version synchronously (uses cached value or fallback)
*/
export function getAppVersionSync(): string {
return cachedVersion || '0.2.1';
return cachedVersion || import.meta.env.VITE_APP_VERSION || '';
}
/**
@ -100,12 +104,15 @@ export function getStoredBuildTimestamp(): number | null { @@ -100,12 +104,15 @@ export function getStoredBuildTimestamp(): number | null {
/**
* Check if a new version is available
* In development, checks build timestamp; in production, checks version string
* In development, checks both version string and build timestamp; in production, checks version string
*/
export async function isNewVersionAvailable(): Promise<boolean> {
const stored = getStoredVersion();
if (!stored) return true; // First time user
// Get current version first
const current = await getAppVersion();
// Check if we're in development mode (dev server typically runs on localhost or 127.0.0.1)
const isDevelopment = typeof window !== 'undefined' &&
(window.location.hostname === 'localhost' ||
@ -114,7 +121,15 @@ export async function isNewVersionAvailable(): Promise<boolean> { @@ -114,7 +121,15 @@ export async function isNewVersionAvailable(): Promise<boolean> {
window.location.port === '5173');
if (isDevelopment) {
// In development, check build timestamp
// In development, check both version string AND build timestamp
// This ensures version changes are detected even if timestamp is the same
const versionChanged = stored !== current;
if (versionChanged) {
return true; // Version changed, definitely a new version
}
// If version is the same, check timestamp (for hot reloads during development)
const currentTimestamp = await getBuildTimestamp();
const storedTimestamp = getStoredBuildTimestamp();
@ -125,7 +140,6 @@ export async function isNewVersionAvailable(): Promise<boolean> { @@ -125,7 +140,6 @@ export async function isNewVersionAvailable(): Promise<boolean> {
return true;
} else {
// In production, check version string
const current = await getAppVersion();
return stored !== current;
}
}

4
src/routes/about/+page.svelte

@ -6,7 +6,7 @@ @@ -6,7 +6,7 @@
import { getAppVersion } from '../../lib/services/version-manager.js';
import { getAllVersions, loadChangelog } from '../../lib/services/changelog.js';
let appVersion = $state('0.3.1');
let appVersion = $state<string | null>(null);
let allVersions = $state<string[]>([]);
let changelog = $state<Record<string, string[]>>({});
let loadingChangelog = $state(true);
@ -71,7 +71,7 @@ @@ -71,7 +71,7 @@
<h2 class="section-title">Version Information</h2>
<div class="section-content">
<p class="version-info">
<strong>Current Version:</strong> <span class="version-badge">{appVersion}</span>
<strong>Current Version:</strong> <span class="version-badge">{appVersion || 'Loading...'}</span>
</p>
</div>
</section>

12
src/routes/changelog.yaml/+server.ts

@ -5,14 +5,14 @@ import type { RequestHandler } from '@sveltejs/kit'; @@ -5,14 +5,14 @@ import type { RequestHandler } from '@sveltejs/kit';
export const GET: RequestHandler = async () => {
try {
// Try multiple possible locations for changelog.yaml
// 1. In public directory (development)
// 2. In build/client (production - where SvelteKit copies public files)
// 3. In the copied public directory (Docker)
// 1. In static directory (development)
// 2. In build/client (production - where SvelteKit copies static files)
// 3. In the copied static directory (Docker)
const possiblePaths = [
join(process.cwd(), 'public', 'changelog.yaml'),
join(process.cwd(), 'static', 'changelog.yaml'),
join(process.cwd(), 'build', 'client', 'changelog.yaml'),
join(process.cwd(), '..', 'public', 'changelog.yaml'),
'/app/public/changelog.yaml' // Docker container path
join(process.cwd(), '..', 'static', 'changelog.yaml'),
'/app/static/changelog.yaml' // Docker container path
];
let changelogContent: string | null = null;

4
src/routes/healthz.json/+server.ts

@ -4,8 +4,8 @@ import type { RequestHandler } from './$types'; @@ -4,8 +4,8 @@ import type { RequestHandler } from './$types';
export const GET: RequestHandler = async () => {
try {
// Try to read from public/healthz.json (generated at build time)
const healthzPath = join(process.cwd(), 'public', 'healthz.json');
// Try to read from static/healthz.json (generated at build time)
const healthzPath = join(process.cwd(), 'static', 'healthz.json');
const healthzContent = readFileSync(healthzPath, 'utf-8');
const healthz = JSON.parse(healthzContent);

1
src/vite-env.d.ts vendored

@ -4,6 +4,7 @@ interface ImportMetaEnv { @@ -4,6 +4,7 @@ interface ImportMetaEnv {
readonly VITE_DEFAULT_RELAYS?: string;
readonly VITE_ZAP_THRESHOLD?: string;
readonly VITE_THREAD_TIMEOUT_DAYS?: string;
readonly VITE_APP_VERSION?: string;
}
interface ImportMeta {

0
public/aither.png → static/aither.png

Before

Width:  |  Height:  |  Size: 284 KiB

After

Width:  |  Height:  |  Size: 284 KiB

0
public/apple-touch-icon-114x114.png → static/apple-touch-icon-114x114.png

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 20 KiB

0
public/apple-touch-icon-120x120.png → static/apple-touch-icon-120x120.png

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 21 KiB

0
public/apple-touch-icon-144x144.png → static/apple-touch-icon-144x144.png

Before

Width:  |  Height:  |  Size: 30 KiB

After

Width:  |  Height:  |  Size: 30 KiB

0
public/apple-touch-icon-152x152.png → static/apple-touch-icon-152x152.png

Before

Width:  |  Height:  |  Size: 33 KiB

After

Width:  |  Height:  |  Size: 33 KiB

0
public/apple-touch-icon-180x180.png → static/apple-touch-icon-180x180.png

Before

Width:  |  Height:  |  Size: 44 KiB

After

Width:  |  Height:  |  Size: 44 KiB

0
public/apple-touch-icon-57x57.png → static/apple-touch-icon-57x57.png

Before

Width:  |  Height:  |  Size: 6.1 KiB

After

Width:  |  Height:  |  Size: 6.1 KiB

0
public/apple-touch-icon-60x60.png → static/apple-touch-icon-60x60.png

Before

Width:  |  Height:  |  Size: 6.5 KiB

After

Width:  |  Height:  |  Size: 6.5 KiB

0
public/apple-touch-icon-72x72.png → static/apple-touch-icon-72x72.png

Before

Width:  |  Height:  |  Size: 8.6 KiB

After

Width:  |  Height:  |  Size: 8.6 KiB

0
public/apple-touch-icon-76x76.png → static/apple-touch-icon-76x76.png

Before

Width:  |  Height:  |  Size: 9.5 KiB

After

Width:  |  Height:  |  Size: 9.5 KiB

2
public/changelog.yaml → static/changelog.yaml

@ -1,4 +1,6 @@ @@ -1,4 +1,6 @@
versions:
'0.3.2':
- 'Expanded /repos to handle GitLab, Gitea, and OneDev repositories'
'0.3.1':
- 'Media attachments rendering in all feeds and views'
- 'NIP-92/NIP-94 image tags support'

0
public/favicon.ico → static/favicon.ico

Before

Width:  |  Height:  |  Size: 4.2 KiB

After

Width:  |  Height:  |  Size: 4.2 KiB

8
static/healthz.json

@ -0,0 +1,8 @@ @@ -0,0 +1,8 @@
{
"status": "ok",
"service": "aitherboard",
"version": "0.3.2",
"buildTime": "2026-02-14T07:34:30.130Z",
"gitCommit": "unknown",
"timestamp": 1771054470130
}

0
public/icons/arrow-left.svg → static/icons/arrow-left.svg

Before

Width:  |  Height:  |  Size: 234 B

After

Width:  |  Height:  |  Size: 234 B

0
public/icons/bookmark.svg → static/icons/bookmark.svg

Before

Width:  |  Height:  |  Size: 251 B

After

Width:  |  Height:  |  Size: 251 B

0
public/icons/check.svg → static/icons/check.svg

Before

Width:  |  Height:  |  Size: 223 B

After

Width:  |  Height:  |  Size: 223 B

0
public/icons/chevron-down.svg → static/icons/chevron-down.svg

Before

Width:  |  Height:  |  Size: 212 B

After

Width:  |  Height:  |  Size: 212 B

0
public/icons/chevron-up.svg → static/icons/chevron-up.svg

Before

Width:  |  Height:  |  Size: 214 B

After

Width:  |  Height:  |  Size: 214 B

0
public/icons/code.svg → static/icons/code.svg

Before

Width:  |  Height:  |  Size: 259 B

After

Width:  |  Height:  |  Size: 259 B

0
public/icons/copy.svg → static/icons/copy.svg

Before

Width:  |  Height:  |  Size: 310 B

After

Width:  |  Height:  |  Size: 310 B

0
public/icons/database.svg → static/icons/database.svg

Before

Width:  |  Height:  |  Size: 319 B

After

Width:  |  Height:  |  Size: 319 B

0
public/icons/download.svg → static/icons/download.svg

Before

Width:  |  Height:  |  Size: 316 B

After

Width:  |  Height:  |  Size: 316 B

0
public/icons/edit.svg → static/icons/edit.svg

Before

Width:  |  Height:  |  Size: 325 B

After

Width:  |  Height:  |  Size: 325 B

0
public/icons/eye.svg → static/icons/eye.svg

Before

Width:  |  Height:  |  Size: 275 B

After

Width:  |  Height:  |  Size: 275 B

0
public/icons/file-text.svg → static/icons/file-text.svg

Before

Width:  |  Height:  |  Size: 352 B

After

Width:  |  Height:  |  Size: 352 B

0
public/icons/heart.svg → static/icons/heart.svg

Before

Width:  |  Height:  |  Size: 338 B

After

Width:  |  Height:  |  Size: 338 B

0
public/icons/highlight.svg → static/icons/highlight.svg

Before

Width:  |  Height:  |  Size: 308 B

After

Width:  |  Height:  |  Size: 308 B

0
public/icons/image.svg → static/icons/image.svg

Before

Width:  |  Height:  |  Size: 326 B

After

Width:  |  Height:  |  Size: 326 B

0
public/icons/key.svg → static/icons/key.svg

Before

Width:  |  Height:  |  Size: 306 B

After

Width:  |  Height:  |  Size: 306 B

0
public/icons/link.svg → static/icons/link.svg

Before

Width:  |  Height:  |  Size: 331 B

After

Width:  |  Height:  |  Size: 331 B

0
public/icons/log-in.svg → static/icons/log-in.svg

Before

Width:  |  Height:  |  Size: 316 B

After

Width:  |  Height:  |  Size: 316 B

0
public/icons/log-out.svg → static/icons/log-out.svg

Before

Width:  |  Height:  |  Size: 314 B

After

Width:  |  Height:  |  Size: 314 B

0
public/icons/message-square.svg → static/icons/message-square.svg

Before

Width:  |  Height:  |  Size: 261 B

After

Width:  |  Height:  |  Size: 261 B

0
public/icons/moon.svg → static/icons/moon.svg

Before

Width:  |  Height:  |  Size: 234 B

After

Width:  |  Height:  |  Size: 234 B

0
public/icons/plus.svg → static/icons/plus.svg

Before

Width:  |  Height:  |  Size: 228 B

After

Width:  |  Height:  |  Size: 228 B

0
public/icons/radio.svg → static/icons/radio.svg

Before

Width:  |  Height:  |  Size: 393 B

After

Width:  |  Height:  |  Size: 393 B

0
public/icons/search.svg → static/icons/search.svg

Before

Width:  |  Height:  |  Size: 247 B

After

Width:  |  Height:  |  Size: 247 B

0
public/icons/send.svg → static/icons/send.svg

Before

Width:  |  Height:  |  Size: 242 B

After

Width:  |  Height:  |  Size: 242 B

0
public/icons/settings.svg → static/icons/settings.svg

Before

Width:  |  Height:  |  Size: 965 B

After

Width:  |  Height:  |  Size: 965 B

0
public/icons/share.svg → static/icons/share.svg

Before

Width:  |  Height:  |  Size: 378 B

After

Width:  |  Height:  |  Size: 378 B

0
public/icons/smile.svg → static/icons/smile.svg

Before

Width:  |  Height:  |  Size: 333 B

After

Width:  |  Height:  |  Size: 333 B

0
public/icons/sun.svg → static/icons/sun.svg

Before

Width:  |  Height:  |  Size: 429 B

After

Width:  |  Height:  |  Size: 429 B

0
public/icons/trash.svg → static/icons/trash.svg

Before

Width:  |  Height:  |  Size: 302 B

After

Width:  |  Height:  |  Size: 302 B

0
public/icons/upload.svg → static/icons/upload.svg

Before

Width:  |  Height:  |  Size: 313 B

After

Width:  |  Height:  |  Size: 313 B

0
public/icons/user.svg → static/icons/user.svg

Before

Width:  |  Height:  |  Size: 271 B

After

Width:  |  Height:  |  Size: 271 B

0
public/icons/video.svg → static/icons/video.svg

Before

Width:  |  Height:  |  Size: 322 B

After

Width:  |  Height:  |  Size: 322 B

0
public/icons/volume.svg → static/icons/volume.svg

Before

Width:  |  Height:  |  Size: 312 B

After

Width:  |  Height:  |  Size: 312 B

0
public/icons/x.svg → static/icons/x.svg

Before

Width:  |  Height:  |  Size: 232 B

After

Width:  |  Height:  |  Size: 232 B

0
public/icons/zap.svg → static/icons/zap.svg

Before

Width:  |  Height:  |  Size: 355 B

After

Width:  |  Height:  |  Size: 355 B

0
public/og-image.png → static/og-image.png

Before

Width:  |  Height:  |  Size: 627 KiB

After

Width:  |  Height:  |  Size: 627 KiB

2
svelte.config.js

@ -18,7 +18,7 @@ const config = { @@ -18,7 +18,7 @@ const config = {
handleUnseenRoutes: 'ignore',
handleHttpError: ({ path, referrer, message }) => {
// Ignore 404s for static assets during prerendering
// These will be available at runtime from the public directory
// These will be available at runtime from the static directory
if (path === '/favicon.ico' || path === '/og-image.png') {
return;
}

28
vite.config.js

@ -1,28 +0,0 @@ @@ -1,28 +0,0 @@
import { sveltekit } from '@sveltejs/kit/vite';
import { defineConfig } from 'vite';
import { execSync } from 'child_process';
export default defineConfig({
plugins: [
sveltekit(),
{
name: 'generate-healthz',
buildStart() {
try {
execSync('node scripts/generate-healthz.js', { stdio: 'inherit' });
}
catch (error) {
console.warn('Failed to generate healthz.json:', error);
}
}
}
],
server: {
port: 5173,
strictPort: false
},
build: {
target: 'esnext',
sourcemap: true
}
});
//# sourceMappingURL=vite.config.js.map

1
vite.config.js.map

@ -1 +0,0 @@ @@ -1 +0,0 @@
{"version":3,"file":"vite.config.js","sourceRoot":"","sources":["vite.config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,MAAM,CAAC;AACpC,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC,eAAe,YAAY,CAAC;IAC1B,OAAO,EAAE;QACP,SAAS,EAAE;QACX;YACE,IAAI,EAAE,kBAAkB;YACxB,UAAU;gBACR,IAAI,CAAC;oBACH,QAAQ,CAAC,kCAAkC,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAC;gBACrE,CAAC;gBAAC,OAAO,KAAK,EAAE,CAAC;oBACf,OAAO,CAAC,IAAI,CAAC,kCAAkC,EAAE,KAAK,CAAC,CAAC;gBAC1D,CAAC;YACH,CAAC;SACF;KACF;IACD,MAAM,EAAE;QACN,IAAI,EAAE,IAAI;QACV,UAAU,EAAE,KAAK;KAClB;IACD,KAAK,EAAE;QACL,MAAM,EAAE,QAAQ;QAChB,SAAS,EAAE,IAAI;KAChB;CACF,CAAC,CAAC"}

20
vite.config.ts

@ -3,9 +3,26 @@ import { defineConfig } from 'vite'; @@ -3,9 +3,26 @@ import { defineConfig } from 'vite';
import { execSync } from 'child_process';
import { SvelteKitPWA } from '@vite-pwa/sveltekit';
import compression from 'vite-plugin-compression';
import { readFileSync } from 'fs';
import { join } from 'path';
// Read version from package.json for environment variable injection
function getPackageVersion(): string {
try {
const packageJsonPath = join(process.cwd(), 'package.json');
const packageJson = JSON.parse(readFileSync(packageJsonPath, 'utf-8'));
return packageJson.version || '0.3.2';
} catch {
return '0.3.2';
}
}
export default defineConfig({
publicDir: 'public',
publicDir: 'static',
define: {
// Inject version from package.json at build time
'import.meta.env.VITE_APP_VERSION': JSON.stringify(getPackageVersion()),
},
plugins: [
sveltekit(),
compression({
@ -23,6 +40,7 @@ export default defineConfig({ @@ -23,6 +40,7 @@ export default defineConfig({
registerType: 'autoUpdate',
workbox: {
globPatterns: ['**/*.{js,css,html,ico,png,svg,woff,woff2,webp,avif}'],
maximumFileSizeToCacheInBytes: 3 * 1024 * 1024, // 3 MB to handle large chunks
runtimeCaching: [
{
urlPattern: /^https:\/\/.*\.(?:png|jpg|jpeg|svg|gif|webp|avif)$/i,

Loading…
Cancel
Save