From 6c256f8a72b620ff4feee4dc047afaf99a3bd01e Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 8 May 2024 16:10:06 +0200 Subject: [PATCH 1/2] fix(deps): update dependency @types/node to v20.12.11 (#2125) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: FabianLars --- package.json | 9 +++++---- pnpm-lock.yaml | 6 +++--- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index cf9e0c51ad..ce60e94822 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,7 @@ "version": "0.0.1", "scripts": { "dev:setup:submodules": "git submodule update --init", - "dev:setup:tauri": "yarn --cwd packages/tauri/tooling/api", + "dev:setup:tauri": "pnpm install -C packages/tauri/tooling/api", "dev:setup:plugins-workspace": "pnpm --prefix packages/plugins-workspace install", "dev:setup": "pnpm dev:setup:submodules && pnpm dev:setup:tauri && pnpm dev:setup:plugins-workspace", "dev": "astro dev", @@ -20,11 +20,9 @@ "preview": "astro preview" }, "dependencies": { - "@astrojs/markdown-remark": "^4.2.1", - "@astrojs/starlight": "^0.20.1", - "@astrojs/rss": "^4.0.5", "@astrojs/markdown-remark": "^5.0.0", "@astrojs/starlight": "^0.22.0", + "@astrojs/rss": "^4.0.5", "@types/json-schema": "^7.0.15", "astro": "^4.4.4", "astro-feelback": "^0.3.4", @@ -38,6 +36,9 @@ "starlight-blog": "^0.7.0", "starlight-links-validator": "^0.8.0" }, + "engines": { + "pnpm": "^8.0.0" + }, "pnpm": { "patchedDependencies": { "typedoc-plugin-markdown@4.0.0-next.17": "patches/typedoc-plugin-markdown@4.0.0-next.17.patch" diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 804708efaf..a72bcbc87a 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -66,7 +66,7 @@ importers: version: 7.0.15 '@types/node': specifier: ^20.11.20 - version: 20.12.10 + version: 20.12.11 github-slugger: specifier: ^2.0.0 version: 2.0.0 @@ -1318,8 +1318,8 @@ packages: resolution: {integrity: sha512-w+tIMs3rq2afQdsPJlODhoUEKzFP1ayaoyl1CcnwtIlsVe7K7bA1NGm4s3PraqTLlXnbIN84zuBlxBWo1u9BLw==} dev: false - /@types/node@20.12.10: - resolution: {integrity: sha512-Eem5pH9pmWBHoGAT8Dr5fdc5rYA+4NAovdM4EktRPVAAiJhmWWfQrA0cFhAbOsQdSfIHjAud6YdkbL69+zSKjw==} + /@types/node@20.12.11: + resolution: {integrity: sha512-vDg9PZ/zi+Nqp6boSOT7plNuthRugEKixDv5sFTIpkE89MmNtEArAShI4mxuX2+UrLEe9pxC1vm2cjm9YlWbJw==} dependencies: undici-types: 5.26.5 dev: false From 7b72b462d9b9e5da21000b38b39e6d49ecae419b Mon Sep 17 00:00:00 2001 From: Fabian-Lars Date: Wed, 8 May 2024 16:16:18 +0200 Subject: [PATCH 2/2] docs: port sveltekit config guide (#2121) Co-authored-by: Vitor Ayres --- .../start/Frontend Configuration/svelte.mdx | 11 -- .../Frontend Configuration/sveltekit.mdx | 108 ++++++++++++++++++ 2 files changed, 108 insertions(+), 11 deletions(-) delete mode 100644 src/content/docs/start/Frontend Configuration/svelte.mdx create mode 100644 src/content/docs/start/Frontend Configuration/sveltekit.mdx diff --git a/src/content/docs/start/Frontend Configuration/svelte.mdx b/src/content/docs/start/Frontend Configuration/svelte.mdx deleted file mode 100644 index a1d54b5a91..0000000000 --- a/src/content/docs/start/Frontend Configuration/svelte.mdx +++ /dev/null @@ -1,11 +0,0 @@ ---- -title: Svelte -sidebar: - badge: - text: WIP - variant: caution ---- - -import Stub from '@components/Stub.astro'; - - diff --git a/src/content/docs/start/Frontend Configuration/sveltekit.mdx b/src/content/docs/start/Frontend Configuration/sveltekit.mdx new file mode 100644 index 0000000000..5c7a5ff25a --- /dev/null +++ b/src/content/docs/start/Frontend Configuration/sveltekit.mdx @@ -0,0 +1,108 @@ +--- +title: Svelte +i18nReady: true +--- + +import { Tabs, TabItem } from '@astrojs/starlight/components'; +import CommandTabs from '@components/CommandTabs.astro'; + +SvelteKit is a meta-framework for Svelte. Learn more about SvelteKit at https://kit.svelte.dev/. This guide is accurate as of SvelteKit 2.5.7 / Svelte 4.2.15. + +## Checklist + +- Use [SGG](https://kit.svelte.dev/docs/adapter-static) and/or [SPA](https://kit.svelte.dev/docs/single-page-apps) via `static-adapter`. Tauri doesn't support server-based solutions. +- Use `build/` as `frontendDist` in `tauri.conf.json`. + +## Example Configuration + +1. Install `@sveltejs/adapter-static`: + + + +2. Update Tauri configuration: + + + + +```json +// tauri.conf.json +{ + "build": { + "beforeDevCommand": "npm run dev", + "beforeBuildCommand": "npm run build", + "devUrl": "http://localhost:5173", + "frontendDist": "../build" + } +} +``` + + + + +```json +// tauri.conf.json +{ + "build": { + "beforeDevCommand": "yarn dev", + "beforeBuildCommand": "yarn build", + "devUrl": "http://localhost:5173", + "frontendDist": "../build" + } +} +``` + + + + +```json +// tauri.conf.json +{ + "build": { + "beforeDevCommand": "pnpm dev", + "beforeBuildCommand": "pnpm build", + "devUrl": "http://localhost:5173", + "frontendDist": "../build" + } +} +``` + + + + +3. Update SvelteKit configuration: + +```js title="svelte.config.js" {1} +import adapter from '@sveltejs/adapter-static'; +import { vitePreprocess } from '@sveltejs/vite-plugin-svelte'; + +/** @type {import('@sveltejs/kit').Config} */ +const config = { + // Consult https://kit.svelte.dev/docs/integrations#preprocessors + // for more information about preprocessors + preprocess: vitePreprocess(), + + kit: { + adapter: adapter(), + }, +}; + +export default config; +``` + +4. Disable SSR: + +Lastly, we need to disable SSR and enable prerendering by adding a root `+layout.ts` file (or `+layout.js` if you are not using TypeScript) with these contents: + +```ts +// src/routes/+layout.ts +export const prerender = true; +export const ssr = false; +``` + +Note that `static-adapter` doesn't require you to disable SSR for the whole app but it makes it possible to use APIs that depend on the global window object (like Tauri's API) without [Client-side checks](https://kit.svelte.dev/docs/faq#how-do-i-use-x-with-sveltekit-how-do-i-use-a-client-side-only-library-that-depends-on-document-or-window). + +Furthermore, if you prefer Single-Page Application (SPA) mode over SSG, you can change the adapter configurations and `+layout.ts` according to the [adapter docs](https://kit.svelte.dev/docs/single-page-apps).