@strapi/generators 0.0.0-next.f426350b859ddae6592e9bfa99e6be94ae22e117 → 0.0.0-next.f4ec69568d980c6fee91ce2ee0f41c138347aa81

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 (150) hide show
  1. package/LICENSE +18 -3
  2. package/dist/index.d.ts +3 -2
  3. package/dist/index.d.ts.map +1 -0
  4. package/dist/index.js +53 -27
  5. package/dist/index.js.map +1 -1
  6. package/dist/index.mjs +34 -0
  7. package/dist/index.mjs.map +1 -0
  8. package/dist/plopfile.d.ts +2 -1
  9. package/dist/plopfile.d.ts.map +1 -0
  10. package/dist/plopfile.js +585 -28
  11. package/dist/plopfile.js.map +1 -1
  12. package/dist/plopfile.mjs +582 -0
  13. package/dist/plopfile.mjs.map +1 -0
  14. package/dist/plops/api.d.ts +2 -1
  15. package/dist/plops/api.d.ts.map +1 -0
  16. package/dist/plops/content-type.d.ts +2 -1
  17. package/dist/plops/content-type.d.ts.map +1 -0
  18. package/dist/plops/controller.d.ts +2 -1
  19. package/dist/plops/controller.d.ts.map +1 -0
  20. package/dist/plops/middleware.d.ts +2 -1
  21. package/dist/plops/middleware.d.ts.map +1 -0
  22. package/dist/plops/migration.d.ts +2 -1
  23. package/dist/plops/migration.d.ts.map +1 -0
  24. package/dist/plops/policy.d.ts +2 -1
  25. package/dist/plops/policy.d.ts.map +1 -0
  26. package/dist/plops/prompts/bootstrap-api-prompts.d.ts +1 -0
  27. package/dist/plops/prompts/bootstrap-api-prompts.d.ts.map +1 -0
  28. package/dist/plops/prompts/ct-names-prompts.d.ts +1 -0
  29. package/dist/plops/prompts/ct-names-prompts.d.ts.map +1 -0
  30. package/dist/plops/prompts/get-attributes-prompts.d.ts +1 -0
  31. package/dist/plops/prompts/get-attributes-prompts.d.ts.map +1 -0
  32. package/dist/plops/prompts/get-destination-prompts.d.ts +1 -0
  33. package/dist/plops/prompts/get-destination-prompts.d.ts.map +1 -0
  34. package/dist/plops/prompts/kind-prompts.d.ts +1 -0
  35. package/dist/plops/prompts/kind-prompts.d.ts.map +1 -0
  36. package/dist/plops/service.d.ts +2 -1
  37. package/dist/plops/service.d.ts.map +1 -0
  38. package/dist/plops/utils/get-file-path.d.ts +1 -0
  39. package/dist/plops/utils/get-file-path.d.ts.map +1 -0
  40. package/dist/plops/utils/get-formatted-date.d.ts +1 -0
  41. package/dist/plops/utils/get-formatted-date.d.ts.map +1 -0
  42. package/dist/plops/utils/validate-attribute-input.d.ts +1 -0
  43. package/dist/plops/utils/validate-attribute-input.d.ts.map +1 -0
  44. package/dist/plops/utils/validate-file-name-input.d.ts +1 -0
  45. package/dist/plops/utils/validate-file-name-input.d.ts.map +1 -0
  46. package/dist/plops/utils/validate-input.d.ts +1 -0
  47. package/dist/plops/utils/validate-input.d.ts.map +1 -0
  48. package/dist/templates/js/content-type.schema.json.hbs +0 -1
  49. package/dist/templates/ts/content-type.schema.json.hbs +0 -1
  50. package/dist/templates/ts/middleware.ts.hbs +2 -2
  51. package/package.json +18 -15
  52. package/dist/files/js/plugin/.editorconfig +0 -7
  53. package/dist/files/js/plugin/.gitattributes +0 -103
  54. package/dist/files/js/plugin/admin/src/components/Initializer/index.js +0 -26
  55. package/dist/files/js/plugin/admin/src/components/PluginIcon/index.js +0 -12
  56. package/dist/files/js/plugin/admin/src/index.js +0 -63
  57. package/dist/files/js/plugin/admin/src/pages/App/index.js +0 -25
  58. package/dist/files/js/plugin/admin/src/pages/HomePage/index.js +0 -20
  59. package/dist/files/js/plugin/admin/src/pluginId.js +0 -5
  60. package/dist/files/js/plugin/admin/src/translations/en.json +0 -1
  61. package/dist/files/js/plugin/admin/src/translations/fr.json +0 -1
  62. package/dist/files/js/plugin/admin/src/utils/getTrad.js +0 -5
  63. package/dist/files/js/plugin/server/bootstrap.js +0 -5
  64. package/dist/files/js/plugin/server/config/index.js +0 -6
  65. package/dist/files/js/plugin/server/content-types/index.js +0 -3
  66. package/dist/files/js/plugin/server/controllers/index.js +0 -7
  67. package/dist/files/js/plugin/server/controllers/my-controller.js.hbs +0 -10
  68. package/dist/files/js/plugin/server/destroy.js +0 -5
  69. package/dist/files/js/plugin/server/index.js +0 -25
  70. package/dist/files/js/plugin/server/middlewares/index.js +0 -3
  71. package/dist/files/js/plugin/server/policies/index.js +0 -3
  72. package/dist/files/js/plugin/server/register.js +0 -5
  73. package/dist/files/js/plugin/server/routes/index.js +0 -10
  74. package/dist/files/js/plugin/server/services/index.js +0 -7
  75. package/dist/files/js/plugin/server/services/my-service.js +0 -7
  76. package/dist/files/js/plugin/strapi-admin.js +0 -3
  77. package/dist/files/js/plugin/strapi-server.js +0 -3
  78. package/dist/files/ts/plugin/.editorconfig +0 -7
  79. package/dist/files/ts/plugin/.gitattributes +0 -103
  80. package/dist/files/ts/plugin/admin/src/components/Initializer/index.tsx +0 -24
  81. package/dist/files/ts/plugin/admin/src/components/PluginIcon/index.tsx +0 -12
  82. package/dist/files/ts/plugin/admin/src/index.tsx +0 -67
  83. package/dist/files/ts/plugin/admin/src/pages/App/index.tsx +0 -25
  84. package/dist/files/ts/plugin/admin/src/pages/HomePage/index.tsx +0 -19
  85. package/dist/files/ts/plugin/admin/src/pluginId.ts +0 -5
  86. package/dist/files/ts/plugin/admin/src/translations/en.json +0 -1
  87. package/dist/files/ts/plugin/admin/src/translations/fr.json +0 -1
  88. package/dist/files/ts/plugin/admin/src/utils/getTrad.ts +0 -5
  89. package/dist/files/ts/plugin/custom.d.ts +0 -5
  90. package/dist/files/ts/plugin/server/bootstrap.ts +0 -5
  91. package/dist/files/ts/plugin/server/config/index.ts +0 -4
  92. package/dist/files/ts/plugin/server/content-types/index.ts +0 -1
  93. package/dist/files/ts/plugin/server/controllers/index.ts +0 -5
  94. package/dist/files/ts/plugin/server/controllers/my-controller.ts.hbs +0 -10
  95. package/dist/files/ts/plugin/server/destroy.ts +0 -5
  96. package/dist/files/ts/plugin/server/index.ts +0 -23
  97. package/dist/files/ts/plugin/server/middlewares/index.ts +0 -1
  98. package/dist/files/ts/plugin/server/policies/index.ts +0 -1
  99. package/dist/files/ts/plugin/server/register.ts +0 -5
  100. package/dist/files/ts/plugin/server/routes/index.ts +0 -10
  101. package/dist/files/ts/plugin/server/services/index.ts +0 -5
  102. package/dist/files/ts/plugin/server/services/my-service.ts +0 -7
  103. package/dist/files/ts/plugin/strapi-admin.js +0 -3
  104. package/dist/files/ts/plugin/strapi-server.js +0 -3
  105. package/dist/files/ts/plugin/tsconfig.json +0 -20
  106. package/dist/files/ts/plugin/tsconfig.server.json +0 -25
  107. package/dist/plops/api.js +0 -79
  108. package/dist/plops/api.js.map +0 -1
  109. package/dist/plops/content-type.js +0 -158
  110. package/dist/plops/content-type.js.map +0 -1
  111. package/dist/plops/controller.js +0 -40
  112. package/dist/plops/controller.js.map +0 -1
  113. package/dist/plops/middleware.js +0 -40
  114. package/dist/plops/middleware.js.map +0 -1
  115. package/dist/plops/migration.js +0 -35
  116. package/dist/plops/migration.js.map +0 -1
  117. package/dist/plops/plugin.d.ts +0 -3
  118. package/dist/plops/plugin.js +0 -107
  119. package/dist/plops/plugin.js.map +0 -1
  120. package/dist/plops/policy.js +0 -40
  121. package/dist/plops/policy.js.map +0 -1
  122. package/dist/plops/prompts/bootstrap-api-prompts.js +0 -12
  123. package/dist/plops/prompts/bootstrap-api-prompts.js.map +0 -1
  124. package/dist/plops/prompts/ct-names-prompts.js +0 -68
  125. package/dist/plops/prompts/ct-names-prompts.js.map +0 -1
  126. package/dist/plops/prompts/draft-and-publish-prompts.d.ts +0 -3
  127. package/dist/plops/prompts/draft-and-publish-prompts.js +0 -12
  128. package/dist/plops/prompts/draft-and-publish-prompts.js.map +0 -1
  129. package/dist/plops/prompts/get-attributes-prompts.js +0 -95
  130. package/dist/plops/prompts/get-attributes-prompts.js.map +0 -1
  131. package/dist/plops/prompts/get-destination-prompts.js +0 -72
  132. package/dist/plops/prompts/get-destination-prompts.js.map +0 -1
  133. package/dist/plops/prompts/kind-prompts.js +0 -21
  134. package/dist/plops/prompts/kind-prompts.js.map +0 -1
  135. package/dist/plops/service.js +0 -38
  136. package/dist/plops/service.js.map +0 -1
  137. package/dist/plops/utils/get-file-path.js +0 -15
  138. package/dist/plops/utils/get-file-path.js.map +0 -1
  139. package/dist/plops/utils/get-formatted-date.js +0 -9
  140. package/dist/plops/utils/get-formatted-date.js.map +0 -1
  141. package/dist/plops/utils/validate-attribute-input.js +0 -10
  142. package/dist/plops/utils/validate-attribute-input.js.map +0 -1
  143. package/dist/plops/utils/validate-file-name-input.js +0 -10
  144. package/dist/plops/utils/validate-file-name-input.js.map +0 -1
  145. package/dist/plops/utils/validate-input.js +0 -10
  146. package/dist/plops/utils/validate-input.js.map +0 -1
  147. package/dist/templates/js/README.md.hbs +0 -3
  148. package/dist/templates/js/plugin-package.json.hbs +0 -42
  149. package/dist/templates/ts/README.md.hbs +0 -3
  150. package/dist/templates/ts/plugin-package.json.hbs +0 -51
