Skip to content

Commit

Permalink
Merge pull request #375 from microsoft/version_2.18.0
Browse files Browse the repository at this point in the history
Version 2.18.0
  • Loading branch information
ali-hamud authored Mar 22, 2021
2 parents df40b4e + a238e96 commit f56df24
Show file tree
Hide file tree
Showing 28 changed files with 716 additions and 176 deletions.
4 changes: 3 additions & 1 deletion dist/powerbi-client.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
/*! powerbi-client v2.17.2 | (c) 2016 Microsoft Corporation MIT */
// powerbi-client v2.18.0
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
declare module "util" {
import { HttpPostMessage } from 'http-post-message';
/**
Expand Down
550 changes: 504 additions & 46 deletions dist/powerbi.js

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions dist/powerbi.min.js

Large diffs are not rendered by default.

250 changes: 129 additions & 121 deletions gulpfile.js
Original file line number Diff line number Diff line change
@@ -1,40 +1,41 @@
var gulp = require('gulp');
var ghPages = require('gulp-gh-pages'),
header = require('gulp-header'),
help = require('gulp-help-four'),
rename = require('gulp-rename'),
replace = require('gulp-replace'),
eslint = require("gulp-eslint"),
ts = require('gulp-typescript'),
flatten = require('gulp-flatten'),
fs = require('fs'),
del = require('del'),
moment = require('moment'),
karma = require('karma'),
typedoc = require('gulp-typedoc'),
watch = require('gulp-watch'),
webpack = require('webpack'),
webpackStream = require('webpack-stream'),
webpackConfig = require('./webpack.config'),
webpackTestConfig = require('./webpack.test.config'),
runSequence = require('gulp4-run-sequence'),
argv = require('yargs').argv;
;
const fs = require('fs');
const gulp = require('gulp');
const ghPages = require('gulp-gh-pages');
const header = require('gulp-header');
const help = require('gulp-help-four');
const rename = require('gulp-rename');
const replace = require('gulp-replace');
const eslint = require("gulp-eslint");
const ts = require('gulp-typescript');
const flatten = require('gulp-flatten');
const del = require('del');
const moment = require('moment');
const karma = require('karma');
const typedoc = require('gulp-typedoc');
const watch = require('gulp-watch');
const webpack = require('webpack');
const webpackStream = require('webpack-stream');
const runSequence = require('gulp4-run-sequence');
const webpackConfig = require('./webpack.config');
const webpackTestConfig = require('./webpack.test.config');
const argv = require('yargs').argv;

help(gulp, undefined);

var package = require('./package.json');
var webpackBanner = package.name + " v" + package.version + " | (c) 2016 Microsoft Corporation " + package.license;
var gulpBanner = "/*! " + webpackBanner + " */\n";
const package = require('./package.json');
const webpackBanner = "// " + package.name + " v" + package.version + "\n"
+ "// Copyright (c) Microsoft Corporation.\n"
+ "// Licensed under the MIT License.";
const banner = webpackBanner + "\n";

gulp.task('ghpages', 'Deploy documentation to gh-pages', ['nojekyll'], function () {
return gulp.src(['./docs/**/*'], {
dot: true
})
.pipe(ghPages({
force: true,
message: 'Update ' + moment().format('LLL')
}));
return gulp.src(['./docs/**/*'], {
dot: true
})
.pipe(ghPages({
force: true,
message: 'Update ' + moment().format('LLL')
}));
});

gulp.task("docs", 'Compile documentation from src code', function () {
Expand Down Expand Up @@ -64,105 +65,109 @@ gulp.task('copydemotodocs', 'Copy the demo to the docs', function () {
});

gulp.task('nojekyll', 'Add .nojekyll file to docs directory', function (done) {
fs.writeFile('./docs/.nojekyll', '', function (error) {
if (error) {
throw error;
}
fs.writeFile('./docs/.nojekyll', '', function (error) {
if (error) {
throw error;
}

done();
});
done();
});
});

gulp.task('watch', 'Watches for changes', ['lint'], function () {
gulp.watch(['./src/**/*.ts', './test/**/*.ts'], ['lint:ts']);
gulp.watch(['./test/**/*.ts'], ['test']);
gulp.watch(['./src/**/*.ts', './test/**/*.ts'], ['lint:ts']);
gulp.watch(['./test/**/*.ts'], ['test']);
});

gulp.task('lint', 'Lints all files', function (done) {
runSequence(
'lint:ts',
done
);
runSequence(
'lint:ts',
done
);
});

gulp.task('test', 'Runs all tests', function (done) {
runSequence(
'lint:ts',
'config',
'compile:spec',
'test:js',
done
);
runSequence(
'lint:ts',
'config',
'compile:spec',
'test:js',
done
);
});

gulp.task('build', 'Runs a full build', function (done) {
runSequence(
'lint:ts',
'clean',
'config',
['compile:ts', 'compile:dts'],
'min:js',
'header',
done
);
runSequence(
'lint:ts',
'clean',
'config',
['compile:ts', 'compile:dts'],
'min:js',
'header',
done
);
});

gulp.task('build:docs', 'Build docs folder', function (done) {
return runSequence(
'clean:docs',
'docs',
'nojekyll',
'copydemotodocs',
done
);
return runSequence(
'clean:docs',
'docs',
'nojekyll',
'copydemotodocs',
done
);
});

gulp.task('config', 'Update config version with package version', function () {
return gulp.src(['./src/config.ts'], { base: "./" })
.pipe(replace(/version: '([^']+)'/, `version: '${package.version}'`))
.pipe(gulp.dest('.'));
return gulp.src(['./src/config.ts'], { base: "./" })
.pipe(replace(/version: '([^']+)'/, `version: '${package.version}'`))
.pipe(gulp.dest('.'));
});

gulp.task('header', 'Add header to distributed files', function () {
return gulp.src(['./dist/*.d.ts'])
.pipe(header(gulpBanner))
.pipe(gulp.dest('./dist'));
return gulp.src(['./dist/*.d.ts'])
.pipe(header(banner))
.pipe(gulp.dest('./dist'));
});

gulp.task('clean', 'Cleans destination folder', function (done) {
return del([
'./dist/**/*'
]);
return del([
'./dist/**/*'
]);
});

gulp.task('clean:docs', 'Clean docs directory', function () {
return del([
'docs/**/*',
'docs'
]);
return del([
'docs/**/*',
'docs'
]);
});

gulp.task('lint:ts', 'Lints all TypeScript', function () {
return gulp.src(['./src/**/*.ts', './test/**/*.ts'])
.pipe(eslint({
formatter: "verbose"
}))
.pipe(eslint.format());
return gulp.src(['./src/**/*.ts', './test/**/*.ts'])
.pipe(eslint({
formatter: "verbose"
}))
.pipe(eslint.format());
});

gulp.task('min:js', 'Creates minified JavaScript file', function () {
webpackConfig.plugins = [
new webpack.BannerPlugin(webpackBanner)
new webpack.BannerPlugin({
banner: webpackBanner,
raw: true
})
];

// Create minified bundle without source map
webpackConfig.mode = 'production';
webpackConfig.devtool = 'none'
webpackConfig.devtool = 'none';

return gulp.src(['./src/powerbi-client.ts'])
.pipe(webpackStream({
config: webpackConfig
}))
.pipe(header(banner))
.pipe(rename({
suffix: '.min'
}))
Expand All @@ -171,64 +176,67 @@ gulp.task('min:js', 'Creates minified JavaScript file', function () {

gulp.task('compile:ts', 'Compile typescript for powerbi-client library', function () {
webpackConfig.plugins = [
new webpack.BannerPlugin(webpackBanner)
new webpack.BannerPlugin({
banner: webpackBanner,
raw: true
})
];
webpackConfig.mode = "development";

return gulp.src(['./src/powerbi-client.ts'])
.pipe(webpackStream(webpackConfig))
.pipe(gulp.dest('dist/'));
return gulp.src(['./src/powerbi-client.ts'])
.pipe(webpackStream(webpackConfig))
.pipe(gulp.dest('dist/'));
});

gulp.task('compile:dts', 'Generate one dts file from modules', function () {
var tsProject = ts.createProject('tsconfig.json', {
declaration: true,
sourceMap: false
});
const tsProject = ts.createProject('tsconfig.json', {
declaration: true,
sourceMap: false
});

var settings = {
const settings = {
out: "powerbi-client.js",
declaration: true,
module: "system",
moduleResolution: "node"
};

var tsResult = tsProject.src()
.pipe(ts(settings));
const tsResult = tsProject.src()
.pipe(ts(settings));

return tsResult.dts
.pipe(flatten())
.pipe(gulp.dest('./dist'));
return tsResult.dts
.pipe(flatten())
.pipe(gulp.dest('./dist'));
});

gulp.task('compile:spec', 'Compile spec tests', function () {
return gulp.src(['./test/test.spec.ts'])
.pipe(webpackStream(webpackTestConfig))
.pipe(gulp.dest('./tmp'));
return gulp.src(['./test/test.spec.ts'])
.pipe(webpackStream(webpackTestConfig))
.pipe(gulp.dest('./tmp'));
});

gulp.task('test:js', 'Run js tests', function (done) {
new karma.Server({
configFile: __dirname + '/karma.conf.js',
singleRun: argv.watch ? false : true,
captureTimeout: argv.timeout || 60000
}, function() {
done();
new karma.Server({
configFile: __dirname + '/karma.conf.js',
singleRun: argv.watch ? false : true,
captureTimeout: argv.timeout || 60000
}, function () {
done();
})
.on('browser_register', (browser) => {
if (argv.chrome) {
.on('browser_register', (browser) => {
if (argv.chrome) {
browser.socket.on('disconnect', function (reason) {
if (reason === "transport close" || reason === "transport error") {
done(0);
process.exit(0);
done(0);
process.exit(0);
}
});
}
})
.start();
});
}
})
.start();
if (argv.chrome) {
return watch(["src/**/*.ts", "test/**/*.ts"], function () {
runSequence('compile:spec');
runSequence('compile:spec');
});
}
});
});
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "powerbi-client",
"version": "2.17.2",
"version": "2.18.0",
"description": "JavaScript library for embedding Power BI into your apps. Provides service which makes it easy to embed different types of components and an object model which allows easy interaction with these components such as changing pages, applying filters, and responding to data selection.",
"main": "dist/powerbi.js",
"types": "dist/powerbi-client.d.ts",
Expand Down Expand Up @@ -81,7 +81,7 @@
},
"dependencies": {
"http-post-message": "^0.2",
"powerbi-models": "^1.8",
"powerbi-models": "^1.9",
"powerbi-router": "^0.1",
"window-post-message-proxy": "^0.2"
},
Expand Down
3 changes: 3 additions & 0 deletions src/bookmarksManager.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

import {
BookmarksPlayMode,
IApplyBookmarkByNameRequest,
Expand Down
5 changes: 4 additions & 1 deletion src/config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

/** @ignore *//** */
const config = {
version: '2.17.2',
version: '2.18.0',
type: 'js'
};

Expand Down
3 changes: 3 additions & 0 deletions src/create.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

import { IReportCreateConfiguration, IError, validateCreateReport } from 'powerbi-models';
import { Service } from './service';
import { Embed, IEmbedConfigurationBase, IEmbedConfiguration } from './embed';
Expand Down
3 changes: 3 additions & 0 deletions src/dashboard.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

import { IError, validateDashboardLoad, PageView } from 'powerbi-models';
import { Service, IService } from './service';
import { Embed, IDashboardEmbedConfiguration, IEmbedConfigurationBase } from './embed';
Expand Down
Loading

0 comments on commit f56df24

Please sign in to comment.