-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathGulpfile.js
104 lines (98 loc) · 2.67 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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
var gulp = require('gulp');
var del = require('del');
var eslint = require('gulp-eslint');
var concat = require('gulp-concat');
var rename = require('gulp-rename');
var uglify = require('gulp-uglify');
var nodeunit = require('gulp-nodeunit');
gulp.task('default', ['uglify'], function () {
return gulp.src('src/Main.js').pipe(gulp.dest('bin'));
});
gulp.task('uglify', ['concat'], function () {
return gulp.src('bin/lambda.js')
.pipe(uglify({}))
.pipe(rename('lambda.min.js'))
.pipe(gulp.dest('bin'));
});
gulp.task('concat', ['lint'], function () {
return gulp.src([
'src/Prologue.js',
'src/Utilities.js',
'src/Errors.js',
'src/Context.js',
'src/Characters.js',
'src/Values.js',
'src/Types.js',
'src/AST.js',
'src/Scalars.js',
'src/Strings.js',
'src/Lists.js',
'src/Operators.js',
'src/DefaultContext.js',
'src/NodeJSContext.js',
'src/Lexer.js',
'src/Parser.js',
'src/Epilogue.js',
]).pipe(concat('lambda.js')).pipe(gulp.dest('bin'));
});
gulp.task('lint', function () {
return gulp.src(['src/*.js', '!src/Prologue.js', '!src/Epilogue.js']).pipe(eslint({
rules: {
'no-dupe-args': 2,
'no-dupe-keys': 2,
'no-duplicate-case': 2,
'no-extra-boolean-cast': 1,
'no-extra-semi': 2,
'no-func-assign': 1,
'no-irregular-whitespace': 2,
'no-negated-in-lhs': 1,
'no-unexpected-multiline': 2,
'no-unreachable': 2,
'no-unsafe-finally': 2,
'use-isnan': 2,
'valid-jsdoc': 2,
'valid-typeof': 2,
'block-scoped-var': 2,
'consistent-return': 1,
'curly': 2,
'dot-location': [1, 'property'],
'dot-notation': 1,
'guard-for-in': 1,
'no-caller': 2,
'no-case-declarations': 1,
'no-empty-pattern': 1,
'no-fallthrough': 1,
'no-iterator': 2,
'no-labels': 2,
'no-lone-blocks': 1,
'no-loop-func': 1,
'no-multi-spaces': 2,
'no-native-reassign': 2,
'no-proto': 2,
'no-redeclare': 1,
'no-self-assign': 2,
'no-self-compare': 2,
'no-sequences': 1,
'no-throw-literal': 1,
'no-unmodified-loop-condition': 1,
'no-unused-expressions': 2,
'radix': 2,
'wrap-iife': 1,
'yoda': [1, 'always', {
onlyEquality: true,
}],
'init-declarations': 2,
'no-catch-shadow': 1,
'no-delete-var': 1,
'no-undef-init': 2,
'no-unused-vars': 1,
'no-use-before-define': 2,
},
})).pipe(eslint.format()).pipe(eslint.failAfterError());
});
gulp.task('clean', function () {
return del('bin');
});
gulp.task('test', ['default'], function () {
return gulp.src('test/*.js').pipe(nodeunit());
});