@strapi/generators 4.0.0-next.11 → 4.0.0-next.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.js +3 -3
- package/lib/plops/api.js +2 -2
- package/lib/plops/controller.js +1 -1
- package/lib/plops/model.js +3 -3
- package/lib/plops/plugin.js +1 -1
- package/lib/plops/policy.js +1 -1
- package/lib/plops/service.js +1 -1
- package/lib/plops/utils/get-destination-prompts.js +2 -2
- package/package.json +2 -2
package/lib/index.js
CHANGED
|
@@ -25,9 +25,9 @@ const generate = async (generatorName, options, { dir = process.cwd() } = {}) =>
|
|
|
25
25
|
|
|
26
26
|
const generator = plop.getGenerator(generatorName);
|
|
27
27
|
await generator.runActions(options, {
|
|
28
|
-
onSuccess
|
|
29
|
-
onFailure
|
|
30
|
-
onComment
|
|
28
|
+
onSuccess() {},
|
|
29
|
+
onFailure() {},
|
|
30
|
+
onComment() {},
|
|
31
31
|
});
|
|
32
32
|
};
|
|
33
33
|
|
package/lib/plops/api.js
CHANGED
|
@@ -25,7 +25,7 @@ module.exports = plop => {
|
|
|
25
25
|
type: 'list',
|
|
26
26
|
name: 'plugin',
|
|
27
27
|
message: 'Plugin name',
|
|
28
|
-
|
|
28
|
+
async choices() {
|
|
29
29
|
const pluginsPath = join(plop.getDestBasePath(), 'plugins');
|
|
30
30
|
const exists = await fs.pathExists(pluginsPath);
|
|
31
31
|
|
|
@@ -60,7 +60,7 @@ module.exports = plop => {
|
|
|
60
60
|
message: 'Use draft and publish?',
|
|
61
61
|
},
|
|
62
62
|
],
|
|
63
|
-
actions
|
|
63
|
+
actions(answers) {
|
|
64
64
|
let filePath;
|
|
65
65
|
if (answers.isPluginApi && answers.plugin) {
|
|
66
66
|
filePath = `plugins/{{plugin}}`;
|
package/lib/plops/controller.js
CHANGED
package/lib/plops/model.js
CHANGED
|
@@ -106,7 +106,7 @@ module.exports = plop => {
|
|
|
106
106
|
// Model generator
|
|
107
107
|
plop.setGenerator('model', {
|
|
108
108
|
description: 'Generate a model for an API',
|
|
109
|
-
|
|
109
|
+
async prompts(inquirer) {
|
|
110
110
|
const config = await promptConfigQuestions(plop, inquirer);
|
|
111
111
|
|
|
112
112
|
if (!config.addAttributes) {
|
|
@@ -135,7 +135,7 @@ module.exports = plop => {
|
|
|
135
135
|
attributes,
|
|
136
136
|
};
|
|
137
137
|
},
|
|
138
|
-
actions
|
|
138
|
+
actions(answers) {
|
|
139
139
|
const attributes = answers.attributes.reduce((object, answer) => {
|
|
140
140
|
const val = { type: answer.attributeType };
|
|
141
141
|
|
|
@@ -162,7 +162,7 @@ module.exports = plop => {
|
|
|
162
162
|
{
|
|
163
163
|
type: 'modify',
|
|
164
164
|
path: `${filePath}/content-types/{{id}}/schema.json`,
|
|
165
|
-
transform
|
|
165
|
+
transform(template) {
|
|
166
166
|
const parsedTemplate = JSON.parse(template);
|
|
167
167
|
parsedTemplate.attributes = attributes;
|
|
168
168
|
return JSON.stringify(parsedTemplate, null, 2);
|
package/lib/plops/plugin.js
CHANGED
package/lib/plops/policy.js
CHANGED
package/lib/plops/service.js
CHANGED
|
@@ -22,7 +22,7 @@ module.exports = (action, basePath) => {
|
|
|
22
22
|
type: 'list',
|
|
23
23
|
message: 'Which API is this for?',
|
|
24
24
|
name: 'api',
|
|
25
|
-
|
|
25
|
+
async choices() {
|
|
26
26
|
const apiPath = join(basePath, 'api');
|
|
27
27
|
const exists = await fs.pathExists(apiPath);
|
|
28
28
|
|
|
@@ -45,7 +45,7 @@ module.exports = (action, basePath) => {
|
|
|
45
45
|
type: 'list',
|
|
46
46
|
message: 'Which plugin is this for?',
|
|
47
47
|
name: 'plugin',
|
|
48
|
-
|
|
48
|
+
async choices() {
|
|
49
49
|
const pluginsPath = join(basePath, 'plugins');
|
|
50
50
|
const exists = await fs.pathExists(pluginsPath);
|
|
51
51
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@strapi/generators",
|
|
3
|
-
"version": "4.0.0-next.
|
|
3
|
+
"version": "4.0.0-next.15",
|
|
4
4
|
"description": "Interactive API generator.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"strapi",
|
|
@@ -38,5 +38,5 @@
|
|
|
38
38
|
"node": ">=12.x.x <=16.x.x",
|
|
39
39
|
"npm": ">=6.0.0"
|
|
40
40
|
},
|
|
41
|
-
"gitHead": "
|
|
41
|
+
"gitHead": "3d2740ae0d80d9ed61d1429a92756bbe39fa97be"
|
|
42
42
|
}
|