Skip to content

Commit 6de125e

Browse files
committed
Convert gulp file to use runSequence and match gulp 4 practices (This fixes race condition where minify task may run before compile task finishes).
1 parent 0cfef83 commit 6de125e

File tree

5 files changed

+46
-11
lines changed

5 files changed

+46
-11
lines changed

dist/powerbi.d.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -117,4 +117,5 @@ export class Tile extends Embed {
117117
static attribute: string;
118118
constructor(element: HTMLElement, options: IEmbedOptions);
119119
getEmbedUrl(): string;
120-
}
120+
}
121+

dist/powerbi.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/powerbi.min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

gulpfile.js

+41-8
Original file line numberDiff line numberDiff line change
@@ -11,20 +11,53 @@ var rename = require('gulp-rename'),
1111
karma = require('karma'),
1212
paths = require('./paths'),
1313
webpack = require('webpack-stream'),
14-
webpackConfig = require('./webpack.config')
14+
webpackConfig = require('./webpack.config'),
15+
runSequence = require('run-sequence')
1516
;
1617

1718
gulp.task('watch', 'Watches for changes', ['lint'], function () {
1819
gulp.watch(paths.jsSource, ['lint:ts']);
1920
gulp.watch(paths.specSource, ['lint:spec', 'test']);
2021
});
2122

22-
gulp.task('lint', 'Lints all files', ['lint:ts', 'lint:spec']);
23-
gulp.task('test', 'Runs all tests', ['test:js', 'copy']);
24-
gulp.task('build', 'Runs a full build', ['build:release']);
23+
gulp.task('lint', 'Lints all files', function (done) {
24+
runSequence(
25+
['lint:ts', 'lint:spec'],
26+
done
27+
);
28+
});
29+
gulp.task('test', 'Runs all tests', function (done) {
30+
runSequence(
31+
'clean',
32+
'compile:ts',
33+
['test:js', 'copy', 'min:js'],
34+
done
35+
);
36+
});
37+
gulp.task('build', 'Runs a full build', function (done) {
38+
runSequence(
39+
'build:release',
40+
done
41+
);
42+
});
2543

26-
gulp.task('build:debug', 'Runs a debug build', ['lint', 'compile:ts', 'copy']);
27-
gulp.task('build:release', 'Runs a release build', ['lint', 'compile:ts', 'copy', 'min:js']);
44+
gulp.task('build:debug', 'Runs a debug build', function (done) {
45+
runSequence(
46+
'lint',
47+
'clean',
48+
['compile:ts', 'copy'],
49+
done
50+
);
51+
});
52+
gulp.task('build:release', 'Runs a release build', function (done) {
53+
runSequence(
54+
'lint',
55+
'clean',
56+
['compile:ts', 'copy'],
57+
'min:js',
58+
done
59+
)
60+
});
2861

2962
gulp.task('clean', 'Cleans destination folder', function(done) {
3063
rimraf(paths.jsDest, done);
@@ -58,14 +91,14 @@ gulp.task('min:js', 'Creates minified JavaScript file', function() {
5891
.pipe(gulp.dest(paths.jsDest));
5992
});
6093

61-
gulp.task('test:js', 'Runs unit tests', ['compile:ts'], function(done) {
94+
gulp.task('test:js', 'Runs unit tests', function(done) {
6295
new karma.Server({
6396
configFile: __dirname + '/karma.conf.js',
6497
singleRun: process.env.DEBUG ? false : true
6598
}, done).start();
6699
});
67100

68-
gulp.task('compile:ts', 'Compile typescript for powerbi library', ['clean'], function() {
101+
gulp.task('compile:ts', 'Compile typescript for powerbi library', function() {
69102
var webpackBundle = gulp.src(['./src/powerbi.ts'])
70103
.pipe(webpack(webpackConfig))
71104
.pipe(gulp.dest('dist/'));

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
"merge2": "^1.0.1",
4040
"phantomjs-prebuilt": "^2.1.3",
4141
"rimraf": "^2.5.1",
42+
"run-sequence": "^1.1.5",
4243
"ts-loader": "^0.8.1",
4344
"tslint": "^3.6.0",
4445
"webpack": "^1.12.14",

0 commit comments

Comments
 (0)