@strapi/generators 0.0.0-next.fb3a0b82484ce466b1efb1b28f16fc8ef73aba4a → 0.0.0-next.fe88c7878fe2948cfdc68f4867329c1032a618b2

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 (100) hide show
  1. package/LICENSE +18 -3
  2. package/dist/files/js/plugin/admin/src/index.js +2 -4
  3. package/dist/files/js/plugin/admin/src/translations/en.json +1 -1
  4. package/dist/files/js/plugin/admin/src/translations/fr.json +1 -1
  5. package/dist/files/ts/plugin/admin/src/index.tsx +1 -1
  6. package/dist/files/ts/plugin/admin/src/translations/en.json +1 -1
  7. package/dist/files/ts/plugin/admin/src/translations/fr.json +1 -1
  8. package/dist/index.d.ts +1 -0
  9. package/dist/index.d.ts.map +1 -0
  10. package/dist/index.js +26 -27
  11. package/dist/index.js.map +1 -1
  12. package/dist/index.mjs +29 -0
  13. package/dist/index.mjs.map +1 -0
  14. package/dist/plopfile.d.ts +1 -0
  15. package/dist/plopfile.d.ts.map +1 -0
  16. package/dist/plopfile.js +702 -28
  17. package/dist/plopfile.js.map +1 -1
  18. package/dist/plopfile.mjs +679 -0
  19. package/dist/plopfile.mjs.map +1 -0
  20. package/dist/plops/api.d.ts +1 -0
  21. package/dist/plops/api.d.ts.map +1 -0
  22. package/dist/plops/content-type.d.ts +1 -0
  23. package/dist/plops/content-type.d.ts.map +1 -0
  24. package/dist/plops/controller.d.ts +1 -0
  25. package/dist/plops/controller.d.ts.map +1 -0
  26. package/dist/plops/middleware.d.ts +1 -0
  27. package/dist/plops/middleware.d.ts.map +1 -0
  28. package/dist/plops/migration.d.ts +1 -0
  29. package/dist/plops/migration.d.ts.map +1 -0
  30. package/dist/plops/plugin.d.ts +1 -0
  31. package/dist/plops/plugin.d.ts.map +1 -0
  32. package/dist/plops/policy.d.ts +1 -0
  33. package/dist/plops/policy.d.ts.map +1 -0
  34. package/dist/plops/prompts/bootstrap-api-prompts.d.ts +1 -0
  35. package/dist/plops/prompts/bootstrap-api-prompts.d.ts.map +1 -0
  36. package/dist/plops/prompts/ct-names-prompts.d.ts +1 -0
  37. package/dist/plops/prompts/ct-names-prompts.d.ts.map +1 -0
  38. package/dist/plops/prompts/draft-and-publish-prompts.d.ts +1 -0
  39. package/dist/plops/prompts/draft-and-publish-prompts.d.ts.map +1 -0
  40. package/dist/plops/prompts/get-attributes-prompts.d.ts +1 -0
  41. package/dist/plops/prompts/get-attributes-prompts.d.ts.map +1 -0
  42. package/dist/plops/prompts/get-destination-prompts.d.ts +1 -0
  43. package/dist/plops/prompts/get-destination-prompts.d.ts.map +1 -0
  44. package/dist/plops/prompts/kind-prompts.d.ts +1 -0
  45. package/dist/plops/prompts/kind-prompts.d.ts.map +1 -0
  46. package/dist/plops/service.d.ts +1 -0
  47. package/dist/plops/service.d.ts.map +1 -0
  48. package/dist/plops/utils/get-file-path.d.ts +1 -0
  49. package/dist/plops/utils/get-file-path.d.ts.map +1 -0
  50. package/dist/plops/utils/get-formatted-date.d.ts +1 -0
  51. package/dist/plops/utils/get-formatted-date.d.ts.map +1 -0
  52. package/dist/plops/utils/validate-attribute-input.d.ts +1 -0
  53. package/dist/plops/utils/validate-attribute-input.d.ts.map +1 -0
  54. package/dist/plops/utils/validate-file-name-input.d.ts +1 -0
  55. package/dist/plops/utils/validate-file-name-input.d.ts.map +1 -0
  56. package/dist/plops/utils/validate-input.d.ts +1 -0
  57. package/dist/plops/utils/validate-input.d.ts.map +1 -0
  58. package/dist/templates/js/plugin-package.json.hbs +3 -3
  59. package/dist/templates/ts/plugin-package.json.hbs +4 -4
  60. package/package.json +14 -12
  61. package/dist/files/js/plugin/.editorconfig +0 -7
  62. package/dist/files/ts/plugin/.editorconfig +0 -7
  63. package/dist/plops/api.js +0 -79
  64. package/dist/plops/api.js.map +0 -1
  65. package/dist/plops/content-type.js +0 -158
  66. package/dist/plops/content-type.js.map +0 -1
  67. package/dist/plops/controller.js +0 -40
  68. package/dist/plops/controller.js.map +0 -1
  69. package/dist/plops/middleware.js +0 -40
  70. package/dist/plops/middleware.js.map +0 -1
  71. package/dist/plops/migration.js +0 -35
  72. package/dist/plops/migration.js.map +0 -1
  73. package/dist/plops/plugin.js +0 -107
  74. package/dist/plops/plugin.js.map +0 -1
  75. package/dist/plops/policy.js +0 -40
  76. package/dist/plops/policy.js.map +0 -1
  77. package/dist/plops/prompts/bootstrap-api-prompts.js +0 -12
  78. package/dist/plops/prompts/bootstrap-api-prompts.js.map +0 -1
  79. package/dist/plops/prompts/ct-names-prompts.js +0 -68
  80. package/dist/plops/prompts/ct-names-prompts.js.map +0 -1
  81. package/dist/plops/prompts/draft-and-publish-prompts.js +0 -12
  82. package/dist/plops/prompts/draft-and-publish-prompts.js.map +0 -1
  83. package/dist/plops/prompts/get-attributes-prompts.js +0 -95
  84. package/dist/plops/prompts/get-attributes-prompts.js.map +0 -1
  85. package/dist/plops/prompts/get-destination-prompts.js +0 -72
  86. package/dist/plops/prompts/get-destination-prompts.js.map +0 -1
  87. package/dist/plops/prompts/kind-prompts.js +0 -21
  88. package/dist/plops/prompts/kind-prompts.js.map +0 -1
  89. package/dist/plops/service.js +0 -38
  90. package/dist/plops/service.js.map +0 -1
  91. package/dist/plops/utils/get-file-path.js +0 -15
  92. package/dist/plops/utils/get-file-path.js.map +0 -1
  93. package/dist/plops/utils/get-formatted-date.js +0 -9
  94. package/dist/plops/utils/get-formatted-date.js.map +0 -1
  95. package/dist/plops/utils/validate-attribute-input.js +0 -10
  96. package/dist/plops/utils/validate-attribute-input.js.map +0 -1
  97. package/dist/plops/utils/validate-file-name-input.js +0 -10
  98. package/dist/plops/utils/validate-file-name-input.js.map +0 -1
  99. package/dist/plops/utils/validate-input.js +0 -10
  100. package/dist/plops/utils/validate-input.js.map +0 -1
@@ -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"}