@strapi/generators 0.0.0-next.fd9757603c653ca239c45d6e28ab536d2dae0b39 → 0.0.0-next.fdac61dd05ca665168f51f655f1d165b55ec4231

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.
Files changed (92) hide show
  1. package/dist/index.d.ts +2 -2
  2. package/dist/index.d.ts.map +1 -1
  3. package/dist/index.js +33 -26
  4. package/dist/index.js.map +1 -1
  5. package/dist/index.mjs +32 -26
  6. package/dist/index.mjs.map +1 -1
  7. package/dist/plopfile.d.ts +1 -1
  8. package/dist/plopfile.d.ts.map +1 -1
  9. package/dist/plopfile.js +621 -667
  10. package/dist/plopfile.js.map +1 -1
  11. package/dist/plopfile.mjs +621 -645
  12. package/dist/plopfile.mjs.map +1 -1
  13. package/dist/plops/api.d.ts +1 -1
  14. package/dist/plops/api.d.ts.map +1 -1
  15. package/dist/plops/content-type.d.ts +1 -1
  16. package/dist/plops/content-type.d.ts.map +1 -1
  17. package/dist/plops/controller.d.ts +1 -1
  18. package/dist/plops/controller.d.ts.map +1 -1
  19. package/dist/plops/middleware.d.ts +1 -1
  20. package/dist/plops/middleware.d.ts.map +1 -1
  21. package/dist/plops/migration.d.ts +1 -1
  22. package/dist/plops/migration.d.ts.map +1 -1
  23. package/dist/plops/policy.d.ts +1 -1
  24. package/dist/plops/policy.d.ts.map +1 -1
  25. package/dist/plops/service.d.ts +1 -1
  26. package/dist/plops/service.d.ts.map +1 -1
  27. package/dist/plops/utils/get-file-path.d.ts +1 -1
  28. package/dist/templates/js/content-type.schema.json.hbs +0 -1
  29. package/dist/templates/ts/content-type.schema.json.hbs +0 -1
  30. package/dist/templates/ts/middleware.ts.hbs +2 -2
  31. package/package.json +16 -14
  32. package/dist/files/js/plugin/.gitattributes +0 -103
  33. package/dist/files/js/plugin/admin/src/components/Initializer/index.js +0 -26
  34. package/dist/files/js/plugin/admin/src/components/PluginIcon/index.js +0 -12
  35. package/dist/files/js/plugin/admin/src/index.js +0 -61
  36. package/dist/files/js/plugin/admin/src/pages/App/index.js +0 -25
  37. package/dist/files/js/plugin/admin/src/pages/HomePage/index.js +0 -20
  38. package/dist/files/js/plugin/admin/src/pluginId.js +0 -5
  39. package/dist/files/js/plugin/admin/src/translations/en.json +0 -1
  40. package/dist/files/js/plugin/admin/src/translations/fr.json +0 -1
  41. package/dist/files/js/plugin/admin/src/utils/getTrad.js +0 -5
  42. package/dist/files/js/plugin/server/bootstrap.js +0 -5
  43. package/dist/files/js/plugin/server/config/index.js +0 -6
  44. package/dist/files/js/plugin/server/content-types/index.js +0 -3
  45. package/dist/files/js/plugin/server/controllers/index.js +0 -7
  46. package/dist/files/js/plugin/server/controllers/my-controller.js.hbs +0 -10
  47. package/dist/files/js/plugin/server/destroy.js +0 -5
  48. package/dist/files/js/plugin/server/index.js +0 -25
  49. package/dist/files/js/plugin/server/middlewares/index.js +0 -3
  50. package/dist/files/js/plugin/server/policies/index.js +0 -3
  51. package/dist/files/js/plugin/server/register.js +0 -5
  52. package/dist/files/js/plugin/server/routes/index.js +0 -10
  53. package/dist/files/js/plugin/server/services/index.js +0 -7
  54. package/dist/files/js/plugin/server/services/my-service.js +0 -7
  55. package/dist/files/js/plugin/strapi-admin.js +0 -3
  56. package/dist/files/js/plugin/strapi-server.js +0 -3
  57. package/dist/files/ts/plugin/.gitattributes +0 -103
  58. package/dist/files/ts/plugin/admin/src/components/Initializer/index.tsx +0 -24
  59. package/dist/files/ts/plugin/admin/src/components/PluginIcon/index.tsx +0 -12
  60. package/dist/files/ts/plugin/admin/src/index.tsx +0 -67
  61. package/dist/files/ts/plugin/admin/src/pages/App/index.tsx +0 -25
  62. package/dist/files/ts/plugin/admin/src/pages/HomePage/index.tsx +0 -19
  63. package/dist/files/ts/plugin/admin/src/pluginId.ts +0 -5
  64. package/dist/files/ts/plugin/admin/src/translations/en.json +0 -1
  65. package/dist/files/ts/plugin/admin/src/translations/fr.json +0 -1
  66. package/dist/files/ts/plugin/admin/src/utils/getTrad.ts +0 -5
  67. package/dist/files/ts/plugin/custom.d.ts +0 -5
  68. package/dist/files/ts/plugin/server/bootstrap.ts +0 -5
  69. package/dist/files/ts/plugin/server/config/index.ts +0 -4
  70. package/dist/files/ts/plugin/server/content-types/index.ts +0 -1
  71. package/dist/files/ts/plugin/server/controllers/index.ts +0 -5
  72. package/dist/files/ts/plugin/server/controllers/my-controller.ts.hbs +0 -10
  73. package/dist/files/ts/plugin/server/destroy.ts +0 -5
  74. package/dist/files/ts/plugin/server/index.ts +0 -23
  75. package/dist/files/ts/plugin/server/middlewares/index.ts +0 -1
  76. package/dist/files/ts/plugin/server/policies/index.ts +0 -1
  77. package/dist/files/ts/plugin/server/register.ts +0 -5
  78. package/dist/files/ts/plugin/server/routes/index.ts +0 -10
  79. package/dist/files/ts/plugin/server/services/index.ts +0 -5
  80. package/dist/files/ts/plugin/server/services/my-service.ts +0 -7
  81. package/dist/files/ts/plugin/strapi-admin.js +0 -3
  82. package/dist/files/ts/plugin/strapi-server.js +0 -3
  83. package/dist/files/ts/plugin/tsconfig.json +0 -20
  84. package/dist/files/ts/plugin/tsconfig.server.json +0 -25
  85. package/dist/plops/plugin.d.ts +0 -4
  86. package/dist/plops/plugin.d.ts.map +0 -1
  87. package/dist/plops/prompts/draft-and-publish-prompts.d.ts +0 -4
  88. package/dist/plops/prompts/draft-and-publish-prompts.d.ts.map +0 -1
  89. package/dist/templates/js/README.md.hbs +0 -3
  90. package/dist/templates/js/plugin-package.json.hbs +0 -42
  91. package/dist/templates/ts/README.md.hbs +0 -3
  92. package/dist/templates/ts/plugin-package.json.hbs +0 -51
