Skip to content

Commit

Permalink
Merge pull request #2 from NovusInnovation/static-adapter
Browse files Browse the repository at this point in the history
Use static adapter with plugin-dynamic-import-vars
  • Loading branch information
Ell1ott authored Jun 22, 2024
2 parents 553ca63 + 06101a1 commit 4c19b3d
Show file tree
Hide file tree
Showing 12 changed files with 146 additions and 151 deletions.
Binary file modified bun.lockb
Binary file not shown.
36 changes: 18 additions & 18 deletions messages/dk.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
{
"$schema": "https://inlang.com/schema/inlang-message-format",
"navbar_about": "Om os",
"navbar_contact": "Kontakt",
"navbar_home": "Home",
"navbar_projects": "Projekter",
"contact_us": "Kontakt os",
"contact_send_message": "Send besked",
"about_us_expanded": "Har du spørgsmål, ris eller ros? Så tøv ikke med at kontakte os! Vi vil gøre vores bedste for at besvare din henvendelse hurtigst muligt.",
"welcome": "Velkommen til Novus Group",
"first_name": "Fornavn",
"last_name": "Efternavn",
"email": "Email",
"message": "Besked",
"message_confirm": "Tak for din henvendelse. Vi vender tilbage hurtigst muligt.",
"message_confirm_title": "Din besked er blevet sendt.",
"rights_reserved": "Alle rettigheder forbeholdt",
"about_us": "Vi er en gruppe på 4 udviklere dedikeret til at forme fremtidens teknologi. Vi har udviklet flere tekniske løsninger og vundet forskellige priser. Sammen bygger vi komplette end-to-end løsninger. Vores løsninger spænder fra webudvikling til mobilapplikationer og videospil."
}
"$schema": "https://inlang.com/schema/inlang-message-format",
"navbar_about": "Om os",
"navbar_contact": "Kontakt",
"navbar_home": "Hjem",
"navbar_projects": "Projekter",
"contact_us": "Kontakt os",
"contact_send_message": "Send besked",
"about_us_expanded": "Har du spørgsmål, ris eller ros? Så tøv ikke med at kontakte os! Vi vil gøre vores bedste for at besvare din henvendelse hurtigst muligt.",
"welcome": "Velkommen til Novus Group",
"first_name": "Fornavn",
"last_name": "Efternavn",
"email": "Email",
"message": "Besked",
"message_confirm": "Tak for din henvendelse. Vi vender tilbage hurtigst muligt.",
"message_confirm_title": "Din besked er blevet sendt.",
"rights_reserved": "Alle rettigheder forbeholdt",
"about_us": "Vi er en gruppe på 4 udviklere dedikeret til at forme fremtidens teknologi. Vi har udviklet flere tekniske løsninger og vundet forskellige priser. Sammen bygger vi komplette end-to-end løsninger. Vores løsninger spænder fra webudvikling til mobilapplikationer og videospil."
}
76 changes: 72 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 4 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,15 @@
"scripts": {
"dev": "vite dev",
"build": "vite build",
"preview": "npm run build && wrangler pages dev",
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
"lint": "eslint .",
"deploy": "npm run build && wrangler pages deploy",
"cf-typegen": "wrangler types && mv worker-configuration.d.ts src/",
"postbuild": "npx svelte-sitemap --out-dir .svelte-kit/cloudflare --domain https://novusgroup.dk/ --debug"
"postbuild": "npx svelte-sitemap --domain https://novusgroup.dk/"
},
"devDependencies": {
"@cloudflare/workers-types": "^4.20240605.0",
"@inlang/paraglide-js": "1.9.1",
"@sveltejs/adapter-cloudflare": "^4.4.1",
"@rollup/plugin-dynamic-import-vars": "^2.1.2",
"@sveltejs/adapter-static": "^3.0.2",
"@sveltejs/kit": "^2.0.0",
"@sveltejs/vite-plugin-svelte": "^3.0.0",
"@types/eslint": "^8.56.7",
Expand All @@ -35,8 +32,7 @@
"tslib": "^2.4.1",
"typescript": "^5.0.0",
"typescript-eslint": "^8.0.0-alpha.20",
"vite": "^5.0.3",
"wrangler": "^3.60.3"
"vite": "^5.0.3"
},
"type": "module",
"dependencies": {
Expand Down
4 changes: 2 additions & 2 deletions src/lib/components/footer.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
<li>
<a href="/about" class="hover:underline me-4 md:me-6">{m.navbar_about()}</a>
</li>
<li>
<!-- <li>
<a href="/projects" class="hover:underline me-4 md:me-6">{m.navbar_projects()}</a>
</li>
</li> -->
<li>
<a href="/contact" class="hover:underline">{m.navbar_contact()}</a>
</li>
Expand Down
2 changes: 1 addition & 1 deletion src/lib/components/header.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<ul class="flex flex-row mt-4 gap-5 items-center">
<li><a href="/">{m.navbar_home()}</a></li>
<li><a href="/about">{m.navbar_about()}</a></li>
<li><a href="/projects">{m.navbar_projects()}</a></li>
<!-- <li><a href="/projects">{m.navbar_projects()}</a></li> -->
<li><a href="/contact">{m.navbar_contact()}</a></li>
<ThemeSwitcher />
<LanguageSwitcher />
Expand Down
28 changes: 14 additions & 14 deletions src/routes/+layout.svelte
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
<script>
import { ParaglideJS } from '@inlang/paraglide-sveltekit'
import { i18n } from '$lib/i18n'
import { ModeWatcher } from 'mode-watcher';
import { ParaglideJS } from '@inlang/paraglide-sveltekit';
import { i18n } from '$lib/i18n';
import { ModeWatcher } from 'mode-watcher';
import Footer from "$lib/components/footer.svelte";
import Header from "$lib/components/header.svelte";
import '../app.css';
import Footer from '$lib/components/footer.svelte';
import Header from '$lib/components/header.svelte';
import '../app.css';
</script>

<ModeWatcher />

<ParaglideJS {i18n}>
<main class="min-h-screen w-screen flex flex-col">
<Header />
<div class="max-w-screen-xl mx-auto flex-1 px-24">
<slot />
</div>
<Footer />
</main>
</ParaglideJS>
<main class="min-h-screen w-screen flex flex-col">
<Header />
<div class="max-w-screen-xl mx-auto flex-1 px-24">
<slot />
</div>
<Footer />
</main>
</ParaglideJS>
1 change: 1 addition & 0 deletions src/routes/+layout.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const prerender = true;
28 changes: 14 additions & 14 deletions src/routes/projects/[project]/+page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,20 @@ import { error } from '@sveltejs/kit';
import { languageTag } from '$lib/paraglide/runtime.js';

export async function load({ params, depends }) {
const project = params.project;
depends("paraglide:lang");
const project = params.project;
depends('paraglide:lang');

try {
const lang = languageTag();
const data = (await import('../../../lib/projects/' + project + "_" + lang + '.md'));
const metadata = data.metadata;
try {
const lang = languageTag();
const data = await import(`../../../lib/projects/${project}_${lang}.md`);
const metadata = data.metadata;

return {
content: data.default,
title: metadata.title
}
} catch (e) {
console.error(e);
return error(404, 'Not found');
}
return {
content: data.default,
title: metadata.title
};
} catch (e) {
console.error(e);
return error(404, 'Not found');
}
}
13 changes: 11 additions & 2 deletions svelte.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import adapter from '@sveltejs/adapter-cloudflare';
import adapter from '@sveltejs/adapter-static';
import { vitePreprocess } from '@sveltejs/vite-plugin-svelte';
import { mdsvex } from 'mdsvex';

Expand All @@ -18,7 +18,16 @@ const config = {
// adapter-auto only supports some environments, see https://kit.svelte.dev/docs/adapter-auto for a list.
// If your environment is not supported, or you settled on a specific environment, switch out the adapter.
// See https://kit.svelte.dev/docs/adapters for more information about adapters.
adapter: adapter({ routes: { include: ['/*'], exclude: ['<all>', '/sitemap.xml'] } }),
// adapter: adapter({ routes: { include: ['/*'], exclude: ['<all>', '/sitemap.xml'] } }),
adapter: adapter({
// default options are shown. On some platforms
// these options are set automatically — see below
pages: 'build',
assets: 'build',
fallback: undefined,
precompress: false,
strict: true
}),
alias: {
$paraglide: './src/paraglide/',
$components: './src/components',
Expand Down
11 changes: 8 additions & 3 deletions vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
import { paraglide } from '@inlang/paraglide-sveltekit/vite'
import { paraglide } from '@inlang/paraglide-sveltekit/vite';
import { sveltekit } from '@sveltejs/kit/vite';
import { defineConfig } from 'vite';
import dynamicImportVars from '@rollup/plugin-dynamic-import-vars';

export default defineConfig({
plugins: [
paraglide({ project: './project.inlang', outdir: './src/lib/paraglide' }),
sveltekit()
]
sveltekit(),
dynamicImportVars({
include: './src/routes/projects/*/*.ts'
})
],
assetsInclude: ['../lib/projects/*.md']
});
Loading

0 comments on commit 4c19b3d

Please sign in to comment.