-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
verbfile.js
35 lines (29 loc) · 899 Bytes
/
verbfile.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
'use strict';
var through = require('through2');
var green = require('ansi-green');
module.exports = function(app, base) {
app.extendWith('verb-readme-generator');
app.plugin('toFlag', function(options) {
return through.obj(function(file, enc, next) {
var str = file.contents.toString();
str = str.replace(/^(#+ \[)\./gm, '$1--');
console.log(green(' ✔'), 'plugin toFlag: converted titles to flags');
file.contents = new Buffer(str);
next(null, file);
});
});
app.task('default', ['readme']);
};
/**
* Function to be called before the generator is invoked.
* Experimental! not implemented yet!
*/
module.exports.setup = function(Base, base, ctx) {
Base.on('runner', function(event, ctx) {
console.log(event, ctx);
});
base.on('generator', function(name) {
console.log(name);
});
base.files('foo', {content: 'whatever'});
};