package/dist/plopfile.mjs CHANGED
@@ -1,679 +1,655 @@
1
- import pluralize from "pluralize";
2
- import { join } from "path";
3
- import fs from "fs-extra";
4
- import tsUtils from "@strapi/typescript-utils";
5
- import slugify from "@sindresorhus/slugify";
6
- import * as utils from "@strapi/utils";
7
- import chalk from "chalk";
8
- const validateInput = (input) => {
9
- const regex = /^[A-Za-z-]+$/g;
10
- if (!input) {
11
- return "You must provide an input";
12
- }
13
- return regex.test(input) || "Please use only letters, '-' and no spaces";
14
- };
15
- const generateApi = (plop) => {
16
- plop.setGenerator("api", {
17
- description: "Generate a basic API",
18
- prompts: [
19
- {
20
- type: "input",
21
- name: "id",
22
- message: "API name",
23
- validate: (input) => validateInput(input)
24
- },
25
- {
26
- type: "confirm",
27
- name: "isPluginApi",
28
- message: "Is this API for a plugin?"
29
- },
30
- {
31
- when: (answers) => answers.isPluginApi,
32
- type: "list",
33
- name: "plugin",
34
- message: "Plugin name",
35
- async choices() {
36
- const pluginsPath = join(plop.getDestBasePath(), "plugins");
37
- const exists = await fs.pathExists(pluginsPath);
38
- if (!exists) {
39
- throw Error(`Couldn't find a "plugins" directory`);
40
- }
41
- const pluginsDir = await fs.readdir(pluginsPath, { withFileTypes: true });
42
- const pluginsDirContent = pluginsDir.filter((fd) => fd.isDirectory());
43
- if (pluginsDirContent.length === 0) {
44
- throw Error('The "plugins" directory is empty');
45
- }
46
- return pluginsDirContent;
1
+ import pluralize from 'pluralize';
2
+ import { join } from 'path';
3
+ import fs from 'fs-extra';
4
+ import tsUtils from '@strapi/typescript-utils';
5
+ import slugify from '@sindresorhus/slugify';
6
+ import { strings } from '@strapi/utils';
7
+
8
+ var validateInput = ((input)=>{
9
+ const regex = /^[A-Za-z-]+$/g;
10
+ if (!input) {
11
+ return 'You must provide an input';
12
+ }
13
+ return regex.test(input) || "Please use only letters, '-' and no spaces";
14
+ });
15
+
16
+ var generateApi = ((plop)=>{
17
+ // API generator
18
+ plop.setGenerator('api', {
19
+ description: 'Generate a basic API',
20
+ prompts: [
21
+ {
22
+ type: 'input',
23
+ name: 'id',
24
+ message: 'API name',
25
+ validate: (input)=>validateInput(input)
26
+ },
27
+ {
28
+ type: 'confirm',
29
+ name: 'isPluginApi',
30
+ message: 'Is this API for a plugin?'
31
+ },
32
+ {
33
+ when: (answers)=>answers.isPluginApi,
34
+ type: 'list',
35
+ name: 'plugin',
36
+ message: 'Plugin name',
37
+ async choices () {
38
+ const pluginsPath = join(plop.getDestBasePath(), 'plugins');
39
+ const exists = await fs.pathExists(pluginsPath);
40
+ if (!exists) {
41
+ throw Error('Couldn\'t find a "plugins" directory');
42
+ }
43
+ const pluginsDir = await fs.readdir(pluginsPath, {
44
+ withFileTypes: true
45
+ });
46
+ const pluginsDirContent = pluginsDir.filter((fd)=>fd.isDirectory());
47
+ if (pluginsDirContent.length === 0) {
48
+ throw Error('The "plugins" directory is empty');
49
+ }
50
+ return pluginsDirContent;
51
+ }
52
+ }
53
+ ],
54
+ actions (answers) {
55
+ if (!answers) {
56
+ return [];
57
+ }
58
+ const filePath = answers.isPluginApi && answers.plugin ? 'plugins/{{ plugin }}/server' : 'api/{{ id }}';
59
+ const currentDir = process.cwd();
60
+ const language = tsUtils.isUsingTypeScriptSync(currentDir) ? 'ts' : 'js';
61
+ const baseActions = [
62
+ {
63
+ type: 'add',
64
+ path: `${filePath}/controllers/{{ id }}.${language}`,
65
+ templateFile: `templates/${language}/controller.${language}.hbs`
66
+ },
67
+ {
68
+ type: 'add',
69
+ path: `${filePath}/services/{{ id }}.${language}`,
70
+ templateFile: `templates/${language}/service.${language}.hbs`
71
+ }
72
+ ];
73
+ if (answers.isPluginApi) {
74
+ return baseActions;
75
+ }
76
+ return [
77
+ {
78
+ type: 'add',
79
+ path: `${filePath}/routes/{{ id }}.${language}`,
80
+ templateFile: `templates/${language}/single-route.${language}.hbs`
81
+ },
82
+ ...baseActions
83
+ ];
47
84
  }
48
- }
49
- ],
50
- actions(answers) {
51
- if (!answers) {
52
- return [];
53
- }
54
- const filePath = answers.isPluginApi && answers.plugin ? "plugins/{{ plugin }}" : "api/{{ id }}";
55
- const currentDir = process.cwd();
56
- const language = tsUtils.isUsingTypeScriptSync(currentDir) ? "ts" : "js";
57
- const baseActions = [
85
+ });
86
+ });
87
+
88
+ var getDestinationPrompts = ((action, basePath, { rootFolder = false } = {})=>{
89
+ return [
58
90
  {
59
- type: "add",
60
- path: `${filePath}/controllers/{{ id }}.${language}`,
61
- templateFile: `templates/${language}/controller.${language}.hbs`
91
+ type: 'list',
92
+ name: 'destination',
93
+ message: `Where do you want to add this ${action}?`,
94
+ choices: [
95
+ ...rootFolder ? [
96
+ {
97
+ name: `Add ${action} to root of project`,
98
+ value: 'root'
99
+ }
100
+ ] : [
101
+ {
102
+ name: `Add ${action} to new API`,
103
+ value: 'new'
104
+ }
105
+ ],
106
+ {
107
+ name: `Add ${action} to an existing API`,
108
+ value: 'api'
109
+ },
110
+ {
111
+ name: `Add ${action} to an existing plugin`,
112
+ value: 'plugin'
113
+ }
114
+ ]
62
115
  },
63
116
  {
64
- type: "add",
65
- path: `${filePath}/services/{{ id }}.${language}`,
66
- templateFile: `templates/${language}/service.${language}.hbs`
67
- }
68
- ];
69
- if (answers.isPluginApi) {
70
- return baseActions;
71
- }
72
- return [
73
- {
74
- type: "add",
75
- path: `${filePath}/routes/{{ id }}.${language}`,
76
- templateFile: `templates/${language}/single-route.${language}.hbs`
117
+ when: (answers)=>answers.destination === 'api',
118
+ type: 'list',
119
+ message: 'Which API is this for?',
120
+ name: 'api',
121
+ async choices () {
122
+ const apiPath = join(basePath, 'api');
123
+ const exists = await fs.pathExists(apiPath);
124
+ if (!exists) {
125
+ throw Error('Couldn\'t find an "api" directory');
126
+ }
127
+ const apiDir = await fs.readdir(apiPath, {
128
+ withFileTypes: true
129
+ });
130
+ const apiDirContent = apiDir.filter((fd)=>fd.isDirectory());
131
+ if (apiDirContent.length === 0) {
132
+ throw Error('The "api" directory is empty');
133
+ }
134
+ return apiDirContent;
135
+ }
77
136
  },
78
- ...baseActions
79
- ];
137
+ {
138
+ when: (answers)=>answers.destination === 'plugin',
139
+ type: 'list',
140
+ message: 'Which plugin is this for?',
141
+ name: 'plugin',
142
+ async choices () {
143
+ const pluginsPath = join(basePath, 'plugins');
144
+ const exists = await fs.pathExists(pluginsPath);
145
+ if (!exists) {
146
+ throw Error('Couldn\'t find a "plugins" directory');
147
+ }
148
+ const pluginsDir = await fs.readdir(pluginsPath);
149
+ const pluginsDirContent = pluginsDir.filter((api)=>fs.lstatSync(join(pluginsPath, api)).isDirectory());
150
+ if (pluginsDirContent.length === 0) {
151
+ throw Error('The "plugins" directory is empty');
152
+ }
153
+ return pluginsDirContent;
154
+ }
155
+ }
156
+ ];
157
+ });
158
+
159
+ var getFilePath = ((destination)=>{
160
+ if (destination === 'api') {
161
+ return `api/{{ api }}`;
80
162
  }
81
- });
82
- };
83
- const getDestinationPrompts = (action, basePath, { rootFolder = false } = {}) => {
84
- return [
85
- {
86
- type: "list",
87
- name: "destination",
88
- message: `Where do you want to add this ${action}?`,
89
- choices: [
90
- ...rootFolder ? [
91
- {
92
- name: `Add ${action} to root of project`,
93
- value: "root"
94
- }
95
- ] : [
96
- {
97
- name: `Add ${action} to new API`,
98
- value: "new"
99
- }
163
+ if (destination === 'plugin') {
164
+ return `plugins/{{ plugin }}/server`;
165
+ }
166
+ if (destination === 'root') {
167
+ return './';
168
+ }
169
+ return `api/{{ id }}`;
170
+ });
171
+
172
+ var generateController = ((plop)=>{
173
+ // Controller generator
174
+ plop.setGenerator('controller', {
175
+ description: 'Generate a controller for an API',
176
+ prompts: [
177
+ {
178
+ type: 'input',
179
+ name: 'id',
180
+ message: 'Controller name',
181
+ validate: (input)=>validateInput(input)
182
+ },
183
+ ...getDestinationPrompts('controller', plop.getDestBasePath())
100
184
  ],
101
- { name: `Add ${action} to an existing API`, value: "api" },
102
- { name: `Add ${action} to an existing plugin`, value: "plugin" }
103
- ]
185
+ actions (answers) {
186
+ if (!answers) {
187
+ return [];
188
+ }
189
+ const filePath = getFilePath(answers.destination);
190
+ const currentDir = process.cwd();
191
+ const language = tsUtils.isUsingTypeScriptSync(currentDir) ? 'ts' : 'js';
192
+ return [
193
+ {
194
+ type: 'add',
195
+ path: `${filePath}/controllers/{{ id }}.${language}`,
196
+ templateFile: `templates/${language}/controller.${language}.hbs`
197
+ }
198
+ ];
199
+ }
200
+ });
201
+ });
202
+
203
+ const questions$2 = [
204
+ {
205
+ type: 'input',
206
+ name: 'displayName',
207
+ message: 'Content type display name',
208
+ validate: (input)=>!!input
104
209
  },
105
210
  {
106
- when: (answers) => answers.destination === "api",
107
- type: "list",
108
- message: "Which API is this for?",
109
- name: "api",
110
- async choices() {
111
- const apiPath = join(basePath, "api");
112
- const exists = await fs.pathExists(apiPath);
113
- if (!exists) {
114
- throw Error(`Couldn't find an "api" directory`);
115
- }
116
- const apiDir = await fs.readdir(apiPath, { withFileTypes: true });
117
- const apiDirContent = apiDir.filter((fd) => fd.isDirectory());
118
- if (apiDirContent.length === 0) {
119
- throw Error('The "api" directory is empty');
211
+ type: 'input',
212
+ name: 'singularName',
213
+ message: 'Content type singular name',
214
+ default: (answers)=>slugify(answers.displayName),
215
+ validate (input) {
216
+ if (!strings.isKebabCase(input)) {
217
+ return 'Value must be in kebab-case';
218
+ }
219
+ return true;
120
220
  }
121
- return apiDirContent;
122
- }
123
221
  },
124
222
  {
125
- when: (answers) => answers.destination === "plugin",
126
- type: "list",
127
- message: "Which plugin is this for?",
128
- name: "plugin",
129
- async choices() {
130
- const pluginsPath = join(basePath, "plugins");
131
- const exists = await fs.pathExists(pluginsPath);
132
- if (!exists) {
133
- throw Error(`Couldn't find a "plugins" directory`);
134
- }
135
- const pluginsDir = await fs.readdir(pluginsPath);
136
- const pluginsDirContent = pluginsDir.filter(
137
- (api) => fs.lstatSync(join(pluginsPath, api)).isDirectory()
138
- );
139
- if (pluginsDirContent.length === 0) {
140
- throw Error('The "plugins" directory is empty');
141
- }
142
- return pluginsDirContent;
143
- }
144
- }
145
- ];
146
- };
147
- const getFilePath = (destination) => {
148
- if (destination === "api") {
149
- return `api/{{ api }}`;
150
- }
151
- if (destination === "plugin") {
152
- return `plugins/{{ plugin }}/server`;
153
- }
154
- if (destination === "root") {
155
- return "./";
156
- }
157
- return `api/{{ id }}`;
158
- };
159
- const generateController = (plop) => {
160
- plop.setGenerator("controller", {
161
- description: "Generate a controller for an API",
162
- prompts: [
163
- {
164
- type: "input",
165
- name: "id",
166
- message: "Controller name",
167
- validate: (input) => validateInput(input)
168
- },
169
- ...getDestinationPrompts("controller", plop.getDestBasePath())
170
- ],
171
- actions(answers) {
172
- if (!answers) {
173
- return [];
174
- }
175
- const filePath = getFilePath(answers.destination);
176
- const currentDir = process.cwd();
177
- const language = tsUtils.isUsingTypeScriptSync(currentDir) ? "ts" : "js";
178
- return [
179
- {
180
- type: "add",
181
- path: `${filePath}/controllers/{{ id }}.${language}`,
182
- templateFile: `templates/${language}/controller.${language}.hbs`
223
+ type: 'input',
224
+ name: 'pluralName',
225
+ message: 'Content type plural name',
226
+ default: (answers)=>pluralize(answers.singularName),
227
+ validate (input, answers) {
228
+ if (answers.singularName === input) {
229
+ return 'Singular and plural names cannot be the same';
230
+ }
231
+ if (!strings.isKebabCase(input)) {
232
+ return 'Value must be in kebab-case';
233
+ }
234
+ return true;
183
235
  }
184
- ];
185
- }
186
- });
187
- };
188
- const questions$3 = [
189
- {
190
- type: "input",
191
- name: "displayName",
192
- message: "Content type display name",
193
- validate: (input) => !!input
194
- },
195
- {
196
- type: "input",
197
- name: "singularName",
198
- message: "Content type singular name",
199
- default: (answers) => slugify(answers.displayName),
200
- validate(input) {
201
- if (!utils.isKebabCase(input)) {
202
- return "Value must be in kebab-case";
203
- }
204
- return true;
205
236
  }
206
- },
207
- {
208
- type: "input",
209
- name: "pluralName",
210
- message: "Content type plural name",
211
- default: (answers) => pluralize(answers.singularName),
212
- validate(input, answers) {
213
- if (answers.singularName === input) {
214
- return "Singular and plural names cannot be the same";
215
- }
216
- if (!utils.isKebabCase(input)) {
217
- return "Value must be in kebab-case";
218
- }
219
- return true;
220
- }
221
- }
222
- ];
223
- const questions$2 = [
224
- {
225
- type: "list",
226
- name: "kind",
227
- message: "Please choose the model type",
228
- default: "collectionType",
229
- choices: [
230
- { name: "Collection Type", value: "collectionType" },
231
- { name: "Single Type", value: "singleType" }
232
- ],
233
- validate: (input) => validateInput(input)
234
- }
235
237
  ];
238
+
236
239
  const questions$1 = [
237
- {
238
- type: "confirm",
239
- name: "useDraftAndPublish",
240
- default: false,
241
- message: "Use draft and publish?"
242
- }
240
+ {
241
+ type: 'list',
242
+ name: 'kind',
243
+ message: 'Please choose the model type',
244
+ default: 'collectionType',
245
+ choices: [
246
+ {
247
+ name: 'Collection Type',
248
+ value: 'collectionType'
249
+ },
250
+ {
251
+ name: 'Single Type',
252
+ value: 'singleType'
253
+ }
254
+ ],
255
+ validate: (input)=>validateInput(input)
256
+ }
243
257
  ];
244
- const validateAttributeInput = (input) => {
245
- const regex = /^[A-Za-z-|_]+$/g;
246
- if (!input) {
247
- return "You must provide an input";
248
- }
249
- return regex.test(input) || "Please use only letters, '-', '_', and no spaces";
250
- };
258
+
259
+ var validateAttributeInput = ((input)=>{
260
+ const regex = /^[A-Za-z-|_]+$/g;
261
+ if (!input) {
262
+ return 'You must provide an input';
263
+ }
264
+ return regex.test(input) || "Please use only letters, '-', '_', and no spaces";
265
+ });
266
+
251
267
  const DEFAULT_TYPES = [
252
- // advanced types
253
- "media",
254
- // scalar types
255
- "string",
256
- "text",
257
- "richtext",
258
- "json",
259
- "enumeration",
260
- "password",
261
- "email",
262
- "integer",
263
- "biginteger",
264
- "float",
265
- "decimal",
266
- "date",
267
- "time",
268
- "datetime",
269
- "timestamp",
270
- "boolean"
268
+ // advanced types
269
+ 'media',
270
+ // scalar types
271
+ 'string',
272
+ 'text',
273
+ 'richtext',
274
+ 'json',
275
+ 'enumeration',
276
+ 'password',
277
+ 'email',
278
+ 'integer',
279
+ 'biginteger',
280
+ 'float',
281
+ 'decimal',
282
+ 'date',
283
+ 'time',
284
+ 'datetime',
285
+ 'timestamp',
286
+ 'boolean'
271
287
  ];
272
- const getAttributesPrompts = async (inquirer) => {
273
- const { addAttributes } = await inquirer.prompt([
274
- {
275
- type: "confirm",
276
- name: "addAttributes",
277
- message: "Do you want to add attributes?"
278
- }
279
- ]);
280
- const attributes = [];
281
- const createNewAttributes = async (inquirer2) => {
282
- const answers = await inquirer2.prompt([
283
- {
284
- type: "input",
285
- name: "attributeName",
286
- message: "Name of attribute",
287
- validate: (input) => validateAttributeInput(input)
288
- },
289
- {
290
- type: "list",
291
- name: "attributeType",
292
- message: "What type of attribute",
293
- pageSize: DEFAULT_TYPES.length,
294
- choices: DEFAULT_TYPES.map((type) => {
295
- return { name: type, value: type };
296
- })
297
- },
298
- {
299
- when: (answers2) => answers2.attributeType === "enumeration",
300
- type: "input",
301
- name: "enum",
302
- message: "Add values separated by a comma"
303
- },
304
- {
305
- when: (answers2) => answers2.attributeType === "media",
306
- type: "list",
307
- name: "multiple",
308
- message: "Choose media type",
309
- choices: [
310
- { name: "Multiple", value: true },
311
- { name: "Single", value: false }
312
- ]
313
- },
314
- {
315
- type: "confirm",
316
- name: "addAttributes",
317
- message: "Do you want to add another attribute?"
318
- }
288
+ const getAttributesPrompts = async (inquirer)=>{
289
+ const { addAttributes } = await inquirer.prompt([
290
+ {
291
+ type: 'confirm',
292
+ name: 'addAttributes',
293
+ message: 'Do you want to add attributes?'
294
+ }
319
295
  ]);
320
- attributes.push(answers);
321
- if (!answers.addAttributes) {
322
- return;
296
+ const attributes = [];
297
+ /**
298
+ * @param {import('inquirer').Inquirer} inquirer
299
+ * @returns {Promise<void>}
300
+ */ const createNewAttributes = async (inquirer)=>{
301
+ const answers = await inquirer.prompt([
302
+ {
303
+ type: 'input',
304
+ name: 'attributeName',
305
+ message: 'Name of attribute',
306
+ validate: (input)=>validateAttributeInput(input)
307
+ },
308
+ {
309
+ type: 'list',
310
+ name: 'attributeType',
311
+ message: 'What type of attribute',
312
+ pageSize: DEFAULT_TYPES.length,
313
+ choices: DEFAULT_TYPES.map((type)=>{
314
+ return {
315
+ name: type,
316
+ value: type
317
+ };
318
+ })
319
+ },
320
+ {
321
+ when: (answers)=>answers.attributeType === 'enumeration',
322
+ type: 'input',
323
+ name: 'enum',
324
+ message: 'Add values separated by a comma'
325
+ },
326
+ {
327
+ when: (answers)=>answers.attributeType === 'media',
328
+ type: 'list',
329
+ name: 'multiple',
330
+ message: 'Choose media type',
331
+ choices: [
332
+ {
333
+ name: 'Multiple',
334
+ value: true
335
+ },
336
+ {
337
+ name: 'Single',
338
+ value: false
339
+ }
340
+ ]
341
+ },
342
+ {
343
+ type: 'confirm',
344
+ name: 'addAttributes',
345
+ message: 'Do you want to add another attribute?'
346
+ }
347
+ ]);
348
+ attributes.push(answers);
349
+ if (!answers.addAttributes) {
350
+ return;
351
+ }
352
+ await createNewAttributes(inquirer);
353
+ };
354
+ if (addAttributes) {
355
+ await createNewAttributes(inquirer);
356
+ } else {
357
+ console.warn(`You won't be able to manage entries from the admin, you can still add attributes later from the content type builder.`);
323
358
  }
324
- await createNewAttributes(inquirer2);
325
- };
326
- if (addAttributes) {
327
- await createNewAttributes(inquirer);
328
- } else {
329
- console.warn(
330
- `You won't be able to manage entries from the admin, you can still add attributes later from the content type builder.`
331
- );
332
- }
333
- return attributes;
359
+ return attributes;
334
360
  };
361
+
335
362
  const questions = [
336
- {
337
- type: "confirm",
338
- name: "bootstrapApi",
339
- default: true,
340
- message: "Bootstrap API related files?"
341
- }
363
+ {
364
+ type: 'confirm',
365
+ name: 'bootstrapApi',
366
+ default: true,
367
+ message: 'Bootstrap API related files?'
368
+ }
342
369
  ];
343
- const generateContentType = (plop) => {
344
- plop.setGenerator("content-type", {
345
- description: "Generate a content type for an API",
346
- async prompts(inquirer) {
347
- const config = await inquirer.prompt([
348
- ...questions$3,
349
- ...questions$2,
350
- ...questions$1
351
- ]);
352
- const attributes = await getAttributesPrompts(inquirer);
353
- const api = await inquirer.prompt([
354
- ...getDestinationPrompts("model", plop.getDestBasePath()),
355
- {
356
- when: (answers) => answers.destination === "new",
357
- type: "input",
358
- name: "id",
359
- default: config.singularName,
360
- message: "Name of the new API?",
361
- async validate(input) {
362
- if (!utils.isKebabCase(input)) {
363
- return "Value must be in kebab-case";
370
+
371
+ var generateContentType = ((plop)=>{
372
+ // Model generator
373
+ plop.setGenerator('content-type', {
374
+ description: 'Generate a content type for an API',
375
+ async prompts (inquirer) {
376
+ const config = await inquirer.prompt([
377
+ ...questions$2,
378
+ ...questions$1
379
+ ]);
380
+ // @ts-expect-error issue with deprecated inquirer.prompts attribute to fix with ugprade to inquirer
381
+ const attributes = await getAttributesPrompts(inquirer);
382
+ const api = await inquirer.prompt([
383
+ ...getDestinationPrompts('model', plop.getDestBasePath()),
384
+ {
385
+ when: (answers)=>answers.destination === 'new',
386
+ type: 'input',
387
+ name: 'id',
388
+ default: config.singularName,
389
+ message: 'Name of the new API?',
390
+ async validate (input) {
391
+ if (!strings.isKebabCase(input)) {
392
+ return 'Value must be in kebab-case';
393
+ }
394
+ const apiPath = join(plop.getDestBasePath(), 'api');
395
+ const exists = await fs.pathExists(apiPath);
396
+ if (!exists) {
397
+ return true;
398
+ }
399
+ const apiDir = await fs.readdir(apiPath, {
400
+ withFileTypes: true
401
+ });
402
+ const apiDirContent = apiDir.filter((fd)=>fd.isDirectory());
403
+ if (apiDirContent.findIndex((dir)=>dir.name === input) !== -1) {
404
+ throw new Error('This name is already taken.');
405
+ }
406
+ return true;
407
+ }
408
+ },
409
+ ...questions
410
+ ]);
411
+ return {
412
+ ...config,
413
+ ...api,
414
+ attributes
415
+ };
416
+ },
417
+ actions (answers) {
418
+ if (!answers) {
419
+ return [];
364
420
  }
365
- const apiPath = join(plop.getDestBasePath(), "api");
366
- const exists = await fs.pathExists(apiPath);
367
- if (!exists) {
368
- return true;
421
+ const attributes = answers.attributes.reduce((object, answer)=>{
422
+ const val = {
423
+ type: answer.attributeType
424
+ };
425
+ if (answer.attributeType === 'enumeration') {
426
+ val.enum = answer.enum.split(',').map((item)=>item.trim());
427
+ }
428
+ if (answer.attributeType === 'media') {
429
+ val.allowedTypes = [
430
+ 'images',
431
+ 'files',
432
+ 'videos',
433
+ 'audios'
434
+ ];
435
+ val.multiple = answer.multiple;
436
+ }
437
+ return Object.assign(object, {
438
+ [answer.attributeName]: val
439
+ }, {});
440
+ }, {});
441
+ const filePath = getFilePath(answers.destination);
442
+ const currentDir = process.cwd();
443
+ const language = tsUtils.isUsingTypeScriptSync(currentDir) ? 'ts' : 'js';
444
+ const baseActions = [
445
+ {
446
+ type: 'add',
447
+ path: `${filePath}/content-types/{{ singularName }}/schema.json`,
448
+ templateFile: `templates/${language}/content-type.schema.json.hbs`,
449
+ data: {
450
+ collectionName: slugify(answers.pluralName, {
451
+ separator: '_'
452
+ })
453
+ }
454
+ }
455
+ ];
456
+ if (Object.entries(attributes).length > 0) {
457
+ baseActions.push({
458
+ type: 'modify',
459
+ path: `${filePath}/content-types/{{ singularName }}/schema.json`,
460
+ transform (template) {
461
+ const parsedTemplate = JSON.parse(template);
462
+ parsedTemplate.attributes = attributes;
463
+ return JSON.stringify(parsedTemplate, null, 2);
464
+ }
465
+ });
369
466
  }
370
- const apiDir = await fs.readdir(apiPath, { withFileTypes: true });
371
- const apiDirContent = apiDir.filter((fd) => fd.isDirectory());
372
- if (apiDirContent.findIndex((dir) => dir.name === input) !== -1) {
373
- throw new Error("This name is already taken.");
467
+ if (answers.bootstrapApi) {
468
+ const { singularName } = answers;
469
+ let uid;
470
+ if (answers.destination === 'new') {
471
+ uid = `api::${answers.id}.${singularName}`;
472
+ } else if (answers.api) {
473
+ uid = `api::${answers.api}.${singularName}`;
474
+ } else if (answers.plugin) {
475
+ uid = `plugin::${answers.plugin}.${singularName}`;
476
+ }
477
+ baseActions.push({
478
+ type: 'add',
479
+ path: `${filePath}/controllers/{{ singularName }}.${language}`,
480
+ templateFile: `templates/${language}/core-controller.${language}.hbs`,
481
+ data: {
482
+ uid
483
+ }
484
+ }, {
485
+ type: 'add',
486
+ path: `${filePath}/services/{{ singularName }}.${language}`,
487
+ templateFile: `templates/${language}/core-service.${language}.hbs`,
488
+ data: {
489
+ uid
490
+ }
491
+ }, {
492
+ type: 'add',
493
+ path: `${filePath}/routes/{{ singularName }}.${language}`,
494
+ templateFile: `templates/${language}/core-router.${language}.hbs`,
495
+ data: {
496
+ uid
497
+ }
498
+ });
374
499
  }
375
- return true;
376
- }
377
- },
378
- ...questions
379
- ]);
380
- return {
381
- ...config,
382
- ...api,
383
- attributes
384
- };
385
- },
386
- actions(answers) {
387
- if (!answers) {
388
- return [];
389
- }
390
- const attributes = answers.attributes.reduce((object, answer) => {
391
- const val = { type: answer.attributeType };
392
- if (answer.attributeType === "enumeration") {
393
- val.enum = answer.enum.split(",").map((item) => item.trim());
394
- }
395
- if (answer.attributeType === "media") {
396
- val.allowedTypes = ["images", "files", "videos", "audios"];
397
- val.multiple = answer.multiple;
398
- }
399
- return Object.assign(object, { [answer.attributeName]: val }, {});
400
- }, {});
401
- const filePath = getFilePath(answers.destination);
402
- const currentDir = process.cwd();
403
- const language = tsUtils.isUsingTypeScriptSync(currentDir) ? "ts" : "js";
404
- const baseActions = [
405
- {
406
- type: "add",
407
- path: `${filePath}/content-types/{{ singularName }}/schema.json`,
408
- templateFile: `templates/${language}/content-type.schema.json.hbs`,
409
- data: {
410
- collectionName: slugify(answers.pluralName, { separator: "_" })
411
- }
500
+ return baseActions;
412
501
  }
413
- ];
414
- if (Object.entries(attributes).length > 0) {
415
- baseActions.push({
416
- type: "modify",
417
- path: `${filePath}/content-types/{{ singularName }}/schema.json`,
418
- transform(template) {
419
- const parsedTemplate = JSON.parse(template);
420
- parsedTemplate.attributes = attributes;
421
- return JSON.stringify(parsedTemplate, null, 2);
422
- }
423
- });
424
- }
425
- if (answers.bootstrapApi) {
426
- const { singularName } = answers;
427
- let uid;
428
- if (answers.destination === "new") {
429
- uid = `api::${answers.id}.${singularName}`;
430
- } else if (answers.api) {
431
- uid = `api::${answers.api}.${singularName}`;
432
- } else if (answers.plugin) {
433
- uid = `plugin::${answers.plugin}.${singularName}`;
434
- }
435
- baseActions.push(
436
- {
437
- type: "add",
438
- path: `${filePath}/controllers/{{ singularName }}.${language}`,
439
- templateFile: `templates/${language}/core-controller.${language}.hbs`,
440
- data: { uid }
441
- },
442
- {
443
- type: "add",
444
- path: `${filePath}/services/{{ singularName }}.${language}`,
445
- templateFile: `templates/${language}/core-service.${language}.hbs`,
446
- data: { uid }
447
- },
448
- {
449
- type: "add",
450
- path: `${filePath}/routes/{{ singularName }}.${language}`,
451
- templateFile: `templates/${language}/core-router.${language}.hbs`,
452
- data: { uid }
453
- }
454
- );
455
- }
456
- return baseActions;
457
- }
458
- });
459
- };
460
- const LANGUAGES = {
461
- javascript: "JavaScript",
462
- typescript: "TypeScript"
463
- };
464
- const logInstructions = (pluginName, { language }) => {
465
- const maxLength = ` resolve: './src/plugins/${pluginName}'`.length;
466
- const separator = Array(maxLength).fill("─").join("");
467
- const exportInstruction = language === "js" ? "module.exports =" : "export default";
468
- return `
469
- You can now enable your plugin by adding the following in ${chalk.yellow(
470
- `./config/plugins.${language}`
471
- )}
472
- ${separator}
473
- ${exportInstruction} {
474
- ${chalk.gray("// ...")}
475
- ${chalk.green(`'${pluginName}'`)}: {
476
- enabled: ${chalk.yellow(true)},
477
- resolve: ${chalk.yellow(`'./src/plugins/${pluginName}'`)}
478
- },
479
- ${chalk.gray("// ...")}
480
- }
481
- ${separator}
482
- `;
483
- };
484
- const generatePlugin = (plop) => {
485
- plop.setGenerator("plugin", {
486
- description: "Generate a basic plugin",
487
- prompts: [
488
- {
489
- type: "input",
490
- name: "pluginName",
491
- message: "Plugin name",
492
- validate: (input) => validateInput(input)
493
- },
494
- {
495
- type: "list",
496
- name: "language",
497
- message: "Choose your preferred language",
498
- choices: Object.values(LANGUAGES),
499
- default: LANGUAGES.javascript
500
- }
501
- ],
502
- actions(answers) {
503
- if (!answers) {
504
- return [];
505
- }
506
- const isTypescript = answers.language === LANGUAGES.typescript;
507
- const language = isTypescript ? "ts" : "js";
508
- const projectLanguage = tsUtils.isUsingTypeScriptSync(process.cwd()) ? "ts" : "js";
509
- if (!utils.isKebabCase(answers.pluginName)) {
510
- answers.pluginName = utils.toKebabCase(answers.pluginName);
511
- console.log(
512
- chalk.yellow(
513
- `Strapi only supports kebab-cased names for plugins.
514
- Your plugin has been automatically renamed to "${answers.pluginName}".`
515
- )
516
- );
517
- }
518
- return [
519
- {
520
- type: "addMany",
521
- destination: "plugins/{{ pluginName }}",
522
- base: `files/${language}/plugin`,
523
- templateFiles: `files/${language}/plugin/**`
524
- },
525
- {
526
- type: "add",
527
- path: "plugins/{{ pluginName }}/README.md",
528
- templateFile: `templates/${language}/README.md.hbs`
529
- },
530
- {
531
- type: "add",
532
- path: "plugins/{{ pluginName }}/package.json",
533
- templateFile: `templates/${language}/plugin-package.json.hbs`
534
- },
535
- () => plop.renderString(
536
- logInstructions(answers.pluginName, { language: projectLanguage }),
537
- null
538
- )
539
- ];
540
- }
541
- });
542
- };
543
- const generatePolicy = (plop) => {
544
- plop.setGenerator("policy", {
545
- description: "Generate a policy for an API",
546
- prompts: [
547
- {
548
- type: "input",
549
- name: "id",
550
- message: "Policy name",
551
- validate: (input) => validateInput(input)
552
- },
553
- ...getDestinationPrompts("policy", plop.getDestBasePath(), { rootFolder: true })
554
- ],
555
- actions(answers) {
556
- if (!answers) {
557
- return [];
558
- }
559
- const filePath = getFilePath(answers.destination);
560
- const currentDir = process.cwd();
561
- const language = tsUtils.isUsingTypeScriptSync(currentDir) ? "ts" : "js";
562
- return [
563
- {
564
- type: "add",
565
- path: `${filePath}/policies/{{ id }}.${language}`,
566
- templateFile: `templates/${language}/policy.${language}.hbs`
502
+ });
503
+ });
504
+
505
+ var generatePolicy = ((plop)=>{
506
+ // Policy generator
507
+ plop.setGenerator('policy', {
508
+ description: 'Generate a policy for an API',
509
+ prompts: [
510
+ {
511
+ type: 'input',
512
+ name: 'id',
513
+ message: 'Policy name',
514
+ validate: (input)=>validateInput(input)
515
+ },
516
+ ...getDestinationPrompts('policy', plop.getDestBasePath(), {
517
+ rootFolder: true
518
+ })
519
+ ],
520
+ actions (answers) {
521
+ if (!answers) {
522
+ return [];
523
+ }
524
+ const currentDir = process.cwd();
525
+ const filePath = getFilePath(answers.destination);
526
+ const language = tsUtils.isUsingTypeScriptSync(currentDir) ? 'ts' : 'js';
527
+ return [
528
+ {
529
+ type: 'add',
530
+ path: `${filePath}/policies/{{ id }}.${language}`,
531
+ templateFile: `templates/${language}/policy.${language}.hbs`
532
+ }
533
+ ];
567
534
  }
568
- ];
569
- }
570
- });
571
- };
572
- const generateMiddleware = (plop) => {
573
- plop.setGenerator("middleware", {
574
- description: "Generate a middleware for an API",
575
- prompts: [
576
- {
577
- type: "input",
578
- name: "name",
579
- message: "Middleware name",
580
- validate: (input) => validateInput(input)
581
- },
582
- ...getDestinationPrompts("middleware", plop.getDestBasePath(), { rootFolder: true })
583
- ],
584
- actions(answers) {
585
- if (!answers) {
586
- return [];
587
- }
588
- const filePath = getFilePath(answers.destination);
589
- const currentDir = process.cwd();
590
- const language = tsUtils.isUsingTypeScriptSync(currentDir) ? "ts" : "js";
591
- return [
592
- {
593
- type: "add",
594
- path: `${filePath}/middlewares/{{ name }}.${language}`,
595
- templateFile: `templates/${language}/middleware.${language}.hbs`
535
+ });
536
+ });
537
+
538
+ var generateMiddleware = ((plop)=>{
539
+ // middleware generator
540
+ plop.setGenerator('middleware', {
541
+ description: 'Generate a middleware for an API',
542
+ prompts: [
543
+ {
544
+ type: 'input',
545
+ name: 'name',
546
+ message: 'Middleware name',
547
+ validate: (input)=>validateInput(input)
548
+ },
549
+ ...getDestinationPrompts('middleware', plop.getDestBasePath(), {
550
+ rootFolder: true
551
+ })
552
+ ],
553
+ actions (answers) {
554
+ if (!answers) {
555
+ return [];
556
+ }
557
+ const filePath = getFilePath(answers.destination);
558
+ const currentDir = process.cwd();
559
+ const language = tsUtils.isUsingTypeScriptSync(currentDir) ? 'ts' : 'js';
560
+ return [
561
+ {
562
+ type: 'add',
563
+ path: `${filePath}/middlewares/{{ name }}.${language}`,
564
+ templateFile: `templates/${language}/middleware.${language}.hbs`
565
+ }
566
+ ];
596
567
  }
597
- ];
568
+ });
569
+ });
570
+
571
+ var validateFileNameInput = ((input)=>{
572
+ const regex = /^[A-Za-z-_0-9]+$/g;
573
+ if (!input) {
574
+ return 'You must provide an input';
598
575
  }
599
- });
600
- };
601
- const validateFileNameInput = (input) => {
602
- const regex = /^[A-Za-z-_0-9]+$/g;
603
- if (!input) {
604
- return "You must provide an input";
605
- }
606
- return regex.test(input) || "Please use only letters and number, '-' or '_' and no spaces";
607
- };
608
- const getFormattedDate = (date = /* @__PURE__ */ new Date()) => {
609
- return new Date(date.getTime() - date.getTimezoneOffset() * 6e4).toJSON().replace(/[-:]/g, ".").replace(/\....Z/, "");
610
- };
611
- const generateMigration = (plop) => {
612
- plop.setGenerator("migration", {
613
- description: "Generate a migration",
614
- prompts: [
615
- {
616
- type: "input",
617
- name: "name",
618
- message: "Migration name",
619
- validate: (input) => validateFileNameInput(input)
620
- }
621
- ],
622
- actions() {
623
- const currentDir = process.cwd();
624
- const language = tsUtils.isUsingTypeScriptSync(currentDir) ? "ts" : "js";
625
- const timestamp = getFormattedDate();
626
- return [
627
- {
628
- type: "add",
629
- path: `${currentDir}/database/migrations/${timestamp}.{{ name }}.${language}`,
630
- templateFile: `templates/${language}/migration.${language}.hbs`
576
+ return regex.test(input) || "Please use only letters and number, '-' or '_' and no spaces";
577
+ });
578
+
579
+ var getFormattedDate = ((date = new Date())=>{
580
+ return new Date(date.getTime() - date.getTimezoneOffset() * 60000).toJSON().replace(/[-:]/g, '.').replace(/\....Z/, '');
581
+ });
582
+
583
+ var generateMigration = ((plop)=>{
584
+ // Migration generator
585
+ plop.setGenerator('migration', {
586
+ description: 'Generate a migration',
587
+ prompts: [
588
+ {
589
+ type: 'input',
590
+ name: 'name',
591
+ message: 'Migration name',
592
+ validate: (input)=>validateFileNameInput(input)
593
+ }
594
+ ],
595
+ actions () {
596
+ const currentDir = process.cwd();
597
+ const language = tsUtils.isUsingTypeScriptSync(currentDir) ? 'ts' : 'js';
598
+ const timestamp = getFormattedDate();
599
+ return [
600
+ {
601
+ type: 'add',
602
+ path: `${currentDir}/database/migrations/${timestamp}.{{ name }}.${language}`,
603
+ templateFile: `templates/${language}/migration.${language}.hbs`
604
+ }
605
+ ];
631
606
  }
632
- ];
633
- }
634
- });
635
- };
636
- const generateService = (plop) => {
637
- plop.setGenerator("service", {
638
- description: "Generate a service for an API",
639
- prompts: [
640
- {
641
- type: "input",
642
- name: "id",
643
- message: "Service name"
644
- },
645
- ...getDestinationPrompts("service", plop.getDestBasePath())
646
- ],
647
- actions(answers) {
648
- if (!answers) {
649
- return [];
650
- }
651
- const filePath = getFilePath(answers?.destination);
652
- const currentDir = process.cwd();
653
- const language = tsUtils.isUsingTypeScriptSync(currentDir) ? "ts" : "js";
654
- return [
655
- {
656
- type: "add",
657
- path: `${filePath}/services/{{ id }}.${language}`,
658
- templateFile: `templates/${language}/service.${language}.hbs`
607
+ });
608
+ });
609
+
610
+ var generateService = ((plop)=>{
611
+ // Service generator
612
+ plop.setGenerator('service', {
613
+ description: 'Generate a service for an API',
614
+ prompts: [
615
+ {
616
+ type: 'input',
617
+ name: 'id',
618
+ message: 'Service name'
619
+ },
620
+ ...getDestinationPrompts('service', plop.getDestBasePath())
621
+ ],
622
+ actions (answers) {
623
+ if (!answers) {
624
+ return [];
625
+ }
626
+ const filePath = getFilePath(answers?.destination);
627
+ const currentDir = process.cwd();
628
+ const language = tsUtils.isUsingTypeScriptSync(currentDir) ? 'ts' : 'js';
629
+ return [
630
+ {
631
+ type: 'add',
632
+ path: `${filePath}/services/{{ id }}.${language}`,
633
+ templateFile: `templates/${language}/service.${language}.hbs`
634
+ }
635
+ ];
659
636
  }
660
- ];
661
- }
662
- });
663
- };
664
- const plopfile = (plop) => {
665
- plop.setWelcomeMessage("Strapi Generators");
666
- plop.addHelper("pluralize", (text) => pluralize(text));
667
- generateApi(plop);
668
- generateController(plop);
669
- generateContentType(plop);
670
- generatePlugin(plop);
671
- generatePolicy(plop);
672
- generateMiddleware(plop);
673
- generateMigration(plop);
674
- generateService(plop);
675
- };
676
- export {
677
- plopfile as default
678
- };
637
+ });
638
+ });
639
+
640
+ var plopfile = ((plop)=>{
641
+ // Plop config
642
+ plop.setWelcomeMessage('Strapi Generators');
643
+ plop.setHelper('pluralize', (text)=>pluralize(text));
644
+ // Generators
645
+ generateApi(plop);
646
+ generateController(plop);
647
+ generateContentType(plop);
648
+ generatePolicy(plop);
649
+ generateMiddleware(plop);
650
+ generateMigration(plop);
651
+ generateService(plop);
652
+ });
653
+
654
+ export { plopfile as default };
679
655
  //# sourceMappingURL=plopfile.mjs.map