Skip to content

Commit 83df6ac

Browse files
authored
Updated build generation for v1.1 package (microsoft#20)
* Updated build generation for v1.1 package * Travis build: 30 * Reapplied 'publishConfig' section * Changed to v1.1 * Changed to v1.1 * Travis build: 34
1 parent 69ff5c3 commit 83df6ac

7 files changed

+39
-15
lines changed

PowerBI.JavaScript.nuspec

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<authors>Microsoft</authors>
77
<owners>microsoft,powerbi</owners>
88
<licenseUrl>https://raw.githubusercontent.com/Microsoft/dotnet/master/LICENSE</licenseUrl>
9-
<projectUrl>https://github.com/Microsoft/PowerBI-CSharp</projectUrl>
9+
<projectUrl>https://github.com/Microsoft/PowerBI-JavaScript</projectUrl>
1010
<iconUrl>http://go.microsoft.com/fwlink/?LinkId=780675</iconUrl>
1111
<requireLicenseAcceptance>true</requireLicenseAcceptance>
1212
<summary>JavaScript web components for Power BI</summary>
@@ -17,6 +17,7 @@
1717
<files>
1818
<file src="dist\powerbi.js" target="content\scripts" />
1919
<file src="dist\powerbi.min.js" target="content\scripts" />
20+
<file src="dist\powerbi.js.map" target="content\scripts" />
2021
<file src="dist\powerbi.d.ts" target="content\scripts\typings" />
2122
</files>
2223
</package>

dist/powerbi.d.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/*! powerbi-client v1.1.0 | (c) 2016 Microsoft Corporation MIT */
12
export declare class Utils {
23
static raiseCustomEvent(element: HTMLElement, eventName: string, eventData: any): void;
34
static findIndex<T>(predicate: (T) => boolean, xs: T[]): number;

dist/powerbi.js

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

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

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

gulpfile.js

+28-9
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
var gulp = require('gulp-help')(require('gulp'));
2-
var rename = require('gulp-rename'),
2+
var header = require('gulp-header'),
3+
rename = require('gulp-rename'),
34
concat = require('gulp-concat'),
45
uglify = require('gulp-uglify'),
56
jshint = require('gulp-jshint'),
@@ -11,12 +12,17 @@ var rename = require('gulp-rename'),
1112
merge = require('merge2'),
1213
karma = require('karma'),
1314
paths = require('./paths'),
14-
webpack = require('webpack-stream'),
15+
webpack = require('webpack');
16+
webpackStream = require('webpack-stream'),
1517
webpackConfig = require('./webpack.config'),
1618
runSequence = require('run-sequence'),
1719
argv = require('yargs').argv;
1820
;
1921

22+
var package = require('./package.json');
23+
var webpackBanner = package.name + " v" + package.version + " | (c) 2016 Microsoft Corporation " + package.license;
24+
var gulpBanner = "/*! " + webpackBanner + " */\n";
25+
2026
gulp.task('watch', 'Watches for changes', ['lint'], function () {
2127
gulp.watch(['./src/**/*.ts', './test/**/*.ts'], ['lint:ts']);
2228
gulp.watch(['./test/**/*.ts'], ['test']);
@@ -44,10 +50,17 @@ gulp.task('build', 'Runs a full build', function (done) {
4450
'clean',
4551
['compile:ts', 'compile:dts'],
4652
'min:js',
53+
'header',
4754
done
4855
);
4956
});
5057

58+
gulp.task('header', 'Add header to distributed files', function () {
59+
return gulp.src(['./dist/*.d.ts'])
60+
.pipe(header(gulpBanner))
61+
.pipe(gulp.dest('./dist'));
62+
});
63+
5164
gulp.task('clean', 'Cleans destination folder', function(done) {
5265
rimraf(paths.jsDest, done);
5366
});
@@ -59,12 +72,14 @@ gulp.task('lint:ts', 'Lints all TypeScript', function() {
5972
});
6073

6174
gulp.task('min:js', 'Creates minified JavaScript file', function() {
62-
return gulp.src(paths.jsDest + paths.outFilename)
63-
.pipe(sourcemaps.init({ debug: true }))
64-
.pipe(uglify())
65-
.pipe(sourcemaps.write())
66-
.pipe(rename({ suffix: '.min' }))
67-
.pipe(gulp.dest(paths.jsDest));
75+
return gulp.src(['!./dist/*.min.js', './dist/*.js'])
76+
.pipe(uglify({
77+
preserveComments: 'license'
78+
}))
79+
.pipe(rename({
80+
suffix: '.min'
81+
}))
82+
.pipe(gulp.dest('./dist'));
6883
});
6984

7085
gulp.task('test:js', 'Runs unit tests', function(done) {
@@ -76,8 +91,12 @@ gulp.task('test:js', 'Runs unit tests', function(done) {
7691
});
7792

7893
gulp.task('compile:ts', 'Compile typescript for powerbi library', function() {
94+
webpackConfig.plugins = [
95+
new webpack.BannerPlugin(webpackBanner)
96+
];
97+
7998
return gulp.src(['./src/powerbi.ts'])
80-
.pipe(webpack(webpackConfig))
99+
.pipe(webpackStream(webpackConfig))
81100
.pipe(gulp.dest('dist/'));
82101
});
83102

package.json

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "powerbi-client",
3-
"version": "2.0.0-beta.6",
3+
"version": "1.1.0",
44
"description": "",
55
"main": "dist/powerbi.js",
66
"typings": "dist/powerbi.d.ts",
@@ -27,6 +27,7 @@
2727
"devDependencies": {
2828
"gulp": "^3.9.0",
2929
"gulp-concat": "^2.6.0",
30+
"gulp-header": "^1.8.7",
3031
"gulp-help": "^1.6.1",
3132
"gulp-jshint": "^2.0.0",
3233
"gulp-rename": "^1.2.2",
@@ -60,4 +61,4 @@
6061
"publishConfig": {
6162
"tag": "beta"
6263
}
63-
}
64+
}

0 commit comments

Comments
 (0)