Skip to content
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

feat: add --add-ons option in sv create #333

Open
hyunbinseo opened this issue Nov 27, 2024 · 1 comment
Open

feat: add --add-ons option in sv create #333

hyunbinseo opened this issue Nov 27, 2024 · 1 comment
Labels
enhancement New feature or request pkg:add sv add

Comments

@hyunbinseo
Copy link
Contributor

It is currently impossible to include add-ons without interactive user input.

pnpm dlx sv create --template minimal --types ts --no-install ts

# ┌  Welcome to the Svelte CLI! (v0.6.5)
#
# ◆  Project created
#
# ◆  What would you like to add to your project? (use arrow keys / space bar)
# │  ◻ prettier (formatter - https://prettier.io)
# │  ◻ eslint
# │  ◻ vitest
# │  ◻ playwright
# │  ◻ tailwindcss
# │  ◻ drizzle
# │  ◻ lucia
# │  ◻ mdsvex
# │  ◻ paraglide
# │  ◻ storybook
#

create-svelte provided API, so the following was possible:

/** @param {'checkjs' | 'typescript'} type */
const generateOptions = (type) =>
  /** @type {const} */ ({
    types: type,
    name: `svelte-kit-${type}`,
    template: 'skeleton', // or 'default' or 'skeletonlib'
    prettier: true,
    eslint: true,
    playwright: false,
    vitest: false,
  });

https://github.com/hyunbinseo/svelte-kit-templates/blob/v6.4.0/index.js#L4-L14

Workaround

pnpm dlx sv create --template minimal --types ts --no-install --no-add-ons ts
pnpm dlx sv add --no-install --cwd ts eslint prettier
@AdrianGonz97
Copy link
Member

We've discussed this before when we were implementing both create and add (though, i'm having a hard time finding the conversation here, so it may have been in private), but the 'workaround' is the intended solution:

sv create . --template minimal --types ts --no-install --no-add-ons && sv add --drizzle --lucia

Since create and add are two very different tasks, they can easily be combined with a simple && operator if you really want a single-liner.

create-svelte provided API, so the following was possible:

A comparable api for this is still being worked on. For now, sv exports create and installAddon, but they're api is not finalized and can change at any moment.

@manuel3108 manuel3108 added enhancement New feature or request pkg:add sv add labels Nov 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request pkg:add sv add
Projects
None yet
Development

No branches or pull requests

3 participants