8000 draft: chore: add docs by manuel3108 · Pull Request #71 · sveltejs/cli · GitHub
[go: up one dir, main page]

Skip to content

draft: chore: add docs #71

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 16 commits into from
Oct 10, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions documentation/docs/10-getting-started/10-commands.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
title: Commands
---

## Intorduction

The svelte cli `sv` aims to combine multiple tools into one single easy to remember command.

## Usage

The best way to use our cli is to run one of the following commands, depending on your package manager

```bash
npx sv <command> <args>
pnpx sv <command> <args>
# todo: should we add other package managers or just leave npx? Same goes for all other snippets
```

## Commands

| Command | Sample usage | Description |
| ------------------ | -------------------------------- | ---------------------------------------------- |
| [`create`](create) | `npx sv create ./my-project` | Scaffolds new projects |
| [add](add) | `npx sv add tailwindcss` | Customize your projects to add different tools |
| migrate | `npx sv migrate {migrationName}` | Migrate your project |
| check | `npx sv check` | ??? |
39 changes: 39 additions & 0 deletions documentation/docs/10-getting-started/50-create.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
---
title: Create a project
---

## overview

some cool description about the `create` command and it's capabilities

## usage

```bash
npx sv create
```

```bash
npx sv create ./my/path
```

## available options

| Option | option values | default | description |
| ------------- | ------------------------------- | --------- | ---------------------------------------------------------- |
| --check-types | typescript \| checkjs \| none | typescipt | determine if type checking should be added to this project |
| --template | skeleton \| skeletonlib \| demo | skeleton | project template |
| --no-adders | - | - | skips interactive adder installer |
| --no-install | - | - | skips installing dependencies |

## programatic interface

```js
// 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
// import { create } from 'sv';

// // todo: check if this is right
// create(cwd, {
// // add your options here
// // todo: list available option
// });
```
77 changes: 77 additions & 0 deletions documentation/docs/10-getting-started/51-add.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
---
title: Customize your project
---

## overview

some cool description about the `add` command and it's capabilities

## usage

```bash
npx sv add
```

```bash
npx sv add tailwindcss
```

```bash
npx sv add tailwindcss --cwd ./my/path
```

## available options

| Option | option values | default | description |
| ------------------ | ------------------------------------------ | ------- | -------------------------------------------- |
| -C, --cwd | - | ./ | path to the root of your svelte(kit) project |
| --no-install | - | - | skips installing dependencies |
| --no-preconditions | - | - | skips checking preconditions |
| --no-preconditions | - | - | skips checking preconditions |
| --community | [community adder names](#community-adders) | - | adds community adders |

## available adders

// todo: add unmerged adders

drizzle

eslint

lucia

mdsvex

playwright

prettier

routify

storybook

tailwindcss

vitest

## community adders

> The Svelte maintainers have not reviewed community adders for malicious code. Use at your discretion.

```bash
npx sv add --community # interactive community adder selection
```

```bash
npx sv add --community shadcn-svelte #test
```

```bash
npx sv add --community shadcn-svelte --cwd ./my/path
```

```bash
npx sv add --community npm:your-custom-adder-published-to-npm --cwd ./my/path
```

// todo: list of community adders???
13 changes: 13 additions & 0 deletions documentation/docs/10-getting-started/52-migrate.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
title: Migrate your project
---

## overview

some cool description about the `migrate` command and it's capabilities

## usage

```bash
npx sv migrate svelte-5
```
17 changes: 17 additions & 0 deletions documentation/docs/10-getting-started/53-check.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
title: Check your project
---

## overview

some cool description about the `check` command and it's capabilities

## usage

```bash
npx sv check
```

## notes

some note that `svelte-check` will need to be installed locally into the project
3 changes: 3 additions & 0 deletions documentation/docs/10-getting-started/index.md
9E88
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
title: Getting started
---
28 changes: 28 additions & 0 deletions documentation/docs/20-community-adders/10-usage.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---
title: Usage
---

## Before we begin

> The Svelte maintainers have not reviewed community adders for malicious code. Use at your discretion.

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)

## usage

```bash
npx sv add --community # interactive list
npx sv add --community supabase # apply supabase adder
npx sv add --community npm:your-npm-package # apply any adder from npm
npx sv add --community file:./path-to-your-adder # for local testing
```

## requirements

technical requirements:

- all adders must have exactly one dependency: `@sveltejs/add-core`
- if they need to include any other dependencies they will need to do some bundeling on their side
- the major version of the referenced `@sveltejs/add-core` library must match with the major version `sv` the user is currently executing

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
15 changes: 15 additions & 0 deletions documentation/docs/20-community-adders/11-docs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
title: Docs
---

## community adder template

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.

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.

## basic usage

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

Do we need to explain more? I think most of the things should be pretty self explanatory and can be added on demand
20 changes: 20 additions & 0 deletions documentation/docs/20-community-adders/12-submission.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
title: Submission
---

## overview

normal text

## requirements

- must benefit the overall svelte ecosystem and the community
- must not be too specific to one presons needs
- todo: whatever else we can think of

## process

- create a fork of `sveltejs/cli`
- modify file `todo` to add your community adder
- create a PR
- once merged, it might take a while before we draft a new release of `sv`, only then your new community adder will be available
3 changes: 3 additions & 0 deletions documentation/docs/20-community-adders/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
title: Community adders
---
3 changes: 3 additions & 0 deletions documentation/docs/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
title: CLI
---
0