-
Notifications
You must be signed in to change notification settings - Fork 0
/
plopfile.js
48 lines (48 loc) · 1.31 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
// eslint-disable-next-line func-names
module.exports = function (plop) {
plop.setGenerator('package', {
description: 'Create a package',
prompts: [
{
type: 'input',
name: 'name',
message: 'What is the package name ?',
default: 'new-package',
validate: (name) => {
if (/\s/g.test(name)) {
return 'Package name cannot contain spaces';
}
return true;
},
transformer: (name) => name.toLowerCase(),
},
{
type: 'input',
name: 'description',
message: 'What is the package description ?',
default: '@composite-fetcher package',
},
{
type: 'input',
name: 'maintainer',
message: 'Who is the package maintainer ?',
default: 'Teofanis Papadopulos',
},
],
actions: [
{
type: 'addMany',
base: 'stubs/package/',
description: 'Create package files',
destination: 'packages/{{name}}',
templateFiles: 'stubs/package',
},
function installDependencies() {
const { spawn } = require('child_process');
const pnpmInstall = spawn('pnpm', ['install']);
pnpmInstall.stdout.pipe(process.stdout);
pnpmInstall.stderr.pipe(process.stderr);
},
],
});
};