mirror of
https://github.com/strapi/strapi.git
synced 2025-09-01 04:42:58 +00:00
Update CLI docs
This commit is contained in:
parent
710650b25a
commit
1cfeaba98c
@ -2,46 +2,68 @@
|
|||||||
|
|
||||||
Strapi comes with a full featured Command Line Interface (CLI) which lets you scaffold and manage your project in seconds.
|
Strapi comes with a full featured Command Line Interface (CLI) which lets you scaffold and manage your project in seconds.
|
||||||
|
|
||||||
***
|
---
|
||||||
|
|
||||||
## strapi new
|
## strapi new
|
||||||
|
|
||||||
Create a new project
|
Create a new project
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
strapi new <name>
|
strapi new <name>
|
||||||
|
|
||||||
options: [--dev|--debug|--quickstart|--dbclient=<dbclient> --dbhost=<dbhost> --dbport=<dbport> --dbname=<dbname> --dbusername=<dbusername> --dbpassword=<dbpassword> --dbssl=<dbssl> --dbauth=<dbauth> --dbforce]
|
options: [--debug|--quickstart|--dbclient=<dbclient> --dbhost=<dbhost> --dbport=<dbport> --dbname=<dbname> --dbusername=<dbusername> --dbpassword=<dbpassword> --dbssl=<dbssl> --dbauth=<dbauth> --dbforce]
|
||||||
```
|
```
|
||||||
|
|
||||||
- **strapi new <name>**<br/>
|
- **strapi new <name>**<br/>
|
||||||
Generates a new project called **<name>** and installs the default plugins through the npm registry.
|
Generates a new project called **<name>** and installs the default plugins through the npm registry.
|
||||||
|
|
||||||
- **strapi new <name> --dev**<br/>
|
|
||||||
Generates a new project called **<name>** and creates symlinks for the `./admin` folder and each plugin inside the `./plugin` folder. It means that the Strapi's development workflow has been set up on the machine earlier.
|
|
||||||
|
|
||||||
- **strapi new <name> --debug**<br/>
|
- **strapi new <name> --debug**<br/>
|
||||||
Will display the full error message if one is fired during the database connection.
|
Will display the full error message if one is fired during the database connection.
|
||||||
|
|
||||||
- **strapi new <name> --quickstart**<br/>
|
- **strapi new <name> --quickstart**<br/>
|
||||||
Use the quickstart system to create your app.
|
Use the quickstart system to create your app.
|
||||||
|
|
||||||
- **strapi new <name> --dbclient=<dbclient> --dbhost=<dbhost> --dbport=<dbport> --dbname=<dbname> --dbusername=<dbusername> --dbpassword=<dbpassword> --dbssl=<dbssl> --dbauth=<dbauth> --dbforce**<br/>
|
- **strapi new <name> --dbclient=<dbclient> --dbhost=<dbhost> --dbport=<dbport> --dbname=<dbname> --dbusername=<dbusername> --dbpassword=<dbpassword> --dbssl=<dbssl> --dbauth=<dbauth> --dbforce**<br/>
|
||||||
|
|
||||||
Generates a new project called **<name>** and skip the interactive database configuration and initilize with these options.
|
Generates a new project called **<name>** and skip the interactive database configuration and initilize with these options.
|
||||||
|
|
||||||
- **<dbclient>** can be `mongo`, `postgres`, `mysql`.
|
- **<dbclient>** can be `mongo`, `postgres`, `mysql`.
|
||||||
- **<dbssl>** and **<dbauth>** are available only for `mongo` and are optional.
|
- **<dbssl>** and **<dbauth>** are available only for `mongo` and are optional.
|
||||||
- **--dbforce** Allows you to overwrite content if the provided database is not empty. Only available for `postgres`, `mysql`, and is optional.
|
- **--dbforce** Allows you to overwrite content if the provided database is not empty. Only available for `postgres`, `mysql`, and is optional.
|
||||||
|
|
||||||
See the [CONTRIBUTING guide](https://github.com/strapi/strapi/blob/master/CONTRIBUTING.md) for more details.
|
## strapi develop|dev
|
||||||
|
|
||||||
|
Start a Strapi application with autoReload activated.
|
||||||
|
|
||||||
|
Strapi modifies/creates files at runtime and needs to restart when new files are created. To achieve that `strapi develop` add a file watcher and restart the application when necessary.
|
||||||
|
|
||||||
|
::: note
|
||||||
|
You should never use this command to run a Strapi application in production
|
||||||
|
:::
|
||||||
|
|
||||||
## strapi start
|
## strapi start
|
||||||
Start a Strapi application.
|
|
||||||
|
|
||||||
That provide some feature like auto restart when you update a file in you application (except public files).
|
Start a Strapi application without autoReloading.
|
||||||
|
|
||||||
If you don't use `strapi start` to start you application some plugin that use `strapi.reload();` (content-type-builder plugin for example) can break or not work well.
|
This commands is there to run a Strapi application without restarts and file writes (aimed at production usage).
|
||||||
|
When run certain features are disabled because they require application restarts.
|
||||||
|
|
||||||
|
::: note
|
||||||
|
You can specify a NODE_ENV to use the configurations in the `./config/envrionments` folder (e.g development|staging|production)
|
||||||
|
By default the `development` envrionment will be used
|
||||||
|
:::
|
||||||
|
|
||||||
|
## strapi build
|
||||||
|
|
||||||
|
Builds your admin panel
|
||||||
|
|
||||||
|
::: note
|
||||||
|
You can specify a NODE_ENV to use the configurations in the `./config/envrionments` folder (e.g development|staging|production)
|
||||||
|
By default the `development` envrionment will be used
|
||||||
|
:::
|
||||||
|
|
||||||
## strapi generate:api
|
## strapi generate:api
|
||||||
|
|
||||||
Scaffold a complete API with its configurations, controller, model and service.
|
Scaffold a complete API with its configurations, controller, model and service.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
@ -73,6 +95,7 @@ The first letter of the filename will be uppercased.
|
|||||||
:::
|
:::
|
||||||
|
|
||||||
## strapi generate:controller
|
## strapi generate:controller
|
||||||
|
|
||||||
Create a new controller
|
Create a new controller
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
@ -99,6 +122,7 @@ The first letter of the filename will be uppercased.
|
|||||||
:::
|
:::
|
||||||
|
|
||||||
## strapi generate:model
|
## strapi generate:model
|
||||||
|
|
||||||
Create a new model
|
Create a new model
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
@ -122,11 +146,11 @@ options: [--api <name>|--plugin <name>]
|
|||||||
Generates an empty model called **<name>** in the `./api/<api>/models` folder.
|
Generates an empty model called **<name>** in the `./api/<api>/models` folder.
|
||||||
|
|
||||||
Example: `strapi generate:model category --api product` will create these two files:
|
Example: `strapi generate:model category --api product` will create these two files:
|
||||||
|
|
||||||
- `./api/product/models/Category.js`
|
- `./api/product/models/Category.js`
|
||||||
- `./api/product/models/Category.settings.json`.
|
- `./api/product/models/Category.settings.json`.
|
||||||
|
|
||||||
|
* **strapi generate:model <name> --plugin <plugin>**<br/>
|
||||||
- **strapi generate:model <name> --plugin <plugin>**<br/>
|
|
||||||
Generates an empty model called **<name>** in the `./plugins/<plugin>/models` folder.
|
Generates an empty model called **<name>** in the `./plugins/<plugin>/models` folder.
|
||||||
|
|
||||||
::: note
|
::: note
|
||||||
@ -134,6 +158,7 @@ The first letter of the filename will be uppercased.
|
|||||||
:::
|
:::
|
||||||
|
|
||||||
## strapi generate:service
|
## strapi generate:service
|
||||||
|
|
||||||
Create a new service
|
Create a new service
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
@ -160,6 +185,7 @@ The first letter of the filename will be uppercased.
|
|||||||
:::
|
:::
|
||||||
|
|
||||||
## strapi generate:policy
|
## strapi generate:policy
|
||||||
|
|
||||||
Create a new policy
|
Create a new policy
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
@ -181,8 +207,8 @@ options: [--api <name>|--plugin <name>]
|
|||||||
- **strapi generate:policy <name> --plugin <plugin>**<br/>
|
- **strapi generate:policy <name> --plugin <plugin>**<br/>
|
||||||
Generates an empty policy called **<name>** in the `./plugins/<plugin>/config/policies` folder. This policy will be scoped and accessible only by the **<plugin>** routes.
|
Generates an empty policy called **<name>** in the `./plugins/<plugin>/config/policies` folder. This policy will be scoped and accessible only by the **<plugin>** routes.
|
||||||
|
|
||||||
|
|
||||||
## strapi generate:plugin
|
## strapi generate:plugin
|
||||||
|
|
||||||
Create a new plugin skeleton.
|
Create a new plugin skeleton.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
@ -194,69 +220,67 @@ strapi generate:plugin <name>
|
|||||||
|
|
||||||
Example: `strapi generate:plugin user` will create the plugin at `./plugins/user`.
|
Example: `strapi generate:plugin user` will create the plugin at `./plugins/user`.
|
||||||
|
|
||||||
|
Please refer to the [plugin development|staging|production documentation](../plugin-development|staging|production/quick-start.md) to know more.
|
||||||
|
|
||||||
Please refer to the [plugin development documentation](../plugin-development/quick-start.md) to know more.
|
---
|
||||||
|
|
||||||
***
|
|
||||||
|
|
||||||
## strapi install
|
## strapi install
|
||||||
|
|
||||||
Install a plugin in the project.
|
Install a plugin in the project.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
strapi install <name>
|
strapi install <name>
|
||||||
|
|
||||||
options: [--dev]
|
|
||||||
```
|
```
|
||||||
|
|
||||||
- **strapi install <name>**<br/>
|
- **strapi install <name>**<br/>
|
||||||
Installs a plugin called **<name>** in the `./plugins` folder.
|
Installs a plugin called **<name>**.
|
||||||
|
|
||||||
Example: `strapi install content-type-builder` will install the plugin at `./plugins/content-type-builder`.
|
Example: `strapi install graphql` will install the plugin `strapi-plugin-graphql`
|
||||||
|
|
||||||
- **strapi install <name> --dev**<br/>
|
|
||||||
It will create a symlink from the local Strapi repository plugin folder called **<name>** in the `./plugins` folder.
|
|
||||||
|
|
||||||
Example: `strapi install content-type-builder --dev` will create a symlink from `/path/to/the/repository/packages/strapi-plugin-content-type-builder` to `./plugins/content-type-builder`.
|
|
||||||
|
|
||||||
::: note
|
|
||||||
Checkout the [CONTRIBUTING guide](https://github.com/strapi/strapi/blob/master/CONTRIBUTING.md) for more details about the local Strapi development workflow.
|
|
||||||
:::
|
|
||||||
|
|
||||||
::: warning
|
::: warning
|
||||||
You have to restart the server to load the plugin into your project.
|
Some plugin having admin panel integration, your admin panel might have to be rebuilt. This can take some time.
|
||||||
:::
|
:::
|
||||||
|
|
||||||
Please refer to the [plugins documentation](../plugin-development/quick-start.md) to know more.
|
---
|
||||||
|
|
||||||
***
|
|
||||||
|
|
||||||
## strapi uninstall
|
## strapi uninstall
|
||||||
|
|
||||||
Uninstall a plugin from the project.
|
Uninstall a plugin from the project.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
strapi uninstall <name>
|
strapi uninstall <name>
|
||||||
|
|
||||||
|
options [--delete-files]
|
||||||
```
|
```
|
||||||
|
|
||||||
- **strapi uninstall <name>**<br/>
|
- **strapi uninstall <name>**<br/>
|
||||||
Uninstalls a plugin called **<name>** in the `./plugins` folder.
|
Uninstalls a plugin called **<name>**.
|
||||||
|
|
||||||
Example: `strapi uninstall content-type-builder` will remove the folder at `./plugins/content-type-builder`.
|
Example: `strapi uninstall graphql` will remove the plugin `strapi-plugin-graphql`
|
||||||
|
|
||||||
|
- **strapi uninstall <name> --delete-files**<br/>
|
||||||
|
Uninstalls a plugin called **<name>** and removes the files in `./extensions/name/`
|
||||||
|
|
||||||
Please refer to the [plugins documentation](../plugin-development/quick-start.md) to know more.
|
Example: `strapi uninstall graphql` will remove the plugin `strapi-plugin-graphql` and all the files in `./extensions/graphql`
|
||||||
|
|
||||||
***
|
::: warning
|
||||||
|
Some plugin having admin panel integration, your admin panel might have to be rebuilt. This can take some time.
|
||||||
|
:::
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
## strapi version
|
## strapi version
|
||||||
|
|
||||||
Print the current globally installed Strapi version.
|
Print the current globally installed Strapi version.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
strapi version
|
strapi version
|
||||||
```
|
```
|
||||||
|
|
||||||
***
|
---
|
||||||
|
|
||||||
## strapi help
|
## strapi help
|
||||||
|
|
||||||
List CLI commands.
|
List CLI commands.
|
||||||
|
|
||||||
```
|
```
|
||||||
|
Loading…
x
Reference in New Issue
Block a user