Skip to content

feat: specify add-on options in command args #543

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
9 changes: 3 additions & 6 deletions documentation/docs/30-add-ons/05-drizzle.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Which database variant to use:
- `sqlite` — file-based database not requiring a database server

```bash
npx sv add --drizzle=postgresql
npx sv add drizzle=database:postgresql
```

### client
Expand All @@ -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=database:postgresql+client: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).
Expand All @@ -49,9 +49,6 @@ Drizzle is compatible with well over a dozen database drivers. We just offer a f

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
npx sv add drizzle=database:postgresql+client:postgres.js+docker:yes
```
2 changes: 1 addition & 1 deletion documentation/docs/30-add-ons/15-lucia.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@ npx sv add lucia
Whether to include demo registration and login pages.

```bash
npx sv add --lucia=demo
npx sv add lucia=demo:yes
```
6 changes: 3 additions & 3 deletions documentation/docs/30-add-ons/25-paraglide.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,18 @@ npx sv add paraglide

## Options

### availableLanguageTags
### languageTags

The languages you'd like to support specified as IETF BCP 47 language tags.

```bash
npx sv add --paraglide=en,es
npx sv add paraglide="languageTags:en,es"
```

### demo

Whether to generate an optional demo page showing how to use paraglide.

```bash
npx sv add --paraglide=demo
npx sv add paraglide="demo:yes"
```
2 changes: 1 addition & 1 deletion documentation/docs/30-add-ons/45-sveltekit-adapter.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,5 @@ Which SvelteKit adapter to use:
- `netlify` — [`@sveltejs/adapter-netlify`](/docs/kit/adapter-netlify) allows you to deploy to Netlify

```bash
npx sv add --sveltekit-adapter=node
npx sv add sveltekit-adapter=adapter:node
```
2 changes: 1 addition & 1 deletion documentation/docs/30-add-ons/50-tailwind.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,5 @@ Which plugin to use:
- `forms` — [`@tailwindcss/forms`](https://github.com/tailwindlabs/tailwindcss-forms)

```bash
npx sv add --tailwindcss=typography
npx sv add tailwindcss="plugins:typography"
```
2 changes: 1 addition & 1 deletion packages/addons/_tests/paraglide/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const { test, variants, prepareServer } = setupTest({ paraglide });

const kitOnly = variants.filter((v) => v.includes('kit'));
test.concurrent.for(kitOnly)('core - %s', async (variant, { page, ...ctx }) => {
const cwd = await ctx.run(variant, { paraglide: { demo: true, availableLanguageTags: 'en' } });
const cwd = await ctx.run(variant, { paraglide: { demo: true, languageTags: 'en' } });

const { close } = await prepareServer({ cwd, page });
// kill server process when we're done
Expand Down
8 changes: 4 additions & 4 deletions packages/addons/paraglide/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const DEFAULT_INLANG_PROJECT = {
};

const options = defineAddonOptions({
availableLanguageTags: {
languageTags: {
question: `Which languages would you like to support? ${colors.gray('(e.g. en,de-ch)')}`,
type: 'string',
default: 'en, es',
Expand Down Expand Up @@ -78,7 +78,7 @@ export default defineAddon({
for (const key in DEFAULT_INLANG_PROJECT) {
data[key] = DEFAULT_INLANG_PROJECT[key as keyof typeof DEFAULT_INLANG_PROJECT];
}
const { validLanguageTags } = parseLanguageTagInput(options.availableLanguageTags);
const { validLanguageTags } = parseLanguageTagInput(options.languageTags);
const baseLocale = validLanguageTags[0];

data.baseLocale = baseLocale;
Expand Down Expand Up @@ -205,7 +205,7 @@ export default defineAddon({

// add links to other localized pages, the first one is the default
// language, thus it does not require any localized route
const { validLanguageTags } = parseLanguageTagInput(options.availableLanguageTags);
const { validLanguageTags } = parseLanguageTagInput(options.languageTags);
const links = validLanguageTags
.map(
(x) =>
Expand All @@ -222,7 +222,7 @@ export default defineAddon({
});
}

const { validLanguageTags } = parseLanguageTagInput(options.availableLanguageTags);
const { validLanguageTags } = parseLanguageTagInput(options.languageTags);
for (const languageTag of validLanguageTags) {
sv.file(`messages/${languageTag}.json`, (content) => {
const { data, generateCode } = parseJson(content);
Expand Down
Loading