Skip to content

Commit 86399cb

Browse files
author
Matt Mazzola
committed
Consolidate generate of banner to single location for better maintenance
1 parent 046a2fa commit 86399cb

File tree

2 files changed

+12
-11
lines changed

2 files changed

+12
-11
lines changed

gulpfile.js

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,17 @@ var header = require('gulp-header'),
1212
rimraf = require('rimraf'),
1313
merge = require('merge2'),
1414
karma = require('karma'),
15-
webpack = require('webpack-stream'),
15+
webpack = require('webpack');
16+
webpackStream = require('webpack-stream'),
1617
webpackConfig = require('./webpack.config'),
1718
webpackTestConfig = require('./webpack.test.config'),
1819
runSequence = require('run-sequence'),
1920
argv = require('yargs').argv;
2021
;
2122

2223
var package = require('./package.json');
23-
var banner = "/*! <%= package.name %> v<%= package.version %> | (c) 2016 Microsoft Corporation <%= package.license %> */\n";
24+
var webpackBanner = package.name + " v" + package.version + " | (c) 2016 Microsoft Corporation " + package.license;
25+
var gulpBanner = "/*! " + webpackBanner + " */\n";
2426

2527
gulp.task('watch', 'Watches for changes', ['lint'], function () {
2628
gulp.watch(['./src/**/*.ts', './test/**/*.ts'], ['lint:ts']);
@@ -55,7 +57,7 @@ gulp.task('build', 'Runs a full build', function (done) {
5557

5658
gulp.task('header', 'Add header to distributed files', function () {
5759
return gulp.src(['./dist/*.d.ts'])
58-
.pipe(header(banner, { package : package }))
60+
.pipe(header(gulpBanner))
5961
.pipe(gulp.dest('./dist'));
6062
});
6163

@@ -81,8 +83,12 @@ gulp.task('min:js', 'Creates minified JavaScript file', function() {
8183
});
8284

8385
gulp.task('compile:ts', 'Compile typescript for powerbi library', function() {
86+
webpackConfig.plugins = [
87+
new webpack.BannerPlugin(webpackBanner)
88+
];
89+
8490
return gulp.src(['./src/powerbi.ts'])
85-
.pipe(webpack(webpackConfig))
91+
.pipe(webpackStream(webpackConfig))
8692
.pipe(gulp.dest('dist/'));
8793
});
8894

@@ -103,7 +109,7 @@ gulp.task('compile:dts', 'Generate dts files from modules', function () {
103109

104110
gulp.task('compile:spec', 'Compile spec tests', function () {
105111
return gulp.src(['./test/test.spec.ts'])
106-
.pipe(webpack(webpackTestConfig))
112+
.pipe(webpackStream(webpackTestConfig))
107113
.pipe(gulp.dest('./tmp'));
108114
});
109115

webpack.config.js

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
var webpack = require('webpack');
21
var package = require('./package.json');
3-
var banner = package.name + " v" + package.version + " | (c) 2016 Microsoft Corporation " + package.license;
42

53
module.exports = {
64
entry: {
@@ -23,8 +21,5 @@ module.exports = {
2321
{ test: /\.ts$/, exclude: /\.d.ts$/, loader: 'ts-loader' },
2422
{ test: /\.json$/, loader: 'json-loader' }
2523
]
26-
},
27-
plugins: [
28-
new webpack.BannerPlugin(banner)
29-
]
24+
}
3025
}

0 commit comments

Comments
 (0)