-
Notifications
You must be signed in to change notification settings - Fork 23
/
Copy pathgulpfile.js
66 lines (62 loc) · 1.71 KB
/
gulpfile.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
'use strict';
var gulp = require('gulp');
var todo = require('./index');
var wrap = require('gulp-wrap');
var header = require('gulp-header');
gulp.task('xml', function() {
gulp.src('./**/*.js', {
base: './',
})
.pipe(
todo({
fileName: 'todo.xml',
reporter: 'custom',
transformComment: function(file, line, text, kind) {
return [
'<comment file="' + file.replace(/"/g, '"') + '" line="' + line + '" pattern="' + kind + '">',
text,
'</comment>',
];
},
transformHeader: function() {
return '';
},
})
)
.pipe(wrap('<comments xmlns="http://todos.sourceforge.net" version="0.1.0"> <%= contents %></comments>'))
.pipe(header('<?xml version="1.0" encoding="UTF-8"?>'))
.pipe(gulp.dest('./'));
});
gulp.task('json', function() {
gulp.src('./**/*.js', {
base: './',
})
.pipe(
todo({
fileName: 'todo.json',
reporter: 'json',
absolute: true,
})
)
.pipe(gulp.dest('./'));
});
gulp.task('multiple', function() {
gulp.src('./**/*.js', {
base: './',
})
.pipe(todo())
.pipe(gulp.dest('./'))
.pipe(
todo.reporter('xml', {
fileName: 'todo.xml',
})
)
.pipe(gulp.dest('./'));
});
gulp.task('default', function() {
gulp.src(['./index.js', './lib/**.*.js'], {
base: './',
})
.pipe(todo())
.pipe(gulp.dest('./'));
});