-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgulpfile.js
93 lines (82 loc) · 2.22 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
var gulp = require('gulp');
var ts = require('gulp-typescript');
var tslint = require('gulp-tslint');
var sourcemaps = require('gulp-sourcemaps');
var tsProject = ts.createProject('lib/tsconfig.json');
var tslintConfig = require('./tslint.json');
var paths = {
lib: 'lib',
ref: 'definitions'
};
gulp.task('compile', function() {
var tsResult =
gulp.src([paths.lib + '/**.ts', paths.ref + '/**.ts'])
.pipe(tsProject());
return tsResult.js.pipe(gulp.dest('release'));
});
gulp.task('test-1', ['compile'], function() {
var lib = require('./release/index');
return gulp.src(['examples/simple/**.js', 'examples/simple/**.json'])
.pipe(sourcemaps.init())
.pipe(lib.gulp('a.js', {
outputFileName: {
commonjs: 'output.common.js',
amd: 'output.amd.js',
standalone: 'output.standalone.js',
universal: 'output.universal.js'
},
globalModules: {
'document': {
universal: 'document'
}
},
exportPackage: {
universal: 'example'
},
externalResolve: [
'./node_modules'
],
includeNode: true
}))
.pipe(sourcemaps.write('.'))
.pipe(gulp.dest('examples/simple'));
});
gulp.task('test-2', ['compile'], function() {
var lib = require('./release/index');
return gulp.src(['examples/big/**.js'])
.pipe(sourcemaps.init())
.pipe(lib.gulp('turpis.js', {
outputFileName: {
commonjs: 'output.common.js',
amd: 'output.amd.js',
standalone: 'output.standalone.js',
universal: 'output.universal.js'
}
}))
.pipe(sourcemaps.write('.'))
.pipe(gulp.dest('examples/big'));
});
gulp.task('test-3', ['compile'], function() {
var lib = require('./release/index');
return gulp.src(['examples/circular/**.js'])
.pipe(sourcemaps.init())
.pipe(lib.gulp('a.js', {
outputFileName: {
standalone: 'output.standalone.js'
}
}))
.pipe(sourcemaps.write('.'))
.pipe(gulp.dest('examples/circular'));
});
gulp.task('test', ['test-1', 'test-2', 'test-3']);
gulp.task('lint', function() {
return gulp.src([paths.lib + '/**.ts'])
.pipe(tslint({
configuration: tslintConfig
}))
.pipe(tslint.report('prose'));
});
gulp.task('watch', ['compile'], function() {
gulp.watch([paths.lib + '/**.ts', paths.ref + '/**.ts'], ['compile']);
});
gulp.task('default', ['compile']);