@strapi/generators 0.0.0-next.f5312617ca16b870c2bf1adcea2c69b676979e29 → 0.0.0-next.f5d21551ed005f524bfc4760b274f1be154e26a8

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