Skip to content

docs: add quick start doc #314

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 1 commit into from
Oct 21, 2024
Merged
Changes from all 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
95 changes: 95 additions & 0 deletions website/docs/en/guide/start/quick-start.mdx
Original file line number Diff line number Diff line change
@@ -1 +1,96 @@
# Quick Start

## Setup Environment

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.

Check the current Node.js version with the following command:

```bash
node -v
```

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.

Here is an example of how to install via nvm:

```bash
# Install Node.js LTS
nvm install --lts
# Switch to Node.js LTS
nvm use --lts
```

## Creating an Rslib Project

You can use the `create-rslib` to create a new Rslib project. Run the following command:

import { PackageManagerTabs } from '@theme';

<PackageManagerTabs
command={{
npm: 'npm create rslib@latest',
yarn: 'yarn create rslib',
pnpm: 'pnpm create rslib@latest',
bun: 'bun create rslib@latest',
}}
/>

Then follow the prompts to complete the operation.

### Optional Tools

`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.

```text
◆ Select additional tools (Use <space> to select, <enter> to continue)
│ ◻ Add Biome for code linting and formatting
│ ◻ Add ESLint for code linting
│ ◻ Add Prettier for code formatting
```

:::tip
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.
:::

### Current Directory

If you need to create a project in the current directory, you can set the target folder to `.`:

```text
◆ Create Rslib Project
◇ Project name or path
│ .
◇ "." is not empty, please choose:
│ Continue and override files
```

### Quick Creation

[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.

For example, to create an example project in the `my-project` directory with one command:

```bash
npx create-rslib --dir my-project --template example

# Using abbreviations
npx create-rslib -d my-project -t example
```

All the CLI flags of `create-rslib`:

```text
Usage: create-rslib [options]

Options:

-h, --help display help for command
-d, --dir create project in specified directory
-t, --template specify the template to use
--tools select additional tools (biome, eslint, prettier)
--override override files in target directory
```
Loading