@@ -1,12 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const questions = [
4
- {
5
- type: 'confirm',
6
- name: 'useDraftAndPublish',
7
- default: false,
8
- message: 'Use draft and publish?',
9
- },
10
- ];
11
- exports.default = questions;
12
- //# sourceMappingURL=draft-and-publish-prompts.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"draft-and-publish-prompts.js","sourceRoot":"","sources":["../../../src/plops/prompts/draft-and-publish-prompts.ts"],"names":[],"mappings":";;AAEA,MAAM,SAAS,GAA0B;IACvC;QACE,IAAI,EAAE,SAAS;QACf,IAAI,EAAE,oBAAoB;QAC1B,OAAO,EAAE,KAAK;QACd,OAAO,EAAE,wBAAwB;KAClC;CACF,CAAC;AAEF,kBAAe,SAAS,CAAC"}
@@ -1,95 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const validate_attribute_input_1 = __importDefault(require("../utils/validate-attribute-input"));
7
- const DEFAULT_TYPES = [
8
- // advanced types
9
- 'media',
10
- // scalar types
11
- 'string',
12
- 'text',
13
- 'richtext',
14
- 'json',
15
- 'enumeration',
16
- 'password',
17
- 'email',
18
- 'integer',
19
- 'biginteger',
20
- 'float',
21
- 'decimal',
22
- 'date',
23
- 'time',
24
- 'datetime',
25
- 'timestamp',
26
- 'boolean',
27
- ];
28
- const getAttributesPrompts = async (inquirer) => {
29
- const { addAttributes } = await inquirer.prompt([
30
- {
31
- type: 'confirm',
32
- name: 'addAttributes',
33
- message: 'Do you want to add attributes?',
34
- },
35
- ]);
36
- const attributes = [];
37
- /**
38
- * @param {import('inquirer').Inquirer} inquirer
39
- * @returns {Promise<void>}
40
- */
41
- const createNewAttributes = async (inquirer) => {
42
- const answers = await inquirer.prompt([
43
- {
44
- type: 'input',
45
- name: 'attributeName',
46
- message: 'Name of attribute',
47
- validate: (input) => (0, validate_attribute_input_1.default)(input),
48
- },
49
- {
50
- type: 'list',
51
- name: 'attributeType',
52
- message: 'What type of attribute',
53
- pageSize: DEFAULT_TYPES.length,
54
- choices: DEFAULT_TYPES.map((type) => {
55
- return { name: type, value: type };
56
- }),
57
- },
58
- {
59
- when: (answers) => answers.attributeType === 'enumeration',
60
- type: 'input',
61
- name: 'enum',
62
- message: 'Add values separated by a comma',
63
- },
64
- {
65
- when: (answers) => answers.attributeType === 'media',
66
- type: 'list',
67
- name: 'multiple',
68
- message: 'Choose media type',
69
- choices: [
70
- { name: 'Multiple', value: true },
71
- { name: 'Single', value: false },
72
- ],
73
- },
74
- {
75
- type: 'confirm',
76
- name: 'addAttributes',
77
- message: 'Do you want to add another attribute?',
78
- },
79
- ]);
80
- attributes.push(answers);
81
- if (!answers.addAttributes) {
82
- return;
83
- }
84
- await createNewAttributes(inquirer);
85
- };
86
- if (addAttributes) {
87
- await createNewAttributes(inquirer);
88
- }
89
- else {
90
- console.warn(`You won't be able to manage entries from the admin, you can still add attributes later from the content type builder.`);
91
- }
92
- return attributes;
93
- };
94
- exports.default = getAttributesPrompts;
95
- //# sourceMappingURL=get-attributes-prompts.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"get-attributes-prompts.js","sourceRoot":"","sources":["../../../src/plops/prompts/get-attributes-prompts.ts"],"names":[],"mappings":";;;;;AAEA,iGAAuE;AASvE,MAAM,aAAa,GAAG;IACpB,iBAAiB;IACjB,OAAO;IAEP,eAAe;IACf,QAAQ;IACR,MAAM;IACN,UAAU;IACV,MAAM;IACN,aAAa;IACb,UAAU;IACV,OAAO;IACP,SAAS;IACT,YAAY;IACZ,OAAO;IACP,SAAS;IACT,MAAM;IACN,MAAM;IACN,UAAU;IACV,WAAW;IACX,SAAS;CACD,CAAC;AAEX,MAAM,oBAAoB,GAA2B,KAAK,EAAE,QAAQ,EAAE,EAAE;IACtE,MAAM,EAAE,aAAa,EAAE,GAAG,MAAM,QAAQ,CAAC,MAAM,CAAC;QAC9C;YACE,IAAI,EAAE,SAAS;YACf,IAAI,EAAE,eAAe;YACrB,OAAO,EAAE,gCAAgC;SAC1C;KACF,CAAC,CAAC;IAEH,MAAM,UAAU,GAA2B,EAAE,CAAC;IAE9C;;;OAGG;IACH,MAAM,mBAAmB,GAAG,KAAK,EAAE,QAA+C,EAAE,EAAE;QACpF,MAAM,OAAO,GAAG,MAAM,QAAQ,CAAC,MAAM,CAAC;YACpC;gBACE,IAAI,EAAE,OAAO;gBACb,IAAI,EAAE,eAAe;gBACrB,OAAO,EAAE,mBAAmB;gBAC5B,QAAQ,EAAE,CAAC,KAAa,EAAE,EAAE,CAAC,IAAA,kCAAsB,EAAC,KAAK,CAAC;aAC3D;YACD;gBACE,IAAI,EAAE,MAAM;gBACZ,IAAI,EAAE,eAAe;gBACrB,OAAO,EAAE,wBAAwB;gBACjC,QAAQ,EAAE,aAAa,CAAC,MAAM;gBAC9B,OAAO,EAAE,aAAa,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;oBAClC,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;gBACrC,CAAC,CAAC;aACH;YACD;gBACE,IAAI,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,aAAa,KAAK,aAAa;gBAC1D,IAAI,EAAE,OAAO;gBACb,IAAI,EAAE,MAAM;gBACZ,OAAO,EAAE,iCAAiC;aAC3C;YACD;gBACE,IAAI,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,aAAa,KAAK,OAAO;gBACpD,IAAI,EAAE,MAAM;gBACZ,IAAI,EAAE,UAAU;gBAChB,OAAO,EAAE,mBAAmB;gBAC5B,OAAO,EAAE;oBACP,EAAE,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,IAAI,EAAE;oBACjC,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE;iBACjC;aACF;YACD;gBACE,IAAI,EAAE,SAAS;gBACf,IAAI,EAAE,eAAe;gBACrB,OAAO,EAAE,uCAAuC;aACjD;SACF,CAAC,CAAC;QAEH,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAEzB,IAAI,CAAC,OAAO,CAAC,aAAa,EAAE;YAC1B,OAAO;SACR;QAED,MAAM,mBAAmB,CAAC,QAAQ,CAAC,CAAC;IACtC,CAAC,CAAC;IAEF,IAAI,aAAa,EAAE;QACjB,MAAM,mBAAmB,CAAC,QAAQ,CAAC,CAAC;KACrC;SAAM;QACL,OAAO,CAAC,IAAI,CACV,uHAAuH,CACxH,CAAC;KACH;IAED,OAAO,UAAU,CAAC;AACpB,CAAC,CAAC;AAEF,kBAAe,oBAAoB,CAAC"}
@@ -1,72 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const path_1 = require("path");
7
- const fs_extra_1 = __importDefault(require("fs-extra"));
8
- exports.default = (action, basePath, { rootFolder = false } = {}) => {
9
- return [
10
- {
11
- type: 'list',
12
- name: 'destination',
13
- message: `Where do you want to add this ${action}?`,
14
- choices: [
15
- ...(rootFolder
16
- ? [
17
- {
18
- name: `Add ${action} to root of project`,
19
- value: 'root',
20
- },
21
- ]
22
- : [
23
- {
24
- name: `Add ${action} to new API`,
25
- value: 'new',
26
- },
27
- ]),
28
- { name: `Add ${action} to an existing API`, value: 'api' },
29
- { name: `Add ${action} to an existing plugin`, value: 'plugin' },
30
- ],
31
- },
32
- {
33
- when: (answers) => answers.destination === 'api',
34
- type: 'list',
35
- message: 'Which API is this for?',
36
- name: 'api',
37
- async choices() {
38
- const apiPath = (0, path_1.join)(basePath, 'api');
39
- const exists = await fs_extra_1.default.pathExists(apiPath);
40
- if (!exists) {
41
- throw Error('Couldn\'t find an "api" directory');
42
- }
43
- const apiDir = await fs_extra_1.default.readdir(apiPath, { withFileTypes: true });
44
- const apiDirContent = apiDir.filter((fd) => fd.isDirectory());
45
- if (apiDirContent.length === 0) {
46
- throw Error('The "api" directory is empty');
47
- }
48
- return apiDirContent;
49
- },
50
- },
51
- {
52
- when: (answers) => answers.destination === 'plugin',
53
- type: 'list',
54
- message: 'Which plugin is this for?',
55
- name: 'plugin',
56
- async choices() {
57
- const pluginsPath = (0, path_1.join)(basePath, 'plugins');
58
- const exists = await fs_extra_1.default.pathExists(pluginsPath);
59
- if (!exists) {
60
- throw Error('Couldn\'t find a "plugins" directory');
61
- }
62
- const pluginsDir = await fs_extra_1.default.readdir(pluginsPath);
63
- const pluginsDirContent = pluginsDir.filter((api) => fs_extra_1.default.lstatSync((0, path_1.join)(pluginsPath, api)).isDirectory());
64
- if (pluginsDirContent.length === 0) {
65
- throw Error('The "plugins" directory is empty');
66
- }
67
- return pluginsDirContent;
68
- },
69
- },
70
- ];
71
- };
72
- //# sourceMappingURL=get-destination-prompts.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"get-destination-prompts.js","sourceRoot":"","sources":["../../../src/plops/prompts/get-destination-prompts.ts"],"names":[],"mappings":";;;;;AAAA,+BAA4B;AAC5B,wDAA0B;AAI1B,kBAAe,CACb,MAAc,EACd,QAAgB,EAChB,EAAE,UAAU,GAAG,KAAK,EAAE,GAAG,EAAE,EACJ,EAAE;IACzB,OAAO;QACL;YACE,IAAI,EAAE,MAAM;YACZ,IAAI,EAAE,aAAa;YACnB,OAAO,EAAE,iCAAiC,MAAM,GAAG;YACnD,OAAO,EAAE;gBACP,GAAG,CAAC,UAAU;oBACZ,CAAC,CAAC;wBACE;4BACE,IAAI,EAAE,OAAO,MAAM,qBAAqB;4BACxC,KAAK,EAAE,MAAM;yBACd;qBACF;oBACH,CAAC,CAAC;wBACE;4BACE,IAAI,EAAE,OAAO,MAAM,aAAa;4BAChC,KAAK,EAAE,KAAK;yBACb;qBACF,CAAC;gBACN,EAAE,IAAI,EAAE,OAAO,MAAM,qBAAqB,EAAE,KAAK,EAAE,KAAK,EAAE;gBAC1D,EAAE,IAAI,EAAE,OAAO,MAAM,wBAAwB,EAAE,KAAK,EAAE,QAAQ,EAAE;aACjE;SACF;QACD;YACE,IAAI,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,WAAW,KAAK,KAAK;YAChD,IAAI,EAAE,MAAM;YACZ,OAAO,EAAE,wBAAwB;YACjC,IAAI,EAAE,KAAK;YACX,KAAK,CAAC,OAAO;gBACX,MAAM,OAAO,GAAG,IAAA,WAAI,EAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;gBACtC,MAAM,MAAM,GAAG,MAAM,kBAAE,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;gBAE5C,IAAI,CAAC,MAAM,EAAE;oBACX,MAAM,KAAK,CAAC,mCAAmC,CAAC,CAAC;iBAClD;gBAED,MAAM,MAAM,GAAG,MAAM,kBAAE,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC,CAAC;gBAClE,MAAM,aAAa,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,WAAW,EAAE,CAAC,CAAC;gBAE9D,IAAI,aAAa,CAAC,MAAM,KAAK,CAAC,EAAE;oBAC9B,MAAM,KAAK,CAAC,8BAA8B,CAAC,CAAC;iBAC7C;gBAED,OAAO,aAAa,CAAC;YACvB,CAAC;SACF;QACD;YACE,IAAI,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,WAAW,KAAK,QAAQ;YACnD,IAAI,EAAE,MAAM;YACZ,OAAO,EAAE,2BAA2B;YACpC,IAAI,EAAE,QAAQ;YACd,KAAK,CAAC,OAAO;gBACX,MAAM,WAAW,GAAG,IAAA,WAAI,EAAC,QAAQ,EAAE,SAAS,CAAC,CAAC;gBAC9C,MAAM,MAAM,GAAG,MAAM,kBAAE,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC;gBAEhD,IAAI,CAAC,MAAM,EAAE;oBACX,MAAM,KAAK,CAAC,sCAAsC,CAAC,CAAC;iBACrD;gBAED,MAAM,UAAU,GAAG,MAAM,kBAAE,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;gBACjD,MAAM,iBAAiB,GAAG,UAAU,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAClD,kBAAE,CAAC,SAAS,CAAC,IAAA,WAAI,EAAC,WAAW,EAAE,GAAG,CAAC,CAAC,CAAC,WAAW,EAAE,CACnD,CAAC;gBAEF,IAAI,iBAAiB,CAAC,MAAM,KAAK,CAAC,EAAE;oBAClC,MAAM,KAAK,CAAC,kCAAkC,CAAC,CAAC;iBACjD;gBAED,OAAO,iBAAiB,CAAC;YAC3B,CAAC;SACF;KACF,CAAC;AACJ,CAAC,CAAC"}
@@ -1,21 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const validate_input_1 = __importDefault(require("../utils/validate-input"));
7
- const questions = [
8
- {
9
- type: 'list',
10
- name: 'kind',
11
- message: 'Please choose the model type',
12
- default: 'collectionType',
13
- choices: [
14
- { name: 'Collection Type', value: 'collectionType' },
15
- { name: 'Single Type', value: 'singleType' },
16
- ],
17
- validate: (input) => (0, validate_input_1.default)(input),
18
- },
19
- ];
20
- exports.default = questions;
21
- //# sourceMappingURL=kind-prompts.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"kind-prompts.js","sourceRoot":"","sources":["../../../src/plops/prompts/kind-prompts.ts"],"names":[],"mappings":";;;;;AAEA,6EAAoD;AAEpD,MAAM,SAAS,GAA0B;IACvC;QACE,IAAI,EAAE,MAAM;QACZ,IAAI,EAAE,MAAM;QACZ,OAAO,EAAE,8BAA8B;QACvC,OAAO,EAAE,gBAAgB;QACzB,OAAO,EAAE;YACP,EAAE,IAAI,EAAE,iBAAiB,EAAE,KAAK,EAAE,gBAAgB,EAAE;YACpD,EAAE,IAAI,EAAE,aAAa,EAAE,KAAK,EAAE,YAAY,EAAE;SAC7C;QACD,QAAQ,EAAE,CAAC,KAAa,EAAE,EAAE,CAAC,IAAA,wBAAa,EAAC,KAAK,CAAC;KAClD;CACF,CAAC;AAEF,kBAAe,SAAS,CAAC"}
@@ -1,38 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const typescript_utils_1 = __importDefault(require("@strapi/typescript-utils"));
7
- const get_destination_prompts_1 = __importDefault(require("./prompts/get-destination-prompts"));
8
- const get_file_path_1 = __importDefault(require("./utils/get-file-path"));
9
- exports.default = (plop) => {
10
- // Service generator
11
- plop.setGenerator('service', {
12
- description: 'Generate a service for an API',
13
- prompts: [
14
- {
15
- type: 'input',
16
- name: 'id',
17
- message: 'Service name',
18
- },
19
- ...(0, get_destination_prompts_1.default)('service', plop.getDestBasePath()),
20
- ],
21
- actions(answers) {
22
- if (!answers) {
23
- return [];
24
- }
25
- const filePath = (0, get_file_path_1.default)(answers?.destination);
26
- const currentDir = process.cwd();
27
- const language = typescript_utils_1.default.isUsingTypeScriptSync(currentDir) ? 'ts' : 'js';
28
- return [
29
- {
30
- type: 'add',
31
- path: `${filePath}/services/{{ id }}.${language}`,
32
- templateFile: `templates/${language}/service.${language}.hbs`,
33
- },
34
- ];
35
- },
36
- });
37
- };
38
- //# sourceMappingURL=service.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"service.js","sourceRoot":"","sources":["../../src/plops/service.ts"],"names":[],"mappings":";;;;;AACA,gFAA+C;AAE/C,gGAAsE;AACtE,0EAAgD;AAEhD,kBAAe,CAAC,IAAiB,EAAE,EAAE;IACnC,oBAAoB;IACpB,IAAI,CAAC,YAAY,CAAC,SAAS,EAAE;QAC3B,WAAW,EAAE,+BAA+B;QAC5C,OAAO,EAAE;YACP;gBACE,IAAI,EAAE,OAAO;gBACb,IAAI,EAAE,IAAI;gBACV,OAAO,EAAE,cAAc;aACxB;YACD,GAAG,IAAA,iCAAqB,EAAC,SAAS,EAAE,IAAI,CAAC,eAAe,EAAE,CAAC;SAC5D;QACD,OAAO,CAAC,OAAO;YACb,IAAI,CAAC,OAAO,EAAE;gBACZ,OAAO,EAAE,CAAC;aACX;YAED,MAAM,QAAQ,GAAG,IAAA,uBAAW,EAAC,OAAO,EAAE,WAAW,CAAC,CAAC;YACnD,MAAM,UAAU,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;YACjC,MAAM,QAAQ,GAAG,0BAAO,CAAC,qBAAqB,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC;YAEzE,OAAO;gBACL;oBACE,IAAI,EAAE,KAAK;oBACX,IAAI,EAAE,GAAG,QAAQ,sBAAsB,QAAQ,EAAE;oBACjD,YAAY,EAAE,aAAa,QAAQ,YAAY,QAAQ,MAAM;iBAC9D;aACF,CAAC;QACJ,CAAC;KACF,CAAC,CAAC;AACL,CAAC,CAAC"}
@@ -1,15 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.default = (destination) => {
4
- if (destination === 'api') {
5
- return `api/{{ api }}`;
6
- }
7
- if (destination === 'plugin') {
8
- return `plugins/{{ plugin }}/server`;
9
- }
10
- if (destination === 'root') {
11
- return './';
12
- }
13
- return `api/{{ id }}`;
14
- };
15
- //# sourceMappingURL=get-file-path.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"get-file-path.js","sourceRoot":"","sources":["../../../src/plops/utils/get-file-path.ts"],"names":[],"mappings":";;AAAA,kBAAe,CAAC,WAAmB,EAAE,EAAE;IACrC,IAAI,WAAW,KAAK,KAAK,EAAE;QACzB,OAAO,eAAe,CAAC;KACxB;IAED,IAAI,WAAW,KAAK,QAAQ,EAAE;QAC5B,OAAO,6BAA6B,CAAC;KACtC;IAED,IAAI,WAAW,KAAK,MAAM,EAAE;QAC1B,OAAO,IAAI,CAAC;KACb;IAED,OAAO,cAAc,CAAC;AACxB,CAAC,CAAC"}
@@ -1,9 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.default = (date = new Date()) => {
4
- return new Date(date.getTime() - date.getTimezoneOffset() * 60000)
5
- .toJSON()
6
- .replace(/[-:]/g, '.')
7
- .replace(/\....Z/, '');
8
- };
9
- //# sourceMappingURL=get-formatted-date.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"get-formatted-date.js","sourceRoot":"","sources":["../../../src/plops/utils/get-formatted-date.ts"],"names":[],"mappings":";;AAAA,kBAAe,CAAC,OAAa,IAAI,IAAI,EAAE,EAAE,EAAE;IACzC,OAAO,IAAI,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC,iBAAiB,EAAE,GAAG,KAAK,CAAC;SAC/D,MAAM,EAAE;SACR,OAAO,CAAC,OAAO,EAAE,GAAG,CAAC;SACrB,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;AAC3B,CAAC,CAAC"}
@@ -1,10 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.default = (input) => {
4
- const regex = /^[A-Za-z-|_]+$/g;
5
- if (!input) {
6
- return 'You must provide an input';
7
- }
8
- return regex.test(input) || "Please use only letters, '-', '_', and no spaces";
9
- };
10
- //# sourceMappingURL=validate-attribute-input.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"validate-attribute-input.js","sourceRoot":"","sources":["../../../src/plops/utils/validate-attribute-input.ts"],"names":[],"mappings":";;AAAA,kBAAe,CAAC,KAAa,EAAE,EAAE;IAC/B,MAAM,KAAK,GAAG,iBAAiB,CAAC;IAEhC,IAAI,CAAC,KAAK,EAAE;QACV,OAAO,2BAA2B,CAAC;KACpC;IAED,OAAO,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,mDAAmD,CAAC;AAClF,CAAC,CAAC"}
@@ -1,10 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.default = (input) => {
4
- const regex = /^[A-Za-z-_0-9]+$/g;
5
- if (!input) {
6
- return 'You must provide an input';
7
- }
8
- return regex.test(input) || "Please use only letters and number, '-' or '_' and no spaces";
9
- };
10
- //# sourceMappingURL=validate-file-name-input.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"validate-file-name-input.js","sourceRoot":"","sources":["../../../src/plops/utils/validate-file-name-input.ts"],"names":[],"mappings":";;AAAA,kBAAe,CAAC,KAAa,EAAE,EAAE;IAC/B,MAAM,KAAK,GAAG,mBAAmB,CAAC;IAElC,IAAI,CAAC,KAAK,EAAE;QACV,OAAO,2BAA2B,CAAC;KACpC;IAED,OAAO,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,8DAA8D,CAAC;AAC7F,CAAC,CAAC"}
@@ -1,10 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.default = (input) => {
4
- const regex = /^[A-Za-z-]+$/g;
5
- if (!input) {
6
- return 'You must provide an input';
7
- }
8
- return regex.test(input) || "Please use only letters, '-' and no spaces";
9
- };
10
- //# sourceMappingURL=validate-input.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"validate-input.js","sourceRoot":"","sources":["../../../src/plops/utils/validate-input.ts"],"names":[],"mappings":";;AAAA,kBAAe,CAAC,KAAa,EAAE,EAAE;IAC/B,MAAM,KAAK,GAAG,eAAe,CAAC;IAE9B,IAAI,CAAC,KAAK,EAAE;QACV,OAAO,2BAA2B,CAAC;KACpC;IAED,OAAO,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,4CAA4C,CAAC;AAC3E,CAAC,CAAC"}
@@ -1,3 +0,0 @@
1
- # Strapi plugin {{ pluginName }}
2
-
3
- A quick description of {{ pluginName }}.
@@ -1,42 +0,0 @@
1
- {
2
- "name": "{{ pluginName }}",
3
- "version": "0.0.0",
4
- "description": "This is the description of the plugin.",
5
- "strapi": {
6
- "name": "{{ pluginName }}",
7
- "description": "Description of {{titleCase pluginName }} plugin",
8
- "kind": "plugin",
9
- "displayName": "{{titleCase pluginName }}"
10
- },
11
- "dependencies": {
12
- "@strapi/design-system": "^1.6.3",
13
- "@strapi/helper-plugin": "^4.6.0",
14
- "@strapi/icons": "^1.6.3",
15
- "prop-types": "^15.7.2"
16
- },
17
- "devDependencies": {
18
- "react": "^18.2.0",
19
- "react-dom": "^18.2.0",
20
- "react-router-dom": "^5.3.4",
21
- "styled-components": "^5.3.6"
22
- },
23
- "peerDependencies": {
24
- "react": "^17.0.0 || ^18.0.0",
25
- "react-dom": "^17.0.0 || ^18.0.0",
26
- "react-router-dom": "^5.3.4",
27
- "styled-components": "^5.3.6"
28
- },
29
- "author": {
30
- "name": "A Strapi developer"
31
- },
32
- "maintainers": [
33
- {
34
- "name": "A Strapi developer"
35
- }
36
- ],
37
- "engines": {
38
- "node": ">=16.0.0 <=20.x.x",
39
- "npm": ">=6.0.0"
40
- },
41
- "license": "MIT"
42
- }
@@ -1,3 +0,0 @@
1
- # Strapi plugin {{ pluginName }}
2
-
3
- A quick description of {{ pluginName }}.
@@ -1,51 +0,0 @@
1
- {
2
- "name": "{{ pluginName }}",
3
- "version": "0.0.0",
4
- "description": "This is the description of the plugin.",
5
- "strapi": {
6
- "name": "{{ pluginName }}",
7
- "description": "Description of {{ pluginName }} plugin",
8
- "kind": "plugin"
9
- },
10
- "dependencies": {
11
- "@strapi/design-system": "^1.6.3",
12
- "@strapi/helper-plugin": "^4.6.0",
13
- "@strapi/icons": "^1.6.3",
14
- "prop-types": "^15.7.2"
15
- },
16
- "devDependencies": {
17
- "@strapi/typescript-utils": "^4.6.0",
18
- "@types/react": "^17.0.53",
19
- "@types/react-dom": "^18.0.28",
20
- "@types/react-router-dom": "^5.3.3",
21
- "@types/styled-components": "^5.1.26",
22
- "react": "^18.2.0",
23
- "react-dom": "^18.2.0",
24
- "react-router-dom": "^5.3.4",
25
- "styled-components": "^5.3.6",
26
- "typescript": "5.0.4"
27
- },
28
- "peerDependencies": {
29
- "react": "^17.0.0 || ^18.0.0",
30
- "react-dom": "^17.0.0 || ^18.0.0",
31
- "react-router-dom": "^5.3.4",
32
- "styled-components": "^5.3.6"
33
- },
34
- "author": {
35
- "name": "A Strapi developer"
36
- },
37
- "maintainers": [
38
- {
39
- "name": "A Strapi developer"
40
- }
41
- ],
42
- "engines": {
43
- "node": ">=16.0.0 <=20.x.x",
44
- "npm": ">=6.0.0"
45
- },
46
- "scripts": {
47
- "develop": "tsc -p tsconfig.server.json -w",
48
- "build": "tsc -p tsconfig.server.json"
49
- },
50
- "license": "MIT"
51
- }