mirror of
https://github.com/strapi/strapi.git
synced 2025-09-27 17:29:14 +00:00
Add draft/publish to CLI
Signed-off-by: soupette <cyril.lpz@gmail.com>
This commit is contained in:
parent
3b3ea84685
commit
7ec435b36e
@ -162,6 +162,9 @@ options: [--plugin <name>]
|
|||||||
- **strapi generate:api <name>**<br/>
|
- **strapi generate:api <name>**<br/>
|
||||||
Generates an API called **<name>** in the `./api` folder at the root of your project.
|
Generates an API called **<name>** in the `./api` folder at the root of your project.
|
||||||
|
|
||||||
|
- **strapi generate:api --draft-and-publish=true**<br/>
|
||||||
|
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>**<br/>
|
- **strapi generate:api <name> <attribute:type>**<br/>
|
||||||
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>**.
|
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>**.
|
||||||
|
|
||||||
@ -210,7 +213,7 @@ Create a new model.
|
|||||||
```bash
|
```bash
|
||||||
strapi generate:model <name> [<attribute:type>]
|
strapi generate:model <name> [<attribute:type>]
|
||||||
|
|
||||||
options: [--api <name>|--plugin <name>]
|
options: [--api <name>|--plugin <name>|--draft-and-publish <boolean>]
|
||||||
```
|
```
|
||||||
|
|
||||||
- **strapi generate:model <name>**<br/>
|
- **strapi generate:model <name>**<br/>
|
||||||
@ -235,6 +238,9 @@ options: [--api <name>|--plugin <name>]
|
|||||||
* **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.
|
||||||
|
|
||||||
|
* **strapi generate:model <name> --draft-and-publish=true**<br/>
|
||||||
|
Generates an empty model called **<name>** in the `./plugins/<plugin>/models` folder with the draft/publish feature enabled
|
||||||
|
|
||||||
::: tip
|
::: tip
|
||||||
The first letter of the filename will be uppercase.
|
The first letter of the filename will be uppercase.
|
||||||
:::
|
:::
|
||||||
|
@ -128,7 +128,7 @@ module.exports = (scope, cb) => {
|
|||||||
description: scope.description,
|
description: scope.description,
|
||||||
},
|
},
|
||||||
options: {
|
options: {
|
||||||
draftAndPublish: false,
|
draftAndPublish: scope.args.draftAndPublish === 'true',
|
||||||
increments: true,
|
increments: true,
|
||||||
timestamps: true,
|
timestamps: true,
|
||||||
comment: '',
|
comment: '',
|
||||||
|
@ -129,7 +129,7 @@ module.exports = (scope, cb) => {
|
|||||||
description: scope.description,
|
description: scope.description,
|
||||||
},
|
},
|
||||||
options: {
|
options: {
|
||||||
draftAndPublish: false,
|
draftAndPublish: scope.args.draftAndPublish === 'true',
|
||||||
timestamps: true,
|
timestamps: true,
|
||||||
increments: true,
|
increments: true,
|
||||||
comment: '',
|
comment: '',
|
||||||
|
@ -185,7 +185,7 @@ module.exports = function createComponentBuilder() {
|
|||||||
.set('kind', infos.kind || contentType.schema.kind)
|
.set('kind', infos.kind || contentType.schema.kind)
|
||||||
.set(['info', 'name'], infos.name)
|
.set(['info', 'name'], infos.name)
|
||||||
.set(['info', 'description'], infos.description)
|
.set(['info', 'description'], infos.description)
|
||||||
.setSchemaOption(['draftAndPublish'], infos.draftAndPublish)
|
.setSchemaOption(['draftAndPublish'], infos.draftAndPublish || false)
|
||||||
.setAttributes(this.convertAttributes(newAttributes));
|
.setAttributes(this.convertAttributes(newAttributes));
|
||||||
|
|
||||||
return contentType;
|
return contentType;
|
||||||
|
@ -137,6 +137,7 @@ program
|
|||||||
.option('-p, --plugin <api>', 'Name of the local plugin')
|
.option('-p, --plugin <api>', 'Name of the local plugin')
|
||||||
.option('-e, --extend <api>', 'Name of the plugin to extend')
|
.option('-e, --extend <api>', 'Name of the plugin to extend')
|
||||||
.option('-c, --connection <connection>', 'The name of the connection to use')
|
.option('-c, --connection <connection>', 'The name of the connection to use')
|
||||||
|
.option('--draft-and-publish <value>', 'Enable draft/publish', false)
|
||||||
.description('generate a basic API')
|
.description('generate a basic API')
|
||||||
.action((id, attributes, cliArguments) => {
|
.action((id, attributes, cliArguments) => {
|
||||||
cliArguments.attributes = attributes;
|
cliArguments.attributes = attributes;
|
||||||
@ -158,6 +159,7 @@ program
|
|||||||
.option('-a, --api <api>', 'API name to generate a sub API')
|
.option('-a, --api <api>', 'API name to generate a sub API')
|
||||||
.option('-p, --plugin <api>', 'plugin name')
|
.option('-p, --plugin <api>', 'plugin name')
|
||||||
.option('-c, --connection <connection>', 'The name of the connection to use')
|
.option('-c, --connection <connection>', 'The name of the connection to use')
|
||||||
|
.option('--draft-and-publish <value>', 'Enable draft/publish', false)
|
||||||
.description('generate a model for an API')
|
.description('generate a model for an API')
|
||||||
.action((id, attributes, cliArguments) => {
|
.action((id, attributes, cliArguments) => {
|
||||||
cliArguments.attributes = attributes;
|
cliArguments.attributes = attributes;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user