mirror of
https://github.com/strapi/strapi.git
synced 2025-09-26 00:39:49 +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/>
|
||||
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/>
|
||||
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
|
||||
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/>
|
||||
@ -235,6 +238,9 @@ options: [--api <name>|--plugin <name>]
|
||||
* **strapi generate:model <name> --plugin <plugin>**<br/>
|
||||
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
|
||||
The first letter of the filename will be uppercase.
|
||||
:::
|
||||
|
@ -128,7 +128,7 @@ module.exports = (scope, cb) => {
|
||||
description: scope.description,
|
||||
},
|
||||
options: {
|
||||
draftAndPublish: false,
|
||||
draftAndPublish: scope.args.draftAndPublish === 'true',
|
||||
increments: true,
|
||||
timestamps: true,
|
||||
comment: '',
|
||||
|
@ -129,7 +129,7 @@ module.exports = (scope, cb) => {
|
||||
description: scope.description,
|
||||
},
|
||||
options: {
|
||||
draftAndPublish: false,
|
||||
draftAndPublish: scope.args.draftAndPublish === 'true',
|
||||
timestamps: true,
|
||||
increments: true,
|
||||
comment: '',
|
||||
|
@ -185,7 +185,7 @@ module.exports = function createComponentBuilder() {
|
||||
.set('kind', infos.kind || contentType.schema.kind)
|
||||
.set(['info', 'name'], infos.name)
|
||||
.set(['info', 'description'], infos.description)
|
||||
.setSchemaOption(['draftAndPublish'], infos.draftAndPublish)
|
||||
.setSchemaOption(['draftAndPublish'], infos.draftAndPublish || false)
|
||||
.setAttributes(this.convertAttributes(newAttributes));
|
||||
|
||||
return contentType;
|
||||
|
@ -137,6 +137,7 @@ program
|
||||
.option('-p, --plugin <api>', 'Name of the local plugin')
|
||||
.option('-e, --extend <api>', 'Name of the plugin to extend')
|
||||
.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')
|
||||
.action((id, attributes, cliArguments) => {
|
||||
cliArguments.attributes = attributes;
|
||||
@ -158,6 +159,7 @@ program
|
||||
.option('-a, --api <api>', 'API name to generate a sub API')
|
||||
.option('-p, --plugin <api>', 'plugin name')
|
||||
.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')
|
||||
.action((id, attributes, cliArguments) => {
|
||||
cliArguments.attributes = attributes;
|
||||
|
Loading…
x
Reference in New Issue
Block a user