@strapi/generators 4.10.1-experimental.0 → 4.10.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +4 -4
- package/dist/files/js/plugin/admin/src/components/Initializer/index.js +0 -26
- package/dist/files/js/plugin/admin/src/components/PluginIcon/index.js +0 -12
- package/dist/files/js/plugin/admin/src/index.js +0 -63
- package/dist/files/js/plugin/admin/src/pages/App/index.js +0 -25
- package/dist/files/js/plugin/admin/src/pages/HomePage/index.js +0 -20
- package/dist/files/js/plugin/admin/src/pluginId.js +0 -5
- package/dist/files/js/plugin/admin/src/translations/en.json +0 -1
- package/dist/files/js/plugin/admin/src/translations/fr.json +0 -1
- package/dist/files/js/plugin/admin/src/utils/getTrad.js +0 -5
- package/dist/files/js/plugin/server/bootstrap.js +0 -5
- package/dist/files/js/plugin/server/config/index.js +0 -6
- package/dist/files/js/plugin/server/content-types/index.js +0 -3
- package/dist/files/js/plugin/server/controllers/index.js +0 -7
- package/dist/files/js/plugin/server/controllers/my-controller.js.hbs +0 -10
- package/dist/files/js/plugin/server/destroy.js +0 -5
- package/dist/files/js/plugin/server/index.js +0 -25
- package/dist/files/js/plugin/server/middlewares/index.js +0 -3
- package/dist/files/js/plugin/server/policies/index.js +0 -3
- package/dist/files/js/plugin/server/register.js +0 -5
- package/dist/files/js/plugin/server/routes/index.js +0 -10
- package/dist/files/js/plugin/server/services/index.js +0 -7
- package/dist/files/js/plugin/server/services/my-service.js +0 -7
- package/dist/files/js/plugin/strapi-admin.js +0 -3
- package/dist/files/js/plugin/strapi-server.js +0 -3
- package/dist/files/ts/plugin/admin/src/components/Initializer/index.tsx +0 -24
- package/dist/files/ts/plugin/admin/src/components/PluginIcon/index.tsx +0 -12
- package/dist/files/ts/plugin/admin/src/index.tsx +0 -67
- package/dist/files/ts/plugin/admin/src/pages/App/index.tsx +0 -25
- package/dist/files/ts/plugin/admin/src/pages/HomePage/index.tsx +0 -19
- package/dist/files/ts/plugin/admin/src/pluginId.ts +0 -5
- package/dist/files/ts/plugin/admin/src/translations/en.json +0 -1
- package/dist/files/ts/plugin/admin/src/translations/fr.json +0 -1
- package/dist/files/ts/plugin/admin/src/utils/getTrad.ts +0 -5
- package/dist/files/ts/plugin/custom.d.ts +0 -5
- package/dist/files/ts/plugin/server/bootstrap.ts +0 -5
- package/dist/files/ts/plugin/server/config/index.ts +0 -4
- package/dist/files/ts/plugin/server/content-types/index.ts +0 -1
- package/dist/files/ts/plugin/server/controllers/index.ts +0 -5
- package/dist/files/ts/plugin/server/controllers/my-controller.ts.hbs +0 -10
- package/dist/files/ts/plugin/server/destroy.ts +0 -5
- package/dist/files/ts/plugin/server/index.ts +0 -23
- package/dist/files/ts/plugin/server/middlewares/index.ts +0 -1
- package/dist/files/ts/plugin/server/policies/index.ts +0 -1
- package/dist/files/ts/plugin/server/register.ts +0 -5
- package/dist/files/ts/plugin/server/routes/index.ts +0 -10
- package/dist/files/ts/plugin/server/services/index.ts +0 -5
- package/dist/files/ts/plugin/server/services/my-service.ts +0 -7
- package/dist/files/ts/plugin/strapi-admin.js +0 -3
- package/dist/files/ts/plugin/strapi-server.js +0 -3
- package/dist/files/ts/plugin/tsconfig.json +0 -20
- package/dist/files/ts/plugin/tsconfig.server.json +0 -25
- package/dist/index.d.ts +0 -5
- package/dist/index.js +0 -32
- package/dist/index.js.map +0 -1
- package/dist/plopfile.d.ts +0 -3
- package/dist/plopfile.js +0 -29
- package/dist/plopfile.js.map +0 -1
- package/dist/plops/api.d.ts +0 -3
- package/dist/plops/api.js +0 -79
- package/dist/plops/api.js.map +0 -1
- package/dist/plops/content-type.d.ts +0 -3
- package/dist/plops/content-type.js +0 -135
- package/dist/plops/content-type.js.map +0 -1
- package/dist/plops/controller.d.ts +0 -3
- package/dist/plops/controller.js +0 -40
- package/dist/plops/controller.js.map +0 -1
- package/dist/plops/middleware.d.ts +0 -3
- package/dist/plops/middleware.js +0 -40
- package/dist/plops/middleware.js.map +0 -1
- package/dist/plops/migration.d.ts +0 -3
- package/dist/plops/migration.js +0 -35
- package/dist/plops/migration.js.map +0 -1
- package/dist/plops/plugin.d.ts +0 -3
- package/dist/plops/plugin.js +0 -84
- package/dist/plops/plugin.js.map +0 -1
- package/dist/plops/policy.d.ts +0 -3
- package/dist/plops/policy.js +0 -40
- package/dist/plops/policy.js.map +0 -1
- package/dist/plops/prompts/bootstrap-api-prompts.d.ts +0 -3
- package/dist/plops/prompts/bootstrap-api-prompts.js +0 -12
- package/dist/plops/prompts/bootstrap-api-prompts.js.map +0 -1
- package/dist/plops/prompts/ct-names-prompts.d.ts +0 -3
- package/dist/plops/prompts/ct-names-prompts.js +0 -45
- package/dist/plops/prompts/ct-names-prompts.js.map +0 -1
- package/dist/plops/prompts/draft-and-publish-prompts.d.ts +0 -3
- package/dist/plops/prompts/draft-and-publish-prompts.js +0 -12
- package/dist/plops/prompts/draft-and-publish-prompts.js.map +0 -1
- package/dist/plops/prompts/get-attributes-prompts.d.ts +0 -3
- package/dist/plops/prompts/get-attributes-prompts.js +0 -95
- package/dist/plops/prompts/get-attributes-prompts.js.map +0 -1
- package/dist/plops/prompts/get-destination-prompts.d.ts +0 -5
- package/dist/plops/prompts/get-destination-prompts.js +0 -72
- package/dist/plops/prompts/get-destination-prompts.js.map +0 -1
- package/dist/plops/prompts/kind-prompts.d.ts +0 -3
- package/dist/plops/prompts/kind-prompts.js +0 -21
- package/dist/plops/prompts/kind-prompts.js.map +0 -1
- package/dist/plops/service.d.ts +0 -3
- package/dist/plops/service.js +0 -38
- package/dist/plops/service.js.map +0 -1
- package/dist/plops/utils/get-file-path.d.ts +0 -2
- package/dist/plops/utils/get-file-path.js +0 -15
- package/dist/plops/utils/get-file-path.js.map +0 -1
- package/dist/plops/utils/get-formatted-date.d.ts +0 -2
- package/dist/plops/utils/get-formatted-date.js +0 -9
- package/dist/plops/utils/get-formatted-date.js.map +0 -1
- package/dist/plops/utils/validate-attribute-input.d.ts +0 -2
- package/dist/plops/utils/validate-attribute-input.js +0 -10
- package/dist/plops/utils/validate-attribute-input.js.map +0 -1
- package/dist/plops/utils/validate-file-name-input.d.ts +0 -2
- package/dist/plops/utils/validate-file-name-input.js +0 -10
- package/dist/plops/utils/validate-file-name-input.js.map +0 -1
- package/dist/plops/utils/validate-input.d.ts +0 -2
- package/dist/plops/utils/validate-input.js +0 -10
- package/dist/plops/utils/validate-input.js.map +0 -1
- package/dist/templates/js/README.md.hbs +0 -3
- package/dist/templates/js/collection-type-routes.js.hbs +0 -49
- package/dist/templates/js/content-type.schema.json.hbs +0 -15
- package/dist/templates/js/controller.js.hbs +0 -15
- package/dist/templates/js/core-controller.js.hbs +0 -9
- package/dist/templates/js/core-router.js.hbs +0 -9
- package/dist/templates/js/core-service.js.hbs +0 -9
- package/dist/templates/js/middleware.js.hbs +0 -14
- package/dist/templates/js/migration.js.hbs +0 -15
- package/dist/templates/js/plugin-package.json.hbs +0 -42
- package/dist/templates/js/policy.js.hbs +0 -18
- package/dist/templates/js/service.js.hbs +0 -7
- package/dist/templates/js/single-route.js.hbs +0 -13
- package/dist/templates/js/single-type-routes.js.hbs +0 -33
- package/dist/templates/ts/README.md.hbs +0 -3
- package/dist/templates/ts/collection-type-routes.ts.hbs +0 -49
- package/dist/templates/ts/content-type.schema.json.hbs +0 -15
- package/dist/templates/ts/controller.ts.hbs +0 -13
- package/dist/templates/ts/core-controller.ts.hbs +0 -7
- package/dist/templates/ts/core-router.ts.hbs +0 -7
- package/dist/templates/ts/core-service.ts.hbs +0 -7
- package/dist/templates/ts/middleware.ts.hbs +0 -14
- package/dist/templates/ts/migration.ts.hbs +0 -11
- package/dist/templates/ts/plugin-package.json.hbs +0 -51
- package/dist/templates/ts/policy.ts.hbs +0 -16
- package/dist/templates/ts/service.ts.hbs +0 -5
- package/dist/templates/ts/single-route.ts.hbs +0 -13
- package/dist/templates/ts/single-type-routes.ts.hbs +0 -31
package/dist/plops/policy.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"policy.js","sourceRoot":"","sources":["../../src/plops/policy.ts"],"names":[],"mappings":";;;;;AACA,gFAA+C;AAE/C,gGAAsE;AACtE,4EAAmD;AACnD,0EAAgD;AAEhD,kBAAe,CAAC,IAAiB,EAAE,EAAE;IACnC,mBAAmB;IACnB,IAAI,CAAC,YAAY,CAAC,QAAQ,EAAE;QAC1B,WAAW,EAAE,8BAA8B;QAC3C,OAAO,EAAE;YACP;gBACE,IAAI,EAAE,OAAO;gBACb,IAAI,EAAE,IAAI;gBACV,OAAO,EAAE,aAAa;gBACtB,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,IAAA,wBAAa,EAAC,KAAK,CAAC;aAC1C;YACD,GAAG,IAAA,iCAAqB,EAAC,QAAQ,EAAE,IAAI,CAAC,eAAe,EAAE,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC;SACjF;QACD,OAAO,CAAC,OAAO;YACb,IAAI,CAAC,OAAO,EAAE;gBACZ,OAAO,EAAE,CAAC;aACX;YAED,MAAM,QAAQ,GAAG,IAAA,uBAAW,EAAC,OAAO,CAAC,WAAW,CAAC,CAAC;YAClD,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,WAAW,QAAQ,MAAM;iBAC7D;aACF,CAAC;QACJ,CAAC;KACF,CAAC,CAAC;AACL,CAAC,CAAC"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const questions = [
|
|
4
|
-
{
|
|
5
|
-
type: 'confirm',
|
|
6
|
-
name: 'bootstrapApi',
|
|
7
|
-
default: true,
|
|
8
|
-
message: 'Bootstrap API related files?',
|
|
9
|
-
},
|
|
10
|
-
];
|
|
11
|
-
exports.default = questions;
|
|
12
|
-
//# sourceMappingURL=bootstrap-api-prompts.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"bootstrap-api-prompts.js","sourceRoot":"","sources":["../../../src/plops/prompts/bootstrap-api-prompts.ts"],"names":[],"mappings":";;AAEA,MAAM,SAAS,GAA0B;IACvC;QACE,IAAI,EAAE,SAAS;QACf,IAAI,EAAE,cAAc;QACpB,OAAO,EAAE,IAAI;QACb,OAAO,EAAE,8BAA8B;KACxC;CACF,CAAC;AAEF,kBAAe,SAAS,CAAC"}
|
|
@@ -1,45 +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 pluralize_1 = __importDefault(require("pluralize"));
|
|
7
|
-
const slugify_1 = __importDefault(require("@sindresorhus/slugify"));
|
|
8
|
-
const utils_1 = __importDefault(require("@strapi/utils"));
|
|
9
|
-
const questions = [
|
|
10
|
-
{
|
|
11
|
-
type: 'input',
|
|
12
|
-
name: 'displayName',
|
|
13
|
-
message: 'Content type display name',
|
|
14
|
-
validate: (input) => !!input,
|
|
15
|
-
},
|
|
16
|
-
{
|
|
17
|
-
type: 'input',
|
|
18
|
-
name: 'singularName',
|
|
19
|
-
message: 'Content type singular name',
|
|
20
|
-
default: (answers) => (0, slugify_1.default)(answers.displayName),
|
|
21
|
-
validate(input) {
|
|
22
|
-
if (!utils_1.default.isKebabCase(input)) {
|
|
23
|
-
return 'Value must be in kebab-case';
|
|
24
|
-
}
|
|
25
|
-
return true;
|
|
26
|
-
},
|
|
27
|
-
},
|
|
28
|
-
{
|
|
29
|
-
type: 'input',
|
|
30
|
-
name: 'pluralName',
|
|
31
|
-
message: 'Content type plural name',
|
|
32
|
-
default: (answers) => (0, pluralize_1.default)(answers.singularName),
|
|
33
|
-
validate(input, answers) {
|
|
34
|
-
if (answers.singularName === input) {
|
|
35
|
-
return 'Singular and plural names cannot be the same';
|
|
36
|
-
}
|
|
37
|
-
if (!utils_1.default.isKebabCase(input)) {
|
|
38
|
-
return 'Value must be in kebab-case';
|
|
39
|
-
}
|
|
40
|
-
return true;
|
|
41
|
-
},
|
|
42
|
-
},
|
|
43
|
-
];
|
|
44
|
-
exports.default = questions;
|
|
45
|
-
//# sourceMappingURL=ct-names-prompts.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ct-names-prompts.js","sourceRoot":"","sources":["../../../src/plops/prompts/ct-names-prompts.ts"],"names":[],"mappings":";;;;;AAAA,0DAAkC;AAClC,oEAA4C;AAC5C,0DAAkC;AAUlC,MAAM,SAAS,GAA0B;IACvC;QACE,IAAI,EAAE,OAAO;QACb,IAAI,EAAE,aAAa;QACnB,OAAO,EAAE,2BAA2B;QACpC,QAAQ,EAAE,CAAC,KAAa,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK;KACrC;IACD;QACE,IAAI,EAAE,OAAO;QACb,IAAI,EAAE,cAAc;QACpB,OAAO,EAAE,4BAA4B;QACrC,OAAO,EAAE,CAAC,OAAgB,EAAE,EAAE,CAAC,IAAA,iBAAO,EAAC,OAAO,CAAC,WAAW,CAAC;QAC3D,QAAQ,CAAC,KAAK;YACZ,IAAI,CAAC,eAAK,CAAC,WAAW,CAAC,KAAK,CAAC,EAAE;gBAC7B,OAAO,6BAA6B,CAAC;aACtC;YAED,OAAO,IAAI,CAAC;QACd,CAAC;KACF;IACD;QACE,IAAI,EAAE,OAAO;QACb,IAAI,EAAE,YAAY;QAClB,OAAO,EAAE,0BAA0B;QACnC,OAAO,EAAE,CAAC,OAAgB,EAAE,EAAE,CAAC,IAAA,mBAAS,EAAC,OAAO,CAAC,YAAY,CAAC;QAC9D,QAAQ,CAAC,KAAa,EAAE,OAAgB;YACtC,IAAI,OAAO,CAAC,YAAY,KAAK,KAAK,EAAE;gBAClC,OAAO,8CAA8C,CAAC;aACvD;YAED,IAAI,CAAC,eAAK,CAAC,WAAW,CAAC,KAAK,CAAC,EAAE;gBAC7B,OAAO,6BAA6B,CAAC;aACtC;YAED,OAAO,IAAI,CAAC;QACd,CAAC;KACF;CACF,CAAC;AAEF,kBAAe,SAAS,CAAC"}
|
|
@@ -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"}
|
package/dist/plops/service.d.ts
DELETED
package/dist/plops/service.js
DELETED
|
@@ -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,49 +0,0 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
routes: [
|
|
3
|
-
{
|
|
4
|
-
method: 'GET',
|
|
5
|
-
path: '/{{ pluralize id }}',
|
|
6
|
-
handler: '{{ id }}.find',
|
|
7
|
-
config: {
|
|
8
|
-
policies: [],
|
|
9
|
-
middlewares: [],
|
|
10
|
-
},
|
|
11
|
-
},
|
|
12
|
-
{
|
|
13
|
-
method: 'GET',
|
|
14
|
-
path: '/{{ pluralize id }}/:id',
|
|
15
|
-
handler: '{{ id }}.findOne',
|
|
16
|
-
config: {
|
|
17
|
-
policies: [],
|
|
18
|
-
middlewares: [],
|
|
19
|
-
},
|
|
20
|
-
},
|
|
21
|
-
{
|
|
22
|
-
method: 'POST',
|
|
23
|
-
path: '/{{ pluralize id }}',
|
|
24
|
-
handler: '{{ id }}.create',
|
|
25
|
-
config: {
|
|
26
|
-
policies: [],
|
|
27
|
-
middlewares: [],
|
|
28
|
-
},
|
|
29
|
-
},
|
|
30
|
-
{
|
|
31
|
-
method: 'PUT',
|
|
32
|
-
path: '/{{ pluralize id }}/:id',
|
|
33
|
-
handler: '{{ id }}.update',
|
|
34
|
-
config: {
|
|
35
|
-
policies: [],
|
|
36
|
-
middlewares: [],
|
|
37
|
-
},
|
|
38
|
-
},
|
|
39
|
-
{
|
|
40
|
-
method: 'DELETE',
|
|
41
|
-
path: '/{{ pluralize id }}/:id',
|
|
42
|
-
handler: '{{ id }}.delete',
|
|
43
|
-
config: {
|
|
44
|
-
policies: [],
|
|
45
|
-
middlewares: [],
|
|
46
|
-
},
|
|
47
|
-
},
|
|
48
|
-
],
|
|
49
|
-
};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
{
|
|
3
|
-
"kind": "{{kind}}",
|
|
4
|
-
"collectionName": "{{ collectionName }}",
|
|
5
|
-
"info": {
|
|
6
|
-
"singularName": "{{ singularName }}",
|
|
7
|
-
"pluralName": "{{ pluralName }}",
|
|
8
|
-
"displayName": "{{ displayName }}"
|
|
9
|
-
},
|
|
10
|
-
"options": {
|
|
11
|
-
"draftAndPublish": {{ useDraftAndPublish }},
|
|
12
|
-
"comment": ""
|
|
13
|
-
},
|
|
14
|
-
"attributes": {}
|
|
15
|
-
}
|