forked from Availity/availity-react
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplopfile.js
114 lines (110 loc) · 3.3 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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
const { execSync } = require('child_process');
module.exports = plop => {
plop.setHelper('userFullName', () => {
const name = execSync(
'git config --global --includes user.name'
).toString();
return name.replace(/\n$/, '').trim();
});
plop.setHelper('userEmail', () => {
const email = execSync(
'git config --global --includes user.email'
).toString();
return email.replace(/\n$/, '').trim();
});
plop.setActionType('bootstrap', () => {
execSync('npm run bootstrap');
});
plop.setGenerator('package', {
description: 'Create new package in monorepo',
prompts: [
{
type: 'input',
name: 'packageName',
message: 'package name',
},
{
type: 'input',
name: 'packageDescription',
message: 'package description',
},
],
actions: [
{
type: 'add',
path: 'packages/{{kebabCase packageName}}/CHANGELOG.md',
templateFile: 'plop-templates/package/CHANGELOG.md.hbs',
},
{
type: 'add',
path:
'packages/{{kebabCase packageName}}/types/{{pascalCase packageName}}.d.ts',
templateFile: 'plop-templates/package/Package.d.ts.hbs',
},
{
type: 'add',
path:
'packages/{{kebabCase packageName}}/src/{{pascalCase packageName}}.js',
templateFile: 'plop-templates/package/Package.js.hbs',
},
{
type: 'add',
path:
'packages/{{kebabCase packageName}}/tests/{{pascalCase packageName}}.test.js',
templateFile: 'plop-templates/package/Package.test.js.hbs',
},
{
type: 'add',
path: 'packages/{{kebabCase packageName}}/README.md',
templateFile: 'plop-templates/package/README.md.hbs',
},
{
type: 'add',
path: 'packages/{{kebabCase packageName}}/index.d.ts',
templateFile: 'plop-templates/package/index.d.ts.hbs',
},
{
type: 'add',
path: 'packages/{{kebabCase packageName}}/index.js',
templateFile: 'plop-templates/package/index.js.hbs',
},
{
type: 'add',
path: 'packages/{{kebabCase packageName}}/package.json',
templateFile: 'plop-templates/package/package.json.hbs',
},
{
type: 'add',
path: 'packages/storybook/stories/{{kebabCase packageName}}.stories.js',
templateFile: 'plop-templates/package/stories.js.hbs',
},
{
type: 'add',
path: 'packages/docs/source/components/{{kebabCase packageName}}.mdx',
templateFile: 'plop-templates/package/Package.mdx.hbs',
},
{
type: 'append',
path: 'packages/storybook/package.json',
pattern: '"devDependencies": {',
template: ' "@availity/{{kebabCase packageName}}": "^1.0.0",',
},
{
type: 'append',
path: 'packages/docs/gatsby-config.js',
pattern: /Components:\[/g,
template: "'components/{{kebabCase packageName}}',",
unique: true,
},
{
type: 'append',
path: 'packages/docs/package.json',
pattern: '"dependencies": {',
template: ' "@availity/{{kebabCase packageName}}": "^1.0.0",',
},
{
type: 'bootstrap',
},
],
});
};