-
Notifications
You must be signed in to change notification settings - Fork 0
/
plopfile.mjs
31 lines (31 loc) · 1015 Bytes
/
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
export default function (/** @type {import('plop').NodePlopAPI} */plop) {
plop.setGenerator('userscript', {
description: '用户脚本模板生成器',
prompts: [{
type: 'input',
name: 'name',
message: 'Name: ',
}],
actions: ({ name }) => {
return [
{
type: 'addMany',
destination: 'packages/{{name}}',
templateFiles: 'templates/*',
data: { name },
},
{
type: 'add',
path: 'packages/{{name}}/dist/{{name}}.user.js',
template: '',
},
{
type: 'modify',
path: 'README.md',
pattern: '<!-- add new userscript row here -->',
template: '| \[<img src="" height="16px" \/>\](.) | \[{{pascalCase name}}\](packages\/{{name}}) | - | **\[安装\](https:\/\/fastly.jsdelivr.net\/gh\/asadahimeka\/userscripts@master\/packages\/{{name}}\/dist\/{{name}}.user.js)** |\n<!-- add new userscript row here -->',
},
]
},
})
}