forked from twilio-labs/paste
-
Notifications
You must be signed in to change notification settings - Fork 0
/
plopfile.js
81 lines (80 loc) · 2.6 KB
/
plopfile.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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
const camelCase = require('lodash/camelCase');
const startCase = require('lodash/startCase');
module.exports = function (plop) {
plop.setHelper('export', (txt) => `export {${startCase(camelCase(txt)).replace(/ /g, '')}}`);
plop.setHelper('import', (txt) => `import {${startCase(camelCase(txt)).replace(/ /g, '')}}`);
plop.setGenerator('create-package', {
description: 'Creates a new component package',
prompts: [
{
type: 'list',
name: 'component-type',
message: 'What type of component package?',
choices: ['components', 'layout', 'primitives'],
},
{
type: 'input',
name: 'component-name',
message: 'What is the component package name?',
},
{
type: 'list',
name: 'component-category',
message: 'What is the component package category?',
choices: [
'data display',
'feedback',
'interaction',
'layout',
'navigation',
'overlays',
'typography',
'user input',
],
},
{
type: 'list',
name: 'component-status',
message: 'What is the component package status?',
choices: ['alpha', 'beta', 'production'],
},
{
type: 'input',
name: 'component-description',
message: 'What is the component package description?',
},
],
actions: [
{
type: 'add',
path: 'packages/paste-core/{{component-type}}/{{kebabCase component-name}}/src/index.tsx',
templateFile: 'tools/plop-templates/component-index.hbs',
},
{
type: 'add',
path: 'packages/paste-core/{{component-type}}/{{kebabCase component-name}}/__tests__/index.spec.tsx',
templateFile: 'tools/plop-templates/component-tests.hbs',
},
{
type: 'add',
path: 'packages/paste-core/{{component-type}}/{{kebabCase component-name}}/stories/index.stories.tsx',
templateFile: 'tools/plop-templates/component-stories.hbs',
},
{
type: 'add',
path: 'packages/paste-core/{{component-type}}/{{kebabCase component-name}}/build.js',
templateFile: 'tools/plop-templates/build.hbs',
},
{
type: 'add',
path: 'packages/paste-core/{{component-type}}/{{kebabCase component-name}}/package.json',
templateFile: 'tools/plop-templates/package.hbs',
},
{
type: 'add',
path: 'packages/paste-core/{{component-type}}/{{kebabCase component-name}}/tsconfig.json',
templateFile: 'tools/plop-templates/tsconfig.hbs',
},
],
});
};