-
Notifications
You must be signed in to change notification settings - Fork 11
/
plopfile.mjs
51 lines (50 loc) · 1.25 KB
/
plopfile.mjs
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
// See https://github.com/plopjs/plop
// Run `npx plop` to generate a boilerplate.
export default (/** @type {import('plop').NodePlopAPI} */ plop) => {
plop.setGenerator("command", {
description: "new command",
prompts: [
{
type: "input",
name: "name",
message: "name of the command",
validate: (value) => {
if (/^[a-z]+$/.test(value)) {
return true;
}
return "name should match /^[a-z]+$/";
},
},
],
actions: [
{
type: "add",
path: "src/commands/{{name}}.ts",
templateFile: "templates/command.ts.hbs",
},
],
});
plop.setGenerator("message-handler", {
description: "new message handler",
prompts: [
{
type: "input",
name: "name",
message: "name of the handler, words separated by hyphen",
validate: (value) => {
if (/^[a-z]+(-[a-z]+)*$/.test(value)) {
return true;
}
return "name should match /^[a-z]+(-[a-z]+)*$/";
},
},
],
actions: [
{
type: "add",
path: "src/events/messageCreate/handlers/{{name}}.ts",
templateFile: "templates/message-handler.ts.hbs",
},
],
});
};