From e21819017ec3159772dfb12cd7aba260bd03b526 Mon Sep 17 00:00:00 2001 From: Manuel Serret Date: Tue, 5 Nov 2024 19:32:35 +0100 Subject: [PATCH 1/6] docs: add `add-on` docs --- documentation/docs/30-add-ons/05-drizzle.md | 51 +++++++++++++++++++++ documentation/docs/30-add-ons/index.md | 3 ++ 2 files changed, 54 insertions(+) create mode 100644 documentation/docs/30-add-ons/05-drizzle.md create mode 100644 documentation/docs/30-add-ons/index.md diff --git a/documentation/docs/30-add-ons/05-drizzle.md b/documentation/docs/30-add-ons/05-drizzle.md new file mode 100644 index 00000000..50259910 --- /dev/null +++ b/documentation/docs/30-add-ons/05-drizzle.md @@ -0,0 +1,51 @@ +--- +title: drizzle +--- + +## Usage + +```bash +npx sv add drizzle +``` + +## Description + +[Drizzle ORM](https://orm.drizzle.team/) is a headless TypeScript ORM with a head. +Some short description about what drizzle is and what we set up + +## Options + +### database + +Which database variant to use: + +- `postgresql` — tbd +- `mysql` — tbd +- `sqlite` — runs everywhere, local database + +```bash +npx sv add --drizzle=postgresql +``` + +### client + +The sql client to use, depends on `database`: + +- For `postgresql`: `postgres.js`, `neon`, +- For `mysql`: `mysql2`, `planetscale` +- For `sqlite`: `better-sqlite3`, `libsql`, `turso` + +```bash +npx sv add --drizzle=postgresql,postgres.js +``` + +### docker + +Whether to add docker compose configuration. Only available for [`database`](#Options-database) `postgresql` or `mysql` + +- `docker` - generates `docker-compose.yml` +- `no-docker` - does not generate docker config + +```bash +npx sv add --drizzle=postgresql,postgres.js,docker +``` diff --git a/documentation/docs/30-add-ons/index.md b/documentation/docs/30-add-ons/index.md new file mode 100644 index 00000000..61874f22 --- /dev/null +++ b/documentation/docs/30-add-ons/index.md @@ -0,0 +1,3 @@ +--- +title: Add-ons +--- From 535b7725e0917ceb7bc6a16c71500d5a2b450190 Mon Sep 17 00:00:00 2001 From: Manuel <30698007+manuel3108@users.noreply.github.com> Date: Thu, 7 Nov 2024 16:18:22 +0100 Subject: [PATCH 2/6] Apply suggestions from code review Co-authored-by: Ben McCann <322311+benmccann@users.noreply.github.com> --- documentation/docs/30-add-ons/05-drizzle.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/documentation/docs/30-add-ons/05-drizzle.md b/documentation/docs/30-add-ons/05-drizzle.md index 50259910..635c3bdd 100644 --- a/documentation/docs/30-add-ons/05-drizzle.md +++ b/documentation/docs/30-add-ons/05-drizzle.md @@ -39,6 +39,8 @@ The sql client to use, depends on `database`: npx sv add --drizzle=postgresql,postgres.js ``` +Drizzle is compatible with well over a dozen database drivers. We just offer a few of the most common ones here for simplicity, but if you'd like to use another one you can choose one as a placeholder and swap it out for another after setup by choosing from [Drizzle's full list of compatible drivers](https://orm.drizzle.team/docs/connect-overview#next-steps). + ### docker Whether to add docker compose configuration. Only available for [`database`](#Options-database) `postgresql` or `mysql` From f92659b735789734e829ba6994692a4f0248830b Mon Sep 17 00:00:00 2001 From: Ben McCann <322311+benmccann@users.noreply.github.com> Date: Wed, 23 Apr 2025 09:40:22 -0700 Subject: [PATCH 3/6] docs: add-on docs --- documentation/docs/30-add-ons/05-drizzle.md | 22 ++++++----- documentation/docs/30-add-ons/10-eslint.md | 18 +++++++++ documentation/docs/30-add-ons/15-lucia.md | 26 +++++++++++++ documentation/docs/30-add-ons/20-mdsvex.md | 15 ++++++++ documentation/docs/30-add-ons/25-paraglide.md | 38 +++++++++++++++++++ .../docs/30-add-ons/30-playwright.md | 18 +++++++++ documentation/docs/30-add-ons/35-prettier.md | 17 +++++++++ documentation/docs/30-add-ons/40-storybook.md | 16 ++++++++ .../docs/30-add-ons/45-sveltekit-adapter.md | 32 ++++++++++++++++ documentation/docs/30-add-ons/50-tailwind.md | 31 +++++++++++++++ documentation/docs/30-add-ons/55-vitest.md | 17 +++++++++ 11 files changed, 241 insertions(+), 9 deletions(-) create mode 100644 documentation/docs/30-add-ons/10-eslint.md create mode 100644 documentation/docs/30-add-ons/15-lucia.md create mode 100644 documentation/docs/30-add-ons/20-mdsvex.md create mode 100644 documentation/docs/30-add-ons/25-paraglide.md create mode 100644 documentation/docs/30-add-ons/30-playwright.md create mode 100644 documentation/docs/30-add-ons/35-prettier.md create mode 100644 documentation/docs/30-add-ons/40-storybook.md create mode 100644 documentation/docs/30-add-ons/45-sveltekit-adapter.md create mode 100644 documentation/docs/30-add-ons/50-tailwind.md create mode 100644 documentation/docs/30-add-ons/55-vitest.md diff --git a/documentation/docs/30-add-ons/05-drizzle.md b/documentation/docs/30-add-ons/05-drizzle.md index 635c3bdd..ada637cc 100644 --- a/documentation/docs/30-add-ons/05-drizzle.md +++ b/documentation/docs/30-add-ons/05-drizzle.md @@ -2,16 +2,20 @@ title: drizzle --- +[Drizzle ORM](https://orm.drizzle.team/) is a TypeScript ORM offering both relational and SQL-like query APIs, and which is serverless-ready by design. + ## Usage ```bash npx sv add drizzle ``` -## Description +## What you get -[Drizzle ORM](https://orm.drizzle.team/) is a headless TypeScript ORM with a head. -Some short description about what drizzle is and what we set up +- a setup that keeps your database access in SvelteKit's server files +- an `.env` file to store your credentials +- compatibility with the Lucia auth add-on +- an optional Docker configuration to help with running a local database ## Options @@ -19,9 +23,9 @@ Some short description about what drizzle is and what we set up Which database variant to use: -- `postgresql` — tbd -- `mysql` — tbd -- `sqlite` — runs everywhere, local database +- `postgresql` — the most popular open source database +- `mysql` — another popular open source database +- `sqlite` — file-based database not requiring a database server ```bash npx sv add --drizzle=postgresql @@ -29,21 +33,21 @@ npx sv add --drizzle=postgresql ### client -The sql client to use, depends on `database`: +The SQL client to use, depends on `database`: - For `postgresql`: `postgres.js`, `neon`, - For `mysql`: `mysql2`, `planetscale` - For `sqlite`: `better-sqlite3`, `libsql`, `turso` ```bash -npx sv add --drizzle=postgresql,postgres.js +npx sv add --drizzle=postgresql;postgres.js ``` Drizzle is compatible with well over a dozen database drivers. We just offer a few of the most common ones here for simplicity, but if you'd like to use another one you can choose one as a placeholder and swap it out for another after setup by choosing from [Drizzle's full list of compatible drivers](https://orm.drizzle.team/docs/connect-overview#next-steps). ### docker -Whether to add docker compose configuration. Only available for [`database`](#Options-database) `postgresql` or `mysql` +Whether to add Docker Compose configuration. Only available for [`database`](#Options-database) `postgresql` or `mysql` - `docker` - generates `docker-compose.yml` - `no-docker` - does not generate docker config diff --git a/documentation/docs/30-add-ons/10-eslint.md b/documentation/docs/30-add-ons/10-eslint.md new file mode 100644 index 00000000..318bb504 --- /dev/null +++ b/documentation/docs/30-add-ons/10-eslint.md @@ -0,0 +1,18 @@ +--- +title: eslint +--- + +[ESLint](https://eslint.org/) finds and fixes problems in your code. + +## Usage + +```bash +npx sv add eslint +``` + +## What you get + +- the relevant packages installed including `eslint-plugin-svelte` +- an `eslint.config.js` file +- updated `.vscode/settings.json` +- configured to work with TypeScript and `prettier` if you're using those packages diff --git a/documentation/docs/30-add-ons/15-lucia.md b/documentation/docs/30-add-ons/15-lucia.md new file mode 100644 index 00000000..2eb21f9e --- /dev/null +++ b/documentation/docs/30-add-ons/15-lucia.md @@ -0,0 +1,26 @@ +--- +title: lucia +--- + +An auth setup following [the Lucia auth guide](https://lucia-auth.com/). + +## Usage + +```bash +npx sv add lucia +``` + +## What you get + +- an auth setup for SvelteKit and Drizzle following the best practices from the Lucia auth guide +- optional demo registration and login pages + +## Options + +### demo + +Whether to include demo registration and login pages. + +```bash +npx sv add --lucia=demo +``` diff --git a/documentation/docs/30-add-ons/20-mdsvex.md b/documentation/docs/30-add-ons/20-mdsvex.md new file mode 100644 index 00000000..00b95c45 --- /dev/null +++ b/documentation/docs/30-add-ons/20-mdsvex.md @@ -0,0 +1,15 @@ +--- +title: mdsvex +--- + +[mdsvex](https://mdsvex.pngwn.io) is a markdown preprocessor for Svelte components - basically MDX for Svelte. It allows you to use Svelte components in your markdown, or markdown in your Svelte components. + +## Usage + +```bash +npx sv add mdsvex +``` + +## What you get + +- mdsvex installed and configured in your `svelte.config.js` diff --git a/documentation/docs/30-add-ons/25-paraglide.md b/documentation/docs/30-add-ons/25-paraglide.md new file mode 100644 index 00000000..da910655 --- /dev/null +++ b/documentation/docs/30-add-ons/25-paraglide.md @@ -0,0 +1,38 @@ +--- +title: paraglide +--- + +[Paraglide from Inlang](https://inlang.com/m/gerre34r/library-inlang-paraglideJs) is a compiler-based i18n library that emits tree-shakable message functions with small bundle sizes, no async waterfalls, full type-safety, and more. + +## Usage + +```bash +npx sv add paraglide +``` + +## What you get + +- Inlang project settings +- paraglide Vite plugin +- SvelteKit `reroute` and `handle` hooks +- `text-direction` and `lang` attributes in `app.html` +- updated `.gitignore` +- an optional demo page showing how to use paraglide + +## Options + +### availableLanguageTags + +The languages you'd like to support specified as IETF BCP 47 language tags. + +```bash +npx sv add --availableLanguageTags=en,es +``` + +### demo + +Whether to generate an optional demo page showing how to use paraglide. + +```bash +npx sv add --paraglide=demo +``` diff --git a/documentation/docs/30-add-ons/30-playwright.md b/documentation/docs/30-add-ons/30-playwright.md new file mode 100644 index 00000000..0c16d86f --- /dev/null +++ b/documentation/docs/30-add-ons/30-playwright.md @@ -0,0 +1,18 @@ +--- +title: playwright +--- + +[Playwright](https://playwright.dev) browser testing. + +## Usage + +```bash +npx sv add playwright +``` + +## What you get + +- scripts added in your `package.json` +- a Playwright config file +- an updated `.gitignore` +- a demo test diff --git a/documentation/docs/30-add-ons/35-prettier.md b/documentation/docs/30-add-ons/35-prettier.md new file mode 100644 index 00000000..68014ae4 --- /dev/null +++ b/documentation/docs/30-add-ons/35-prettier.md @@ -0,0 +1,17 @@ +--- +title: prettier +--- + +[Prettier](https://prettier.io) is an opinionated code formatter. + +## Usage + +```bash +npx sv add prettier +``` + +## What you get + +- scripts in your `package.json` +- `.prettierignore` and `.prettierrc` files +- updates to your eslint config if you're using that package diff --git a/documentation/docs/30-add-ons/40-storybook.md b/documentation/docs/30-add-ons/40-storybook.md new file mode 100644 index 00000000..9ba57adb --- /dev/null +++ b/documentation/docs/30-add-ons/40-storybook.md @@ -0,0 +1,16 @@ +--- +title: storybook +--- + +[Storybook](https://storybook.js.org/) is a frontend component workshop. + +## Usage + +```bash +npx sv add storybook +``` + +## What you get + +- `npx storybook init` run for you from the same convenient `sv` CLI used for all other add-ons +- [Storybook for SvelteKit](https://storybook.js.org/docs/get-started/frameworks/sveltekit) or [Storybook for Svelte & Vite](https://storybook.js.org/docs/get-started/frameworks/svelte-vite) with default config provided, easy mocking of many SvelteKit modules, automatic link handling, and more. diff --git a/documentation/docs/30-add-ons/45-sveltekit-adapter.md b/documentation/docs/30-add-ons/45-sveltekit-adapter.md new file mode 100644 index 00000000..d9012752 --- /dev/null +++ b/documentation/docs/30-add-ons/45-sveltekit-adapter.md @@ -0,0 +1,32 @@ +--- +title: sveltekit-adapter +--- + +[SvelteKit adapters](/docs/kit/adapters) allow you to deploy your site to numerous platforms. This add-on allows you to configure officially provided SvelteKit adapters, but a number of [community-provided adapters](https://www.sveltesociety.dev/packages?category=sveltekit-adapters) are also available. + +## Usage + +```bash +npx sv add sveltekit-adapter +``` + +## What you get + +- the chosen SvelteKit adapter installed and configured in your `svelte.config.js` + +## Options + +### adapter + +Which SvelteKit adapter to use: + +- `auto` — [`@sveltejs/adapter-auto`](/docs/kit/adapter-auto) automatically chooses the proper adapter to use, but is less configurable +- `node` — [`@sveltejs/adapter-node`](/docs/kit/adapter-node) generates a standalone Node server +- `static` — [`@sveltejs/adapter-static`](/docs/kit/adapter-static) allows you to use SvelteKit as a static site generator (SSG) +- `vercel` — [`@sveltejs/adapter-vercel`](/docs/kit/adapter-vercel) allows you to deploy to Vercel +- `cloudflare` — [`@sveltejs/adapter-cloudflare`](/docs/kit/adapter-cloudflare) allows you to deploy to Cloudflare +- `netlify` — [`@sveltejs/adapter-netlify`](/docs/kit/adapter-netlify) allows you to deploy to Netlify + +```bash +npx sv add --sveltekit-adapter=node +``` diff --git a/documentation/docs/30-add-ons/50-tailwind.md b/documentation/docs/30-add-ons/50-tailwind.md new file mode 100644 index 00000000..9d357387 --- /dev/null +++ b/documentation/docs/30-add-ons/50-tailwind.md @@ -0,0 +1,31 @@ +--- +title: tailwindcss +--- + +[Tailwind CSS](https://tailwindcss.com/) allows you to rapidly build modern websites without ever leaving your HTML. + +## Usage + +```bash +npx sv add tailwindcss +``` + +## What you get + +- Tailwind setup following the [Tailwind for SvelteKit guide](https://tailwindcss.com/docs/installation/framework-guides/sveltekit) +- Tailwind Vite plugin +- updated `app.css` and `+layout.svelte` (for SvelteKit) or `App.svelte` (for non-SvelteKit Vite apps) +- integration with `prettier` if using that package + +## Options + +### plugins + +Which database variant to use: + +- `typography` — [`@tailwindcss/typography`](https://github.com/tailwindlabs/tailwindcss-typography) +- `forms` — [`@tailwindcss/forms`](https://github.com/tailwindlabs/tailwindcss-forms) + +```bash +npx sv add --tailwindcss=typography +``` diff --git a/documentation/docs/30-add-ons/55-vitest.md b/documentation/docs/30-add-ons/55-vitest.md new file mode 100644 index 00000000..e2ee77c6 --- /dev/null +++ b/documentation/docs/30-add-ons/55-vitest.md @@ -0,0 +1,17 @@ +--- +title: vitest +--- + +[Vitest](https://vitest.dev/) is a Vite-native testing framework. + +## Usage + +```bash +npx sv add vitest +``` + +## What you get + +- the relevant packages installed and scripts added to your `package.json` +- client/server-aware testing setup for Svelte in your Vite config file +- demo tests From 72d18dfd6136b4344da9da39b3069f560b6fcfb1 Mon Sep 17 00:00:00 2001 From: Ben McCann <322311+benmccann@users.noreply.github.com> Date: Thu, 24 Apr 2025 14:14:43 -0700 Subject: [PATCH 4/6] Update documentation/docs/30-add-ons/05-drizzle.md Co-authored-by: Manuel <30698007+manuel3108@users.noreply.github.com> --- documentation/docs/30-add-ons/05-drizzle.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/documentation/docs/30-add-ons/05-drizzle.md b/documentation/docs/30-add-ons/05-drizzle.md index ada637cc..7cf06ca9 100644 --- a/documentation/docs/30-add-ons/05-drizzle.md +++ b/documentation/docs/30-add-ons/05-drizzle.md @@ -40,7 +40,7 @@ The SQL client to use, depends on `database`: - For `sqlite`: `better-sqlite3`, `libsql`, `turso` ```bash -npx sv add --drizzle=postgresql;postgres.js +npx sv add --drizzle=postgresql,postgres.js ``` Drizzle is compatible with well over a dozen database drivers. We just offer a few of the most common ones here for simplicity, but if you'd like to use another one you can choose one as a placeholder and swap it out for another after setup by choosing from [Drizzle's full list of compatible drivers](https://orm.drizzle.team/docs/connect-overview#next-steps). From c96dd0dab18daa23b6f56a0ed7d59a69e9a1d92c Mon Sep 17 00:00:00 2001 From: Ben McCann <322311+benmccann@users.noreply.github.com> Date: Thu, 24 Apr 2025 14:15:00 -0700 Subject: [PATCH 5/6] Update documentation/docs/30-add-ons/50-tailwind.md Co-authored-by: Manuel <30698007+manuel3108@users.noreply.github.com> --- documentation/docs/30-add-ons/50-tailwind.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/documentation/docs/30-add-ons/50-tailwind.md b/documentation/docs/30-add-ons/50-tailwind.md index 9d357387..1b454a22 100644 --- a/documentation/docs/30-add-ons/50-tailwind.md +++ b/documentation/docs/30-add-ons/50-tailwind.md @@ -21,7 +21,7 @@ npx sv add tailwindcss ### plugins -Which database variant to use: +Which plugin to use: - `typography` — [`@tailwindcss/typography`](https://github.com/tailwindlabs/tailwindcss-typography) - `forms` — [`@tailwindcss/forms`](https://github.com/tailwindlabs/tailwindcss-forms) From e5caf16087bfaeae22734cc907bb5cae5710f13b Mon Sep 17 00:00:00 2001 From: Ben McCann <322311+benmccann@users.noreply.github.com> Date: Fri, 25 Apr 2025 11:52:58 -0700 Subject: [PATCH 6/6] Update documentation/docs/30-add-ons/25-paraglide.md Co-authored-by: Manuel <30698007+manuel3108@users.noreply.github.com> --- documentation/docs/30-add-ons/25-paraglide.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/documentation/docs/30-add-ons/25-paraglide.md b/documentation/docs/30-add-ons/25-paraglide.md index da910655..be006f27 100644 --- a/documentation/docs/30-add-ons/25-paraglide.md +++ b/documentation/docs/30-add-ons/25-paraglide.md @@ -26,7 +26,7 @@ npx sv add paraglide The languages you'd like to support specified as IETF BCP 47 language tags. ```bash -npx sv add --availableLanguageTags=en,es +npx sv add --paraglide=en,es ``` ### demo