-
-
Notifications
You must be signed in to change notification settings - Fork 6
/
generator.js
62 lines (54 loc) · 1.54 KB
/
generator.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
'use strict';
var path = require('path');
var templates = path.join(__dirname, 'templates');
var isValid = require('is-valid-app');
module.exports = function(app) {
if (!isValid(app, 'generate-eslint')) return;
/**
* Generate a `.eslintrc.json` file to the current working directory. Described in more
* detail in the [usage](#usage) section.
*
* ```sh
* $ gen eslint
* ```
* @name default
* @api public
*/
app.task('default', {silent: true}, ['eslintrc']);
/**
* Alias for the [default](#default) task, to provide a semantic task name for
* when this generator is used as a plugin or sub-generator.
*
* ```sh
* $ gen eslint:eslintrc
* ```
* @name eslintrc
* @api public
*/
app.task('eslintrc', {silent: true}, function() {
return app.src('_eslintrc.json', {cwd: templates})
.pipe(app.dest(function(file) {
file.basename = '.eslintrc.json';
return app.cwd;
}));
});
/**
* Generate a `.eslintignore` file to the current working directory. This task
* is also aliased as `eslintignore` to provide a more semantic task name for
* when this generator is used as a plugin or sub-generator.
*
* ```sh
* $ gen eslint:ignore
* ```
* @name ignore
* @api public
*/
app.task('ignore', {silent: true}, ['eslintignore']);
app.task('eslintignore', {silent: true}, function() {
return app.src('_eslintignore', {cwd: templates})
.pipe(app.dest(function(file) {
file.basename = '.eslintignore';
return app.cwd;
}));
});
};