This commit is contained in:
Ilia Denisov
2026-05-07 07:18:55 +02:00
parent 7af57933eb
commit 7cc18159e9
20 changed files with 2090 additions and 12 deletions
+1
View File
@@ -0,0 +1 @@
engine-strict=true
+27
View File
@@ -0,0 +1,27 @@
{
"name": "galaxy-ui-frontend",
"version": "0.0.1",
"private": true,
"type": "module",
"scripts": {
"dev": "vite dev",
"build": "vite build",
"preview": "vite preview",
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
"test": "vitest run"
},
"devDependencies": {
"@sveltejs/adapter-static": "^3.0.0",
"@sveltejs/kit": "^2.59.0",
"@sveltejs/vite-plugin-svelte": "^7.0.0",
"@testing-library/svelte": "^5.2.0",
"@types/node": "^22.0.0",
"jsdom": "^25.0.0",
"svelte": "^5.0.0",
"svelte-check": "^4.0.0",
"tslib": "^2.6.0",
"typescript": "^5.5.0",
"vite": "^8.0.0",
"vitest": "^4.0.0"
}
}
+10
View File
@@ -0,0 +1,10 @@
declare global {
// Build-time constant injected by Vite from package.json version.
const __APP_VERSION__: string;
namespace App {
// future-phase types added later
}
}
export {};
+13
View File
@@ -0,0 +1,13 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="%sveltekit.assets%/favicon.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Galaxy</title>
%sveltekit.head%
</head>
<body data-sveltekit-preload-data="hover">
<div style="display: contents">%sveltekit.body%</div>
</body>
</html>
+3
View File
@@ -0,0 +1,3 @@
// APP_VERSION is the package.json "version" field, inlined at build time
// by the Vite `define` plugin (see vite.config.ts).
export const APP_VERSION: string = __APP_VERSION__;
+5
View File
@@ -0,0 +1,5 @@
<script lang="ts">
let { children } = $props();
</script>
{@render children()}
+22
View File
@@ -0,0 +1,22 @@
<script lang="ts">
import { APP_VERSION } from "$lib/version";
</script>
<main>
<h1>Galaxy</h1>
<p>Cross-platform UI client — workspace skeleton.</p>
</main>
<footer data-testid="app-version">version {APP_VERSION}</footer>
<style>
main {
padding: 2rem;
font-family: system-ui, sans-serif;
}
footer {
padding: 1rem 2rem;
opacity: 0.6;
font-size: 0.875rem;
}
</style>
+1
View File
@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><circle cx="16" cy="16" r="14" fill="#1f2937"/><circle cx="16" cy="16" r="3" fill="#fbbf24"/></svg>

After

Width:  |  Height:  |  Size: 160 B

+15
View File
@@ -0,0 +1,15 @@
import adapter from "@sveltejs/adapter-static";
import { vitePreprocess } from "@sveltejs/vite-plugin-svelte";
/** @type {import('@sveltejs/kit').Config} */
export default {
preprocess: vitePreprocess(),
kit: {
adapter: adapter({
pages: "build",
assets: "build",
fallback: "index.html",
strict: true,
}),
},
};
+12
View File
@@ -0,0 +1,12 @@
import { render } from "@testing-library/svelte";
import { describe, expect, it } from "vitest";
import Page from "../src/routes/+page.svelte";
describe("landing page", () => {
it("renders a non-empty version string in the footer", () => {
const { getByTestId } = render(Page);
const footer = getByTestId("app-version");
expect(footer.textContent?.trim()).not.toBe("");
expect(footer.textContent).toMatch(/version\s+\S+/);
});
});
+14
View File
@@ -0,0 +1,14 @@
{
"extends": "./.svelte-kit/tsconfig.json",
"compilerOptions": {
"allowJs": true,
"checkJs": true,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"resolveJsonModule": true,
"skipLibCheck": true,
"sourceMap": true,
"strict": true,
"moduleResolution": "bundler"
}
}
+18
View File
@@ -0,0 +1,18 @@
import { sveltekit } from "@sveltejs/kit/vite";
import { defineConfig } from "vite";
import { readFileSync } from "node:fs";
import { fileURLToPath } from "node:url";
const pkg = JSON.parse(
readFileSync(
fileURLToPath(new URL("./package.json", import.meta.url)),
"utf8",
),
) as { version: string };
export default defineConfig({
plugins: [sveltekit()],
define: {
__APP_VERSION__: JSON.stringify(pkg.version),
},
});
+17
View File
@@ -0,0 +1,17 @@
import { defineConfig, mergeConfig } from "vitest/config";
import viteConfig from "./vite.config";
export default mergeConfig(
viteConfig,
defineConfig({
resolve: {
// Force the browser entry of Svelte so `mount` is available in jsdom.
conditions: ["browser"],
},
test: {
environment: "jsdom",
include: ["tests/**/*.test.ts"],
globals: true,
},
}),
);