Skip to content

Commit c85ee06

Browse files
authored
docs: add quick start doc (#314)
1 parent b448c80 commit c85ee06

File tree

1 file changed

+95
-0
lines changed

1 file changed

+95
-0
lines changed
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,96 @@
11
# Quick Start
2+
3+
## Setup Environment
4+
5+
Before getting started, you will need to install [Node.js](https://nodejs.org/) >= version 16, it is recommended to use the Node.js LTS version.
6+
7+
Check the current Node.js version with the following command:
8+
9+
```bash
10+
node -v
11+
```
12+
13+
If you do not have Node.js installed in current environment, or the installed version is too low, you can use [nvm](https://github.com/nvm-sh/nvm) or [fnm](https://github.com/Schniz/fnm) to install.
14+
15+
Here is an example of how to install via nvm:
16+
17+
```bash
18+
# Install Node.js LTS
19+
nvm install --lts
20+
# Switch to Node.js LTS
21+
nvm use --lts
22+
```
23+
24+
## Creating an Rslib Project
25+
26+
You can use the `create-rslib` to create a new Rslib project. Run the following command:
27+
28+
import { PackageManagerTabs } from '@theme';
29+
30+
<PackageManagerTabs
31+
command={{
32+
npm: 'npm create rslib@latest',
33+
yarn: 'yarn create rslib',
34+
pnpm: 'pnpm create rslib@latest',
35+
bun: 'bun create rslib@latest',
36+
}}
37+
/>
38+
39+
Then follow the prompts to complete the operation.
40+
41+
### Optional Tools
42+
43+
`create-rslib` can help you set up some commonly used tools, including [Biome](https://github.com/biomejs/biome), [ESLint](https://github.com/eslint/eslint), and [prettier](https://github.com/prettier/prettier). You can use the arrow keys and the space bar to make your selections. If you don't need these tools, you can simply press Enter to skip.
44+
45+
```text
46+
◆ Select additional tools (Use <space> to select, <enter> to continue)
47+
│ ◻ Add Biome for code linting and formatting
48+
│ ◻ Add ESLint for code linting
49+
│ ◻ Add Prettier for code formatting
50+
51+
```
52+
53+
:::tip
54+
Biome provides similar linting and formatting features to ESLint and Prettier. If you select Biome, you typically won't need to choose ESLint or Prettier as well.
55+
:::
56+
57+
### Current Directory
58+
59+
If you need to create a project in the current directory, you can set the target folder to `.`:
60+
61+
```text
62+
◆ Create Rslib Project
63+
64+
◇ Project name or path
65+
│ .
66+
67+
◇ "." is not empty, please choose:
68+
│ Continue and override files
69+
```
70+
71+
### Quick Creation
72+
73+
[create-rslib](https://www.npmjs.com/package/create-rslib) provides some CLI flags. By setting these CLI flags, you can skip the interactive selection steps and create the project with one command.
74+
75+
For example, to create an example project in the `my-project` directory with one command:
76+
77+
```bash
78+
npx create-rslib --dir my-project --template example
79+
80+
# Using abbreviations
81+
npx create-rslib -d my-project -t example
82+
```
83+
84+
All the CLI flags of `create-rslib`:
85+
86+
```text
87+
Usage: create-rslib [options]
88+
89+
Options:
90+
91+
-h, --help display help for command
92+
-d, --dir create project in specified directory
93+
-t, --template specify the template to use
94+
--tools select additional tools (biome, eslint, prettier)
95+
--override override files in target directory
96+
```

0 commit comments

Comments
 (0)