8000 add cli docs · sveltejs/svelte.dev@aec0ce6 · GitHub
[go: up one dir, main page]

Skip to content

Commit aec0ce6

Browse files
committed
add cli docs
1 parent a51a014 commit aec0ce6

File tree

13 files changed

+263
-2
lines changed

13 files changed

+263
-2
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
---
2+
title: Commands
3+
---
4+
5+
## Intorduction
6+
7+
The svelte cli `sv` aims to combine multiple tools into one single easy to remember command.
8+
9+
## Usage
10+
11+
The best way to use our cli is to run one of the following commands, depending on your package manager
12+
13+
```bash
14+
npx sv <command> <args>
15+
pnpx sv <command> <args>
16+
# todo: should we add other package managers or just leave npx? Same goes for all other snippets
17+
```
18+
19+
## Commands
20+
21+
| Command | Sample usage | Description |
22+
| ------------------ | -------------------------------- | ---------------------------------------------- |
23+
| [`create`](create) | `npx sv create ./my-project` | Scaffolds new projects |
24+
| [add](add) | `npx sv add tailwindcss` | Customize your projects to add different tools |
25+
| migrate | `npx sv migrate {migrationName}` | Migrate your project |
26+
| check | `npx sv check` | ??? |
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
---
2+
title: Create a project
3+
---
4+
5+
## overview
6+
7+
some cool description about the `create` command and it's capabilities
8+
9+
## usage
10+
11+
```bash
12+
npx sv create
13+
```
14+
15+
```bash
16+
npx sv create ./my/path
17+
```
18+
19+
## available options
20+
21+
| Option | option values | default | description |
22+
| ------------- | ------------------------------- | --------- | ---------------------------------------------------------- |
23+
| --check-types | typescript \| checkjs \| none | typescipt | determine if type checking should be added to this project |
24+
| --template | skeleton \| skeletonlib \| demo | skeleton | project template |
25+
| --no-adders | - | - | skips interactive adder installer |
26+
| --no-install | - | - | skips installing dependencies |
27+
28+
## programatic interface
29+
30+
```js
31+
// todo: this gives error in the docs site when commented in, seems to be related that this package is not published to the registry at this point in time, as it seems to be trying to check types
32+
// import { create } from 'sv';
33+
34+
// // todo: check if this is right
35+
// create(cwd, {
36+
// // add your options here
37+
// // todo: list available option
38+
// });
39+
```
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
---
2+
title: Customize your project
3+
---
4+
5+
## overview
6+
7+
some cool description about the `add` command and it's capabilities
8+
9+
## usage
10+
11+
```bash
12+
npx sv add
13+
```
14+
15+
```bash
16+
npx sv add tailwindcss
17+
```
18+
19+
```bash
20+
npx sv add tailwindcss --cwd ./my/path
21+
```
22+
23+
## available options
24+
25+
| Option | option values | default | description |
26+
| ------------------ | ------------------------------------------ | ------- | -------------------------------------------- |
27+
| -C, --cwd | - | ./ | path to the root of your svelte(kit) project |
28+
| --no-install | - | - | skips installing dependencies |
29+
| --no-preconditions | - | - | skips checking preconditions |
30+
| --no-preconditions | - | - | skips checking preconditions |
31+
| --community | [community adder names](#community-adders) | - | adds community adders |
32+
33+
## available adders
34+
35+
// todo: add unmerged adders
36+
37+
drizzle
38+
39+
eslint
40+
41+
lucia
42+
43+
mdsvex
44+
45+
playwright
46+
47+
prettier
48+
49+
routify
50+
51+
storybook
52+
53+
tailwindcss
54+
55+
vitest
56+
57+
## community adders
58+
59+
> The Svelte maintainers have not reviewed community adders for malicious code. Use at your discretion.
60+
61+
```bash
62+
npx sv add --community # interactive community adder selection
63+
```
64+
65+
```bash
66+
npx sv add --community shadcn-svelte #test
67+
```
68+
69+
```bash
70+
npx sv add --community shadcn-svelte --cwd ./my/path
71+
```
72+
73+
```bash
74+
npx sv add --community npm:your-custom-adder-published-to-npm --cwd ./my/path
75+
```
76+
77+
// todo: list of community adders???
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
title: Migrate your project
3+
---
4+
5+
## overview
6+
7+
some cool description about the `migrate` command and it's capabilities
8+
9+
## usage
10+
11+
```bash
12+
npx sv migrate svelte-5
13+
```
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2 F987 +
title: Check your project
3+
---
4+
5+
## overview
6+
7+
some cool description about the `check` command and it's capabilities
8+
9+
## usage
10+
11+
```bash
12+
npx sv check
13+
```
14+
15+
## notes
16+
17+
some note that `svelte-check` will need to be installed locally into the project
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
---
2+
title: Getting started
3+
---
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
---
2+
title: Usage
3+
---
4+
5+
## Before we begin
6+
7+
> The Svelte maintainers have not reviewed community adders for malicious code. Use at your discretion.
8+
9+
That being said, we still want the community to be able to enhance the experience while creating new projects. That's why everyone is allowed to create community adders. The documentation for creating a new community adder can be found [here](docs)
10+
11+
## usage
12+
13+
```bash
14+
npx sv add --community # interactive list
15+
npx sv add --community supabase # apply supabase adder
16+
npx sv add --community npm:your-npm-package # apply any adder from npm
17+
npx sv add --community file:./path-to-your-adder # for local testing
18+
```
19+
20+
## requirements
21+
22+
technical requirements:
23+
24+
- all adders must have exactly one dependency: `@sveltejs/add-core`
25+
- if they need to include any other dependencies they will need to do some bundeling on their side
26+
- the major version of the referenced `@sveltejs/add-core` library must match with the major version `sv` the user is currently executing
27+
28+
See [submission](submission#requirements) to find additional requirements if you want list your community adder inside `sv` for the ease of use of other community members
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
title: Docs
3+
---
4+
5+
## community adder template
6+
7+
We have a [community adder template](https://github.com/sveltejs/cli/tree/main/community-adder-template) that lives inside our GitHub monorepo. This should be a starting point for all new community adders.
8+
9+
We do not provide any TS template, as the types provided by all the helper methods we expose should be enough to fullfill your needs! If you still want to use typescript, nobody will prevent you.
10+
11+
## basic usage
12+
13+
add example usage for our 5 common files (index.js, config/adder.js, config/options.js, config/check.js, config/test.js) and explain what they are. Ommitted at this point, since the code templates do not work
14+
15+
Do we need to explain more? I think most of the things should be pretty self explanatory and can be added on demand
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
title: Submission
3+
---
4+
5+
## overview
6+
7+
normal text
8+
9+
## requirements
10+
11+
- must benefit the overall svelte ecosystem and the community
12+
- must not be too specific to one presons needs
13+
- todo: whatever else we can think of
14+
15+
## process
16+
17+
- create a fork of `sveltejs/cli`
18+
- modify file `todo` to add your community adder
19+
- create a PR
20+
- once merged, it might take a while before we draft a new release of `sv`, only then your new community adder will be available
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
---
2+
title: Community adders
3+
---

0 commit comments

Comments
 (0)
0