-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplopfile.mjs
54 lines (54 loc) · 1.27 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
52
53
54
export default function (plop) {
plop.setGenerator('library', {
description: 'create a new library',
prompts: [
{
type: 'input',
name: 'name',
message: 'Library name'
},
{
type: 'input',
name: 'scope',
default: () => '',
message: 'Library scope'
},
{
type: 'input',
name: 'description',
default: () => '',
message: 'Library description'
},
{
type: 'number',
name: 'port',
message: 'Debug port'
}
],
actions: [
{
type: 'addMany',
destination: 'packages/{{name}}',
base: 'plop-templates/library',
templateFiles: 'plop-templates/library/**/*'
},
{
type: 'modify',
path: '.vscode/launch.json',
transform (fileContents, data) {
const fileContentsJson = JSON.parse(fileContents)
fileContentsJson.configurations.push(
{
type: 'node',
request: 'attach',
name: `Attach (${data.name} package)`,
remoteRoot: '/aws-monorepo',
port: data.port
}
)
return JSON.stringify(fileContentsJson, null, 2)
}
}
]
})
}