-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathplop.js
43 lines (42 loc) · 1 KB
/
plop.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
export default function (
/** @type {import('plop').NodePlopAPI} **/
plop,
) {
// controller generator
plop.setGenerator('resource-types', {
description: 'Resources types',
prompts: [
{
type: 'input',
name: 'name',
message: 'Name (PascalCase)',
},
{
type: 'input',
name: 'path',
message: 'API Path (no prefix, with trailing slash, lowercase)',
},
{
type: 'input',
name: 'path-param',
message: 'API Param name (INCLUDE BRACKETS, lowercase, id or name)',
},
{
type: 'checkbox',
name: 'methods',
choices: ['list', 'retrieve', 'create', 'update', 'del'],
message: 'Resource Methods',
},
],
actions: [
{
type: 'add',
path: 'types/{{pascalCase name}}Resource.d.ts',
templateFile: 'plop-templates/ResourceTypes.ts.hbs',
},
],
});
plop.setHelper('ifEquals', function (arg1, arg2) {
return arg1 == arg2;
});
}