diff --git a/docs/developer-docs/latest/developer-resources/cli/CLI.md b/docs/developer-docs/latest/developer-resources/cli/CLI.md index 1105655de7..86b8900c9d 100644 --- a/docs/developer-docs/latest/developer-resources/cli/CLI.md +++ b/docs/developer-docs/latest/developer-resources/cli/CLI.md @@ -95,6 +95,15 @@ options: [--no-optimization] - **strapi build --no-optimization**
Builds the administration panel without minimizing the assets. The build duration is faster. +## strapi watch-admin + +Starts the admin server. Strapi should already be running with `strapi develop`. + +```sh +strapi watch-admin +options: [--browser ] +``` + ## strapi configuration:dump **Alias**: `config:dump` @@ -183,181 +192,75 @@ strapi admin:reset-user-password --email=chef@strapi.io --password=Gourmet1234 | -p, --password | string | New password for the user | | -h, --help | | display help for command | -## strapi generate:api +## strapi generate -Scaffold a complete API with its configurations, controller, model and service. +Run a fully interactive CLI to generate APIs, [controllers](/developer-docs/latest/development/backend-customization/controllers.md), [content-types](/developer-docs/latest/development/backend-customization/models.md), [plugins](/developer-docs/latest/development/plugins-development.md#creating-a-plugin), [policies](/developer-docs/latest/development/backend-customization/policies.md), [middlewares](/developer-docs/latest/development/backend-customization/middlewares.md) and [services](/developer-docs/latest/development/backend-customization/services.md). -```bash -strapi generate:api [] - -options: [--plugin ] +```sh +strapi generate ``` -- **strapi generate:api <name>**
- Generates an API called **<name>** in the `./api` folder at the root of your project. - -- **strapi generate:api <name> --draft-and-publish=true**
- Generates an API called **<name>** in the `./api` folder at the root of your project and enabled the draft/publish feature. - -- **strapi generate:api <name> <attribute:type>**
- Generates an API called **<name>** in the `./api` folder at the root of your project. The model will already contain an attribute called **<attribute>** with the type property set to **<type>**. - - Example: `strapi generate:api product name:string description:text price:integer` - -- **strapi generate:api <name> --plugin <plugin>**
- Generates an API called **<name>** in the `./plugins/` folder. - - Example: `strapi generate:api product --plugin content-manager` - -::: tip TIPS -* The filename will be kebab-cased. -* When you create a new API using the CLI, a model is automatically created. -::: - -## strapi generate:controller +## strapi generate:template -Create a new controller. +Create a template from the current strapi project ```bash -strapi generate:controller - -options: [--api |--plugin ] +strapi generate:template ``` -- **strapi generate:controller <name>**
- Generates an empty controller called **<name>** in the `./api//controllers` folder. - - Example: `strapi generate:controller category` will create the controller at `./api/category/controllers/Category.js`. - -- **strapi generate:controller <name> --api <api>**
- Generates an empty controller called **<name>** in the `./api//controllers` folder. - - Example: `strapi generate:controller category --api product` will create the controller at `./api/product/controllers/Category.js`. - -- **strapi generate:controller <name> --plugin <plugin>**
- Generates an empty controller called **<name>** in the `./plugins//controllers` folder. - -::: tip -The first letter of the filename will be uppercase. -::: +- **strapi generate:template <path>**
+ Generates a Strapi template at `` -## strapi generate:model + Example: `strapi generate:template ../strapi-template-name` will copy the required files and folders to a `template` directory inside `../strapi-template-name` -Create a new model. +## strapi routes:list -```bash -strapi generate:model [] +Display a list of all the available [routes](/developer-docs/latest/development/backend-customization/routes.md). -options: [--api |--plugin |--draft-and-publish ] +```sh +strapi routes:list ``` -- **strapi generate:model <name>**
- Generates an empty model called **<name>** in the `./api//models` folder. It will create two files. - The first one will be **<name>.js** which contains your lifecycle callbacks and another **<name>.settings.json** that will list your attributes and options. - - Example: `strapi generate:model category` will create these two files `./api/category/models/Category.js` and `./api/category/models/Category.settings.json`. - -- **strapi generate:model <name> <attribute:type>**
- Generates an empty model called **<name>** in the `./api//models` folder. The file **<name>.settings.json** will already contain a list of attribute with their associated **<type>**. - - Example: `strapi generate:model category name:string description:text` will create these two files `./api/category/models/Category.js` and `./api/category/models/Category.settings.json`. This last file will contain two attributes `name` with the type `string` and `description` with type `text`. - -- **strapi generate:model <name> --api <api>**
- Generates an empty model called **<name>** in the `./api//models` folder. - - Example: `strapi generate:model category --api product` will create these two files: - - - `./api/product/models/Category.js` - - `./api/product/models/Category.settings.json`. +## strapi policies:list -* **strapi generate:model <name> --plugin <plugin>**
- Generates an empty model called **<name>** in the `./plugins//models` folder. +Display a list of all the registered [policies](/developer-docs/latest/development/backend-customization/policies.md). -* **strapi generate:model <name> --draft-and-publish=true**
- Generates an empty model called **<name>** in the `./plugins//models` folder with the draft/publish feature enabled - -::: tip -The first letter of the filename will be uppercase. -::: - -## strapi generate:service - -Create a new service. - -```bash -strapi generate:service - -options: [--api |--plugin ] +```sh +strapi policies:list ``` -- **strapi generate:service <name>**
- Generates an empty service called **<name>** in the `./api//services` folder. - - Example: `strapi generate:service category` will create the service at `./api/category/services/Category.js`. - -- **strapi generate:service <name> --api <api>**
- Generates an empty service called **<name>** in the `./api//services` folder. +## strapi middlewares:list - Example: `strapi generate:service category --api product` will create the service at `./api/product/services/Category.js`. +Display a list of all the registered [middlewares](/developer-docs/latest/development/backend-customization/middlewares.md). -- **strapi generate:service <name> --plugin <plugin>**
- Generates an empty service called **<name>** in the `./plugins//services` folder. - -::: tip -The first letter of the filename will be uppercase. -::: - -## strapi generate:policy - -Create a new policy. - -```bash -strapi generate:policy - -options: [--api |--plugin ] +```sh +strapi middlewares:list ``` -- **strapi generate:policy <name>**
- Generates an empty policy called **<name>** in the `./config/policies` folder. - - Example: `strapi generate:policy isAuthenticated` will create the policy at `./config/policies/isAuthenticated.js`. +## strapi content-types:list -- **strapi generate:policy <name> --api <api>**
- Generates an empty policy called **<name>** in the `./api//config/policies` folder. This policy will be scoped and only accessible by the **<api>** routes. +Display a list of all the existing [content-types](/developer-docs/latest/development/backend-customization/models.md). - Example: `strapi generate:policy isAuthenticated --api product` will create the policy at `./api/product/config/policies/isAuthenticated.js`. - -- **strapi generate:policy <name> --plugin <plugin>**
- Generates an empty policy called **<name>** in the `./plugins//config/policies` folder. This policy will be scoped and accessible only by the **<plugin>** routes. - -## strapi generate:plugin - -Create a new plugin skeleton. - -```bash -strapi generate:plugin +```sh +strapi content-types:list ``` -- **strapi generate:plugin <name>**
- Generates an empty plugin called **<name>** in the `./plugins` folder. - - Example: `strapi generate:plugin user` will create the plugin at `./plugins/user`. - -Please refer to the [plugins development](/developer-docs/latest/development/plugins-development.md) section to know more. - -## strapi generate:template + +## strapi hooks:list -Create a template from the current strapi project +Display a list of all the available hooks. -```bash -strapi generate:template +```sh +strapi hooks:list ``` -- **strapi generate:template <path>**
- Generates a Strapi template at `` +## strapi services:list - Example: `strapi generate:template ../strapi-template-name` will copy the required files and folders to a `template` directory inside `../strapi-template-name` +Display a list of all the registered [services](/developer-docs/latest/development/backend-customization/services.md). +```sh +strapi services:list +``` ## strapi install diff --git a/docs/developer-docs/latest/development/backend-customization/models.md b/docs/developer-docs/latest/development/backend-customization/models.md index 832add5f7d..c782cab04c 100644 --- a/docs/developer-docs/latest/development/backend-customization/models.md +++ b/docs/developer-docs/latest/development/backend-customization/models.md @@ -26,7 +26,7 @@ Content-types and components models are created and stored differently. Content-types in Strapi can be created: - with the [Content-Types Builder in the admin panel](/user-docs/latest/content-types-builder/introduction-to-content-types-builder.md), -- or with [Strapi's CLI `generate:model`](/developer-docs/latest/developer-resources/cli/CLI.md#strapi-generate-model) command. +- or with [Strapi's interactive CLI `strapi generate`](/developer-docs/latest/developer-resources/cli/CLI.md#strapi-generate) command. Creating a content-type with either method generates 2 files: diff --git a/docs/developer-docs/latest/development/plugins-development.md b/docs/developer-docs/latest/development/plugins-development.md index f05966bba0..78c65529fd 100644 --- a/docs/developer-docs/latest/development/plugins-development.md +++ b/docs/developer-docs/latest/development/plugins-development.md @@ -17,8 +17,9 @@ To create a plugin, use Strapi CLI tools: 1. (_Optional_) If you don't already have an existing project, create a new development project with `strapi new myDevelopmentProject`. 2. Start the project with `cd myDevelopmentProject && strapi develop`. -3. In a new terminal window, [create a new plugin](/developer-docs/latest/developer-resources/cli/CLI.md#strapi-generate-plugin) with `cd /path/to/myDevelopmentProject && strapi generate:plugin my-plugin` -4. Enable the plugin by adding it to the [plugins configurations](/developer-docs/latest/setup-deployment-guides/configurations/optional/plugins.md) file: +3. In a new terminal window, run `cd /path/to/myDevelopmentProject && strapi generate` to launch the interactive `strapi generate` CLI. +4. Choose "plugin" from the list, press Enter, and give the plugin a name. +5. Enable the plugin by adding it to the [plugins configurations](/developer-docs/latest/setup-deployment-guides/configurations/optional/plugins.md) file: ```js // path: /path/to/myDevelopmentProject/config/plugins.js diff --git a/docs/developer-docs/latest/plugins/graphql.md b/docs/developer-docs/latest/plugins/graphql.md index 60ec4e2412..45b7340f15 100644 --- a/docs/developer-docs/latest/plugins/graphql.md +++ b/docs/developer-docs/latest/plugins/graphql.md @@ -75,7 +75,7 @@ To simplify and automate the build of the GraphQL schema, we introduced the Shad **Example:** -If you've generated an API called `Restaurant` using the CLI `strapi generate:api restaurant` or the administration panel, your model looks like this: +If you've generated an API called `Restaurant` using [the interactive `strapi generate` CLI](/developer-docs/latest/developer-resources/cli/CLI.md#strapi-generate) or the administration panel, your model looks like this: ```json // path: ./src/api/[api-name]/content-types/restaurant/schema.json