-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathupdatefile.js
55 lines (45 loc) · 1.21 KB
/
updatefile.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
'use strict';
var path = require('path');
var isValid = require('is-valid-app');
var del = require('delete');
module.exports = function(app) {
if (!isValid(app, 'updater-contributing')) return;
var files = ['contributing{,.md}', 'PULL_REQUEST_TEMPLATE{,.md}', 'ISSUE_TEMPLATE{,.md}'];
/**
* Runs the [copy](#copy) and [del](#del) tasks.
*
* ```sh
* $ gen contributing
* ```
* @name contributing
* @api public
*/
app.task('default', ['copy', 'del']);
/**
* Copy `contributing`, `issue_template` and `pull_request_template`
* files to the `.github` directory. Files can also have a `.md` extension.
*
* ```sh
* $ gen contributing:copy
* ```
* @name contributing:copy
* @api public
*/
app.task('copy', function() {
return app.src(files, {cwd: app.cwd})
.pipe(app.dest(path.join(app.cwd, '.github')));
});
/**
* Deletes `contributing`, `issue_template` and `pull_request_template`
* files from the current working directory. Files can also have a `.md` extension.
*
* ```sh
* $ gen contributing:del
* ```
* @name contributing:del
* @api public
*/
app.task('del', function(cb) {
del(files, {cwd: app.cwd}, cb);
});
};