forked from DAVFoundation/dav-js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
104 lines (94 loc) · 2.34 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
const gulp = require('gulp');
const eslint = require('gulp-eslint');
const jest = require('gulp-jest').default;
const exec = require('child_process').exec;
const ts = require('gulp-typescript');
const tslint = require('gulp-tslint');
const typedoc = require('gulp-typedoc');
const sourcemaps = require('gulp-sourcemaps');
const spellcheck = require('gulp-ts-spellcheck').default;
const merge = require('gulp-merge');
gulp.task('deploy-contracts', callback => {
exec('truffle deploy', function(err, stdout, stderr) {
console.log(stdout);
console.log(stderr);
callback(err);
});
});
gulp.task('lint', () => {
return gulp
.src(['**/*.js', '!node_modules/**'])
.pipe(eslint())
.pipe(eslint.format())
.pipe(eslint.failAfterError());
});
gulp.task('jest', done => {
return gulp
.src('')
.on('error', function(err) {
done(err);
})
.pipe(jest({}));
});
gulp.task('tslint', done => {
return gulp
.src(['src/**/*.ts', 'samples/**/*.ts'])
.on('error', function(err) {
done(err);
})
.pipe(
tslint({
formatter: 'prose',
}),
)
.pipe(tslint.report());
});
gulp.task('tsc', function(done) {
var tsProject = ts.createProject('tsconfig.json');
const tsResults = tsProject
.src()
.pipe(sourcemaps.init())
.pipe(tsProject())
.on('error', function(err) {
done(err);
});
return merge([
tsResults.dts.pipe(gulp.dest('./build/')),
tsResults.js.pipe(sourcemaps.write('')).pipe(gulp.dest('./build')),
]);
});
gulp.task('create-dist', ['tsc'], function() {
gulp.src('./src/contracts/*').pipe(gulp.dest('./dist/contracts/'));
gulp.src('./build/src/**/*').pipe(gulp.dest('./dist/'));
});
gulp.task('typedoc', function(done) {
return gulp
.src(['src/**/*.ts'])
.on('error', function(err) {
done(err);
})
.pipe(typedoc(require('./typedoc.js')));
});
gulp.task('spellcheck', function(done) {
return gulp
.src(['src/**/*.ts', 'samples/**/*.ts'])
.on('error', function(err) {
done(err);
})
.pipe(
spellcheck({
dictionary: require('./speller-dictionary.js'),
}),
)
.pipe(spellcheck.report({}));
});
gulp.task('compile', ['tslint', 'tsc']);
gulp.task('test', ['tslint', 'jest']);
gulp.task('pre-publish', [
'tslint',
'jest',
'tsc',
'typedoc',
'spellcheck',
'create-dist',
]);