generated from anolilab/monorepo-template
-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
plopfile.js
125 lines (119 loc) · 4.04 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
115
116
117
118
119
120
121
122
123
124
125
// eslint-disable-next-line unicorn/prefer-module,func-names
module.exports = function (
/** @type {import('plop').NodePlopAPI} */
plop,
) {
plop.setGenerator("package", {
description: "Create new package",
prompts: [
{
type: "input",
name: "name",
message: "What is your package name? Example: @test/package-name",
validate: (value) => {
if (/.+/.test(value)) {
return true;
}
return "name is required";
},
},
{
type: "input",
name: "export_name",
message: "What is your package export name? Its based on your package name: test-package-name",
// eslint-disable-next-line radar/no-identical-functions
validate: (value) => {
if (/.+/.test(value)) {
return true;
}
return "name is required";
},
},
{
type: "input",
name: "description",
message: "What is your package description?",
validate: (value) => {
if (/.+/.test(value)) {
return true;
}
return "description is required";
},
},
{
type: "input",
name: "homepage",
message: "What is your homepage url?",
validate: (value) => {
if (/.+/.test(value)) {
return true;
}
return "homepage is required";
},
},
{
type: "input",
name: "repository",
message: "What is your repository name? Example: name/repo",
validate: (value) => {
if (/.+/.test(value)) {
return true;
}
return "repository is required";
},
},
{
type: "input",
name: "directory",
message: "What is your package directory name?",
validate: (value) => {
if (/.+/.test(value)) {
return true;
}
return "directory is required";
},
},
],
actions: () => [
{
type: "add",
path: "packages/{{directory}}/.npmignore",
templateFile: "plop-templates/package/.npmignore.hbs",
},
{
type: "add",
path: "packages/{{directory}}/.releaserc.json",
templateFile: "plop-templates/package/.releaserc.json.hbs",
},
{
type: "add",
path: "packages/{{directory}}/.gitkeep",
},
{
type: "add",
path: "packages/{{directory}}/babel.config.cjs",
templateFile: "plop-templates/package/babel.config.cjs.hbs",
},
{
type: "add",
path: "packages/{{directory}}/LICENSE.md",
templateFile: "plop-templates/package/LICENSE.md.hbs",
},
{
type: "add",
path: "packages/{{directory}}/package.json",
templateFile: "plop-templates/package/package.json.hbs",
},
{
type: "add",
path: "packages/{{directory}}/README.md",
templateFile: "plop-templates/package/README.md.hbs",
},
{
type: "add",
path: "packages/{{directory}}/tsconfig.json",
templateFile: "plop-templates/package/tsconfig.json.hbs",
},
],
});
};