UNPKG

2.16 kBJavaScriptView Raw
1var gulp = require('gulp');
2var bump = require('gulp-bump');
3var path = require('path');
4var ignore = require('gulp-ignore');
5var runSequence = require('run-sequence');
6var del = require('del');
7var fs = require('fs'),
8 publish = require('gulp-publish'),
9 typescript = require('gulp-typescript'),
10 tslint = require('gulp-tslint'),
11
12 Config = require('./gulpfile.config');
13 // tsProject = tsc.createProject('./tsconfig.json');
14
15
16var config = new Config();
17
18
19
20
21gulp.task('npm', function (done) {
22 var run = require('gulp-run');
23 return run('npm publish').exec().pipe(gulp.dest('output'));
24});
25
26
27
28gulp.task('bump', function () {
29 gulp.src('./package.json')
30 .pipe(bump())
31 .pipe(gulp.dest('./'));
32});
33
34
35
36
37
38
39/**
40 * Lint all custom TypeScript files.
41 */
42gulp.task('ts-lint', function () {
43 return gulp.src(config.allTypeScript).pipe(tslint({
44 formatter: "prose"
45 }))
46 .pipe(tslint.report({
47 emitError: false
48 }));
49
50});
51
52/**
53 * Compile TypeScript and include references to library and app .d.ts files.
54 */
55gulp.task('compile', function () {
56 var tsProject = typescript.createProject('tsconfig.json');
57 var tsResult = tsProject.src().pipe(typescript(tsResult));
58 return tsResult.js.pipe(gulp.dest('./'));
59});
60
61/**
62 * Remove all generated JavaScript files from TypeScript compilation.
63 */
64gulp.task('clean-ts', function (cb) {
65 var typeScriptGenFiles = [
66 config.tsOutputPath + '/**/*.js', // path to all JS files auto gen'd by editor
67 config.tsOutputPath + '/**/*.js.map', // path to all sourcemap files auto gen'd by editor
68 '!' + config.tsOutputPath + '/lib'
69 ];
70
71 // delete the files
72 del(typeScriptGenFiles, cb);
73});
74
75
76
77
78gulp.task('publish', function () {
79 runSequence('ts-lint', 'compile','bump', 'npm');
80});
81
82
83// var install = require("gulp-install");
84// gulp.task('npm-install', function () {
85// gulp.src(['./release/package.json'])
86// .pipe(install({ production: true, noOptional: true }));
87// });
88
89gulp.task('default', ['compile']);