Skip to content

Commit 7c80e25

Browse files
committed
Change structure
1 parent 38c091e commit 7c80e25

File tree

1 file changed

+40
-71
lines changed

1 file changed

+40
-71
lines changed

docs/CreateReactAdmin.md

Lines changed: 40 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -5,45 +5,38 @@ title: "The create-react-admin CLI"
55

66
# `create-react-admin`
77

8-
`create-react-admin` is a package that generates a react-admin app scaffolding using [Vite](https://vitejs.dev/). It is designed to work on most setups and produces predictable and consistent results. It's the preferred way to create a new react-admin application.
8+
Use `create-react-admin` to quickly bootstrap a react-admin project using [Vite](https://vitejs.dev/). It's the preferred way to create a new react-admin application.
99

1010
<iframe src="https://www.youtube-nocookie.com/embed/i_TbS7quzww" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen style="aspect-ratio: 16 / 9;width:100%;margin-bottom:1em;"></iframe>
1111

1212
## Usage
1313

14-
Use it by running the following command:
15-
16-
<div><i>With NPM</i></div>
17-
1814
```sh
19-
npm create react-admin@latest your-admin-name
15+
npx create-react-admin@latest your-admin-name
2016
```
2117

22-
<div><i>With NPX</i></div>
18+
This will create an empty react-admin application in a directory called `your-admin-name`.
2319

24-
```sh
25-
npx create-react-admin@latest your-admin-name
26-
```
20+
**Tip**: You can replace `npx` with `npm`, `yarn`, or `bun`
2721

28-
<div><i>With Yarn</i></div>
22+
## Options
2923

30-
```sh
31-
yarn create react-admin your-admin-name
32-
```
24+
The command accepts the following options:
3325

34-
<div><i>With Bun</i></div>
26+
* `--interactive`: Enable the CLI interactive mode
27+
* `--data-provider`: Set the data provider to use ("data-fakerest", "data-simple-rest", "data-json-server", "supabase" or "none")
28+
* `--auth-provider`: Set the auth provider to use ("local-auth-provider" or "none")
29+
* `--resource`: Add a resource that will be initialized with guessers (can be used multiple times). Set to "skip" to bypass the interactive resource step.
30+
* `--install`: Set the package manager to use for installing dependencies ("yarn", "npm", "bun" or "skip" to bypass the interactive install step)
3531

36-
```sh
37-
bun create react-admin your-admin-name
38-
```
32+
## `--interactive`
3933

40-
It will choose every option for you and create your new React-Admin application.
41-
To select them, you can use the `--interactive` flag and the terminal will then ask you to choose:
34+
When using this option, the terminal will ask you to choose:
4235

43-
- a [data provider](#data-provider)
44-
- an [auth provider](#auth-provider)
45-
- the names of the [resources](#resources) to add
46-
- the [package manager](#package-manager) to use to install the dependencies
36+
* a [data provider](#data-provider)
37+
* an [auth provider](#auth-provider)
38+
* the names of the [resources](#resources) to add
39+
* the [package manager](#package-manager) to use to install the dependencies
4740

4841
<video controls autoplay playsinline muted loop>
4942
<source src="./img/create-react-admin.webm" type="video/webm"/>
@@ -63,80 +56,56 @@ yarn dev
6356
bun run dev
6457
```
6558

66-
## Data Provider
59+
## `--data-provider`
6760

68-
`create-react-admin` currently supports five templates presets to set the application's data provider which are:
61+
`create-react-admin` currently supports five presets for the application's data provider:
6962

70-
- **Fakerest:** A client-side, in-memory data provider that use a JSON object as its initial data.
71-
- **JSON Server:** A data provider based on the JSON Server API (<https://github.com/typicode/json-server>)
72-
- **Simple REST:** A Simple REST data provider (<https://github.com/marmelab/react-admin/tree/master/packages/ra-data-simple-rest>)
73-
- **Supabase:** Generate an application using ra-supabase. The auth-provider and resources steps will be skipped.
74-
- **None:** You'll configure the data provider myself.
63+
* `fakerest`: A client-side data provider that use a JSON object for data, powered by [FakeRest](https://github.com/marmelab/FakeRest).
64+
* `json-server`: A data provider based on the [JSON Server](https://github.com/typicode/json-server) API
65+
* `simple-rest`: A data provider for [simple REST APIs](https://github.com/marmelab/react-admin/tree/master/packages/ra-data-simple-rest)
66+
* `supabase`: A data provider for [Supabase](https://github.com/marmelab/ra-supabase/tree/main/packages/ra-supabase). The auth-provider and resources steps will be skipped.
67+
* `none` (default): You'll configure the data provider myself.
7568

7669
You can set your data provider directly with the `--data-provider` option:
7770

7871
```sh
79-
npm create react-admin@latest your-admin-name --data-provider json-server
80-
# or
81-
npx create-react-admin@latest your-admin-name --data-provider simple-rest
82-
# or
83-
yarn create react-admin your-admin-name --data-provider supabase
84-
# or
85-
bun create react-admin your-admin-name --data-provider none
72+
npx create-react-admin@latest your-admin-name --data-provider json-server
8673
```
8774

88-
## Auth Provider
75+
## `--auth-provider`
8976

90-
`create-react-admin` currently supports two templates presets to set the application's auth provider which are:
77+
`create-react-admin` currently supports two presets to set the application's auth provider which are:
9178

92-
- **Hard coded local username/password.**
93-
- **None:** No authProvider.
79+
* `local-auth-provider`: Hard coded username/password.
80+
* `none` (default): No authProvider.
9481

9582
You can set your auth provider directly with the `--auth-provider` option:
9683

9784
```sh
98-
npm create react-admin@latest your-admin-name --auth-provider local-auth-provider
99-
# or
100-
npx create-react-admin@latest your-admin-name --auth-provider none
101-
# or
102-
yarn create react-admin your-admin-name --auth-provider local-auth-provider
103-
# or
104-
bun create react-admin your-admin-name --auth-provider none
85+
npx create-react-admin@latest your-admin-name --auth-provider local-auth-provider
10586
```
10687

107-
## Resources
88+
## `--resource`
10889

109-
`create-react-admin` doesn't provide any resource by default. You can add some on `--interactive` mode or you can set your resources with the `--resource` option:
90+
`create-react-admin` creates an empty app by default. You can initialize CRUD pages for some resources with the `--resource` option:
11091

11192
```sh
112-
npm create react-admin@latest your-admin-name --resource posts
113-
# or
11493
npx create-react-admin@latest your-admin-name --resource posts --resource comments
115-
# or
116-
yarn create react-admin your-admin-name --resource posts
117-
# or
118-
bun create react-admin your-admin-name --resource posts --resource comments
11994
```
12095

12196
**Warning:** the `--resource` flag is incompatible with a `--data-provider supabase` due to a specific [`<AdminGuesser>` component](https://github.com/marmelab/ra-supabase/tree/main/packages/ra-supabase#usage) from `ra-supabase`.
12297

123-
## Package Manager
98+
## `--install`
12499

125-
`create-react-admin` currently supports the following options for package managers:
100+
`create-react-admin` can install dependencies using any of the following package managers:
126101

127-
- **npm**
128-
- **yarn**
129-
- **bun**
130-
- **Don't install dependencies**, you'll do it myself.
102+
* `npm` (default)
103+
* `yarn`
104+
* `bun`
105+
* `none` (if you want to install dependencies yourself)
131106

132-
You can set your package manager with the `--install` option:
107+
You choose an alternative package manager with the `--install` option:
133108

134109
```sh
135-
npm create react-admin@latest your-admin-name --install npm
136-
# or
137-
yarn create react-admin your-admin-name --install yarn
138-
# or
139-
bun create react-admin your-admin-name --install bun
140-
# or
141-
npx create-react-admin@latest your-admin-name --install skip
110+
npx create-react-admin@latest your-admin-name --install bun
142111
```

0 commit comments

Comments
 (0)