-
-
Notifications
You must be signed in to change notification settings - Fork 187
sv blog post #623
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
Merged
Merged
sv blog post #623
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
06cc6e7
sv blog post
Rich-Harris a65f86b
link
Rich-Harris ab9cba2
tweaks
Rich-Harris af49a5b
tweak
Rich-Harris ea0f1b1
Update apps/svelte.dev/content/blog/2024-10-24-sv-the-svelte-cli.md
Rich-Harris 80bca34
Update apps/svelte.dev/content/blog/2024-10-24-sv-the-svelte-cli.md
dummdidumm fbb9cc5
tweaks
Rich-Harris File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
72 changes: 72 additions & 0 deletions
72
apps/svelte.dev/content/blog/2024-10-24-sv-the-svelte-cli.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
--- | ||
title: Introducing the new Svelte CLI | ||
description: Tailwind, auth, databases and more — just an `npx sv` away | ||
author: Ben McCann | ||
authorURL: https://www.benmccann.com/ | ||
--- | ||
|
||
We’ve just released [sv](https://npmjs.com/package/sv), a new Command Line Interface (CLI) for creating, enhancing, and upgrading Svelte projects. | ||
|
||
One of the most common question we hear is "how do I set up Tailwind on my new project?". Tailwind has [SvelteKit documentation](https://tailwindcss.com/docs/guides/sveltekit), but it lists eight steps. While the community-led `svelte-add` project could automate the process, few knew about it. | ||
|
||
<div class="max"> | ||
<figure style="max-width: 960px; margin: 0 auto"> | ||
<div style="aspect-ratio: 1.777777778; position: relative; margin: 0 auto;"> | ||
<iframe style="position: absolute; width: 100%; height: 100%; left: 0; top: 0; margin: 0;" src="https://www.youtube.com/embed/fAPFsRP-mbc?si=oD7SoqDd6FGr0uD3&start=11743" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe> | ||
</div> | ||
|
||
<figcaption>Introducing <code>sv</code> at <a href="https://www.sveltesummit.com/">Svelte Summit Fall 2024</a></figcaption> | ||
</figure> | ||
</div> | ||
|
||
Now, we're offering that functionality via our own CLI, directly within the project creation screen. And not just for Tailwind — we have built-in add-ons for formatting, linting, testing, setting up databases and auth and i18n and more. Just run `npx sv create` and follow the prompts: | ||
|
||
``` | ||
$ npx sv create | ||
|
||
┌ Welcome to the Svelte CLI! (v0.5.8) | ||
│ | ||
◇ Where would you like your project to be created? | ||
│ my-new-app | ||
│ | ||
◇ Which template would you like? | ||
│ SvelteKit minimal | ||
│ | ||
◇ Add type checking with Typescript? | ||
│ Yes, using Typescript syntax | ||
│ | ||
◆ Project created | ||
│ | ||
◆ What would you like to add to your project? (use arrow keys / space bar) | ||
│ ◻ prettier (https://prettier.io) | ||
│ ◻ eslint | ||
│ ◻ vitest | ||
│ ◻ playwright | ||
│ ◻ tailwindcss | ||
│ ◻ drizzle | ||
│ ◻ lucia | ||
│ ◻ mdsvex | ||
│ ◻ paraglide | ||
│ ◻ storybook | ||
└ | ||
``` | ||
|
||
You can also run `npx sv add` to apply add-ons to existing projects. In the near future, we will also be supporting add-ons contributed by the community within `sv`. If you’re interested in building one, please subscribe to [the issue](https://github.com/sveltejs/cli/issues/184) in [the CLI repository](https://github.com/sveltejs/cli) to be notified when third party add-ons are supported. | ||
|
||
It doesn't stop there. Over time, Svelte has accumulated a handful of CLIs: `svelte-check` type-checks your project from the command line, `npx svelte-migrate` helps you upgrade to new major versions, and in the future we might have even more capabilities. Remembering the package name of each tool is cumbersome, which is why we unify the experience under one roof, `sv`. That means you can now run `sv migrate svelte-5` to upgrade your Svelte 4 projects to Svelte 5. (The migration functionality can also be found in [Svelte for VS Code](https://marketplace.visualstudio.com/items?itemName=svelte.svelte-vscode) as well as in the [playground](/playground).) | ||
|
||
A huge thank you to Christopher Brown ([chbrown](https://github.com/chbrown)) who donated the sv package name on npm to make this CLI possible. This package merges the previous `create-svelte` and community-led `svelte-add` tools into a single package. Thank you to Manuel ([manuel3108](https://github.com/manuel3108)) and Adrian ([CokaKoala](https://github.com/AdrianGonz97)) who recently took over maintenance of the `svelte-add` project and have joined as the newest Svelte maintainers in making this project an official part of Svelte. Also thank you to J ([babichjacob](https://github.com/babichjacob)) for creating the `svelte-add` project and successfully stewarding it for years as an important part of the Svelte community. | ||
|
||
To see the CLI in action, check out this demo from Ben Davis and t3.gg... | ||
|
||
<div> | ||
<figure style="max-width: 960px; margin: 0 auto"> | ||
<div style="aspect-ratio: 1.777777778; position: relative; margin: 0 auto;"> | ||
<iframe style="position: absolute; width: 100%; height: 100%; left: 0; top: 0; margin: 0;" src="https://www.youtube.com/embed/31CyquY8RNE?si=qvI28kFHkEL9LNOr&start=514" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe> | ||
</div> | ||
|
||
<figcaption>Introducing <code>sv</code> at <a href="https://www.sveltesummit.com/">Svelte Summit Fall 2024</a></figcaption> | ||
</figure> | ||
</div> | ||
|
||
...or run `npx sv` to try it out yourself. |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.