-
Notifications
You must be signed in to change notification settings - Fork 159
/
index.js
51 lines (45 loc) · 1.06 KB
/
index.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
'use strict';
const _ = require('lodash');
const extend = _.merge;
const Generator = require('yeoman-generator');
module.exports = class extends Generator {
constructor(args, options) {
super(args, options);
this.option('generateInto', {
type: String,
required: false,
defaults: '',
desc: 'Relocate the location of the generated files.'
});
}
writing() {
const pkg = this.fs.readJSON(
this.destinationPath(this.options.generateInto, 'package.json'),
{}
);
extend(pkg, {
bin: 'lib/cli.js',
dependencies: {
meow: '^3.7.0'
},
devDependencies: {
lec: '^1.0.1'
},
scripts: {
prepare: 'lec lib/cli.js -c LF'
}
});
this.fs.writeJSON(
this.destinationPath(this.options.generateInto, 'package.json'),
pkg
);
this.fs.copyTpl(
this.templatePath('cli.js'),
this.destinationPath(this.options.generateInto, 'lib/cli.js'),
{
pkgName: pkg.name,
pkgSafeName: _.camelCase(pkg.name)
}
);
}
};