powerbi-visuals-tools 3.4.1 → 4.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -19,10 +19,54 @@
19
19
  {
20
20
  "type": "node",
21
21
  "request": "launch",
22
- "name": "Launch Program t1",
22
+ "name": "pbiviz-start t1",
23
23
  "cwd": "${workspaceFolder}\\testGround\\t1",
24
24
  "program": "${workspaceFolder}\\bin\\pbiviz.js",
25
25
  "args": ["start"]
26
+ },
27
+ {
28
+ "type": "node",
29
+ "request": "launch",
30
+ "name": "pbiviz-start t1 Linux",
31
+ "cwd": "${workspaceFolder}/testGround/t1",
32
+ "program": "${workspaceFolder}/bin/pbiviz.js",
33
+ "args": ["start"]
34
+ },
35
+ {
36
+ "type": "node",
37
+ "request": "launch",
38
+ "name": "pbiviz-package t1",
39
+ "cwd": "${workspaceFolder}\\testGround\\t1",
40
+ "program": "${workspaceFolder}\\bin\\pbiviz.js",
41
+ "args": ["package"]
42
+ },
43
+ {
44
+ "type": "node",
45
+ "request": "launch",
46
+ "name": "pbiviz-new circle",
47
+ "cwd": "${workspaceFolder}\\testGround",
48
+ "program": "${workspaceFolder}\\bin\\pbiviz.js",
49
+ "args": [
50
+ "new",
51
+ "-t",
52
+ "circlecard",
53
+ "circlecard-sample",
54
+ "-f"
55
+ ]
56
+ },
57
+ {
58
+ "type": "node",
59
+ "request": "launch",
60
+ "name": "test pbiviz-start",
61
+ "cwd": "${workspaceRoot}",
62
+ "program": "${workspaceFolder}\\bin\\pbiviz.js",
63
+ "args": [
64
+ "new",
65
+ "-t",
66
+ "circlecard",
67
+ "mynewsample",
68
+ "-f"
69
+ ]
26
70
  }
27
71
  ]
28
72
  }
package/Changelog.md CHANGED
@@ -2,6 +2,27 @@
2
2
 
3
3
  This page contains information about changes to the PowerBI Visual Tools (pbiviz).
4
4
 
5
+ ## 4.0.2
6
+ * Fix custom visual package upload to desktop version of PowerBI
7
+ * Removed environment logging in this version
8
+ * Downgraded "powerbi-visuals-webpack-plugin"
9
+
10
+ ## 4.0.0
11
+ * This release version includes changes from previous betta versions: 3.4.0, 3.4.1, 3.4.2, 3.4.3.
12
+
13
+ ## 3.4.3
14
+
15
+ * Updated webpack assets compilation
16
+ * Added environment logging for debugging purposes
17
+ * Fixed certificate date verification for different regional settings
18
+
19
+ ## 3.4.2
20
+
21
+ * Migrated from `request` lib to node `https` standard method
22
+ * Removed `friendly-errors-webpack-plugin` usage
23
+ * Removed or updated deprecated dependencies
24
+ * Fixed vulnerabilities
25
+
5
26
  ## 3.4.1
6
27
 
7
28
  * Fixed certificate verification for 'non-english' environment
package/config.json CHANGED
@@ -1 +1 @@
1
- {"templates":{"visuals":"templates/visuals","pbiviz":"templates/pbiviz.json.template","plugin":"templates/plugin.ts.template","package":"templates/package.json.template"},"generate":{"apiVersion":"3.8.0"},"constants":{"minAPIversion":"3.2.0"},"build":{"precompileFolder":".tmp/precompile","dropFolder":".tmp/drop","js":"tmp.visual.js","css":"visual.css","stats":"../../webpack.statistics.html"},"package":{"dropFolder":"dist"},"server":{"root":"webRoot","assetsRoute":"/assets","privateKey":"certs/PowerBICustomVisualTest_private.key","certificate":"certs/PowerBICustomVisualTest_public.crt","pfx":"certs/PowerBICustomVisualTest_public.pfx","port":"8080","passphrase":"21345751397540846"},"visualTemplates":{"circlecard":"http://github.com/microsoft/powerbi-visuals-circlecard-react/archive/master.zip"}}
1
+ {"templates":{"visuals":"templates/visuals","pbiviz":"templates/pbiviz.json.template","plugin":"templates/plugin.ts.template","package":"templates/package.json.template"},"generate":{"apiVersion":"3.8.0"},"constants":{"minAPIversion":"3.2.0"},"build":{"precompileFolder":".tmp/precompile","dropFolder":".tmp/drop","js":"tmp.visual.js","css":"visual.css","stats":"../../webpack.statistics.html"},"package":{"dropFolder":"dist"},"server":{"root":"webRoot","assetsRoute":"/assets","privateKey":"certs/PowerBICustomVisualTest_private.key","certificate":"certs/PowerBICustomVisualTest_public.crt","pfx":"certs/PowerBICustomVisualTest_public.pfx","port":"8080","passphrase":"9877149244399557"},"visualTemplates":{"circlecard":"https://codeload.github.com/microsoft/powerbi-visuals-circlecard-react/zip/master"}}
@@ -56,7 +56,7 @@ async function createCertFile(config, open) {
56
56
  const subject = "localhost";
57
57
  const keyLength = 2048;
58
58
  const algorithm = "sha256";
59
- const validPeriod = 180;
59
+ const validPeriod = 365;
60
60
 
61
61
  if (typeof open === 'undefined') {
62
62
  open = false;
@@ -383,17 +383,14 @@ async function veryfyCertFile(keyPath, certPath, pfxPath, passphrase) {
383
383
  let verifyCertDate;
384
384
  try {
385
385
  let endDateStr;
386
-
386
+
387
387
  // For Windows OS:
388
388
  if (os.platform() === "win32") {
389
389
  if (!fs.existsSync(pfxPath) || !passphrase) {
390
390
  return false;
391
391
  }
392
- let certStr = await exec(`certutil -p ${passphrase} -dump "${pfxPath}"`);
393
- let certStrSplitted = certStr.split('\r\n');
394
- let regex = /(?<=: ).*/;
395
- endDateStr = regex.exec(certStrSplitted[6]);
396
-
392
+ let certStr = await exec(`powershell.exe (New-Object System.Security.Cryptography.X509Certificates.X509Certificate2('${pfxPath}','${passphrase}')).NotAfter.ToString('yyyy-MM-dd HH:mm:ss')`);
393
+ endDateStr = certStr.trim();
397
394
  }
398
395
  // For Linux and Mac/darwin OS:
399
396
  else if (os.platform() === "linux" || os.platform() === "darwin") {
@@ -403,8 +400,8 @@ async function veryfyCertFile(keyPath, certPath, pfxPath, passphrase) {
403
400
  endDateStr = await exec(`openssl x509 -enddate -noout -in ${certPath} | cut -d = -f 2`);
404
401
  }
405
402
 
406
- let endDate = new Date(Date.parse(endDateStr));
407
- verifyCertDate = (endDate - new Date()) > certSafePeriod;
403
+ let endDate = Date.parse(endDateStr);
404
+ verifyCertDate = (endDate - Date.now()) > certSafePeriod;
408
405
  if (verifyCertDate) {
409
406
  ConsoleWriter.info(`Certificate is valid.`);
410
407
  } else {
@@ -2,23 +2,23 @@ const fs = require('fs-extra');
2
2
  const path = require('path');
3
3
  const config = require('../config.json');
4
4
  const JSZip = require('jszip');
5
- const request = require('request');
6
5
  const VisualGenerator = require("./VisualGenerator");
7
6
  const { exec } = require('child_process');
8
- let ConsoleWriter = require('../lib/ConsoleWriter');
7
+ const ConsoleWriter = require('../lib/ConsoleWriter');
8
+ const download = require('./utils').download;
9
+ const createFolder = require('./utils').createFolder;
9
10
 
10
11
  class TemplateFetcher {
11
12
  constructor({ templateName, visualName, apiVersion }) {
12
13
  this.templateName = templateName;
13
14
  this.visualName = visualName;
14
- this.folderName = `powerbi-visuals-${this.visualName}`;
15
+ this.folderName = `${this.visualName}`;
15
16
  this.apiVersion = apiVersion;
16
- console.log();
17
17
  }
18
18
 
19
19
  fetch() {
20
- this.createFolder()
21
- .then(this.download.bind(this))
20
+ let folder = createFolder.call(this, this.folderName);
21
+ download.call(this, config.visualTemplates[this.templateName], path.join(folder, "template.zip"))
22
22
  .then(this.extractFiles.bind(this))
23
23
  .then(this.removeZipFile.bind(this))
24
24
  .then(this.setVisualGUID.bind(this))
@@ -27,28 +27,6 @@ class TemplateFetcher {
27
27
  .then(this.showNextSteps.bind(this));
28
28
  }
29
29
 
30
- async createFolder() {
31
- let folder = path.join("./", this.folderName);
32
- await fs.ensureDir(folder);
33
- return folder;
34
- }
35
-
36
- download(folder) {
37
- return new Promise((resolve) => {
38
- const templateUrl = config.visualTemplates[this.templateName];
39
- const fileName = path.join(folder, "template.zip");
40
- const fileStream = fs.createWriteStream(`.${path.sep}${fileName}`);
41
-
42
- request.get(templateUrl, (err) => {
43
- if (err) {
44
- reject(err);
45
- }
46
- })
47
- .pipe(fileStream)
48
- .on("close", () => resolve(fileStream));
49
- });
50
- }
51
-
52
30
  async removeZipFile() {
53
31
  const folder = path.join("./", this.folderName);
54
32
  const fileName = path.join(folder, "template.zip");
@@ -64,7 +42,7 @@ class TemplateFetcher {
64
42
  const buffer = await fs.readFile(filePath);
65
43
  const zip = await JSZip.loadAsync(buffer);
66
44
 
67
- const filesList = Object.keys(zip.files);
45
+ const filesList = Object.keys(zip.files);
68
46
  for (const filename of filesList) {
69
47
  if (filename[filename.length - 1] === "/") {
70
48
  // generate folders for exclude parent folder
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
 
3
3
  const fs = require('fs-extra');
4
+ const os = require('os');
4
5
  const path = require('path');
5
6
  const webpack = require('webpack');
6
7
  const config = require('../config.json');
@@ -9,12 +10,12 @@ const encoding = "utf8";
9
10
  const ConsoleWriter = require('../lib/ConsoleWriter');
10
11
  const ExtraWatchWebpackPlugin = require('extra-watch-webpack-plugin');
11
12
  const Visualizer = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
12
- const FriendlyErrorsWebpackPlugin = require('friendly-errors-webpack-plugin');
13
13
  const util = require('util');
14
14
  const exec = util.promisify(require('child_process').exec);
15
15
  const CertificateTools = require("../lib/CertificateTools");
16
16
  const visualPlugin = "visualPlugin.ts";
17
17
  const lodashCloneDeep = require('lodash.clonedeep');
18
+ const npmPackage = require('../package.json');
18
19
 
19
20
  class WebPackGenerator {
20
21
 
@@ -81,11 +82,14 @@ class WebPackGenerator {
81
82
  directory: path.join(visualPackage.basePath, config.build.dropFolder),
82
83
  publicPath: config.server.assetsRoute
83
84
  },
84
- https: {
85
- key: options.key,
86
- cert: options.cert,
87
- pfx: options.pfx,
88
- passphrase: options.passphrase
85
+ server: {
86
+ type: 'https',
87
+ options: {
88
+ key: options.key,
89
+ cert: options.cert,
90
+ pfx: options.pfx,
91
+ passphrase: options.passphrase
92
+ }
89
93
  }
90
94
  };
91
95
  }
@@ -109,6 +113,16 @@ class WebPackGenerator {
109
113
  }
110
114
  }
111
115
 
116
+ async getEnvironmentDetails() {
117
+ let env = {};
118
+ env.nodeVersion = process.versions.node;
119
+ env.osPlatform = await os.platform();
120
+ env.osVersion = await os.version ? os.version() : "undefined";
121
+ env.osReleaseVersion = await os.release();
122
+ env.toolsVersion = npmPackage.version;
123
+ return env;
124
+ }
125
+
112
126
  async configureCustomVisualsWebpackPlugin(visualPackage, options, tsconfig) {
113
127
  let pluginConfiguration = lodashCloneDeep(visualPackage.config);
114
128
  //(?=\D*$) - positive look-ahead to find last version symbols and exclude any non-digit symbols after the version.
@@ -128,6 +142,8 @@ class WebPackGenerator {
128
142
  await this.installAPIpackage();
129
143
  }
130
144
 
145
+ // pluginConfiguration.env = await this.getEnvironmentDetails();
146
+
131
147
  let api = WebPackGenerator.loadAPIPackage(visualPackage);
132
148
  pluginConfiguration.apiVersion = api.version;
133
149
  pluginConfiguration.capabilitiesSchema = api.schemas.capabilities;
@@ -168,7 +184,6 @@ class WebPackGenerator {
168
184
  new ExtraWatchWebpackPlugin({
169
185
  files: [visualPackage.buildPath(this.pbiviz.capabilities)]
170
186
  }),
171
- new FriendlyErrorsWebpackPlugin(),
172
187
  new webpack.ProvidePlugin({
173
188
  window: 'realWindow',
174
189
  define: 'fakeDefine',
@@ -181,7 +196,7 @@ class WebPackGenerator {
181
196
  new webpack.SourceMapDevToolPlugin({
182
197
  filename: '[file].map',
183
198
  publicPath: `https://localhost:${this.webpackConfig.devServer.port}/assets/`
184
- })
199
+ })
185
200
  );
186
201
  }
187
202
  }
package/lib/utils.js ADDED
@@ -0,0 +1,26 @@
1
+ const fs = require('fs-extra');
2
+ let https = require("https");
3
+ let path = require("path");
4
+
5
+ function download(url, pathToFile) {
6
+ return new Promise((resolve, reject) => {
7
+ const fileStream = fs.createWriteStream(pathToFile);
8
+ https.get(url, (res) => {
9
+ res.pipe(fileStream);
10
+ fileStream.on('close', () => resolve(fileStream));
11
+ res.on('error', (error) => reject(error));
12
+ })
13
+ .on('error', (error) => reject(error));
14
+ });
15
+ }
16
+
17
+ function createFolder(folderName) {
18
+ let folder = path.join("./", folderName);
19
+ fs.ensureDirSync(folder);
20
+ return folder;
21
+ }
22
+
23
+ module.exports = {
24
+ download,
25
+ createFolder
26
+ };
@@ -50,7 +50,9 @@ module.exports = {
50
50
  {
51
51
  loader: require.resolve('less-loader'),
52
52
  options: {
53
- paths: [path.resolve(__dirname, "..", 'node_modules')]
53
+ lessOptions: {
54
+ paths: [path.resolve(__dirname, "..", 'node_modules')]
55
+ }
54
56
  }
55
57
  }
56
58
  ]
@@ -119,7 +121,7 @@ module.exports = {
119
121
  compress: true,
120
122
  port: 8080,
121
123
  hot: false,
122
- https: true,
124
+ server: 'https',
123
125
  headers: {
124
126
  "access-control-allow-origin": "*",
125
127
  "cache-control": "public, max-age=0"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "powerbi-visuals-tools",
3
- "version": "3.4.1",
3
+ "version": "4.0.2",
4
4
  "description": "Command line tool for creating and publishing visuals for Power BI",
5
5
  "main": "./lib/VisualPackage.js",
6
6
  "scripts": {
@@ -34,7 +34,7 @@
34
34
  "assert": "^2.0.0",
35
35
  "async": "3.2.0",
36
36
  "babel-loader": "^8.1.0",
37
- "base64-inline-loader": "^1.1.1",
37
+ "base64-inline-loader": "^2.0.1",
38
38
  "browserify-zlib": "^0.2.0",
39
39
  "buffer": "^6.0.3",
40
40
  "chalk": "3.0.0",
@@ -43,19 +43,18 @@
43
43
  "connect": "3.7.0",
44
44
  "console-browserify": "^1.2.0",
45
45
  "constants-browserify": "^1.0.0",
46
- "core-js": "3.6.4",
46
+ "core-js": "^3.18.1",
47
47
  "crypto-browserify": "^3.12.0",
48
48
  "css-loader": "^5.2.7",
49
49
  "domain-browser": "^4.22.0",
50
50
  "events": "^3.3.0",
51
51
  "extra-watch-webpack-plugin": "^1.0.3",
52
- "friendly-errors-webpack-plugin": "^1.7.0",
53
52
  "fs-extra": "^9.1.0",
54
53
  "https-browserify": "^1.0.0",
55
54
  "json-loader": "0.5.7",
56
55
  "jszip": "^3.7.1",
57
56
  "less": "^3.11.1",
58
- "less-loader": "^5.0.0",
57
+ "less-loader": "^10.0.1",
59
58
  "lodash.clonedeep": "4.5.0",
60
59
  "lodash.defaults": "4.2.0",
61
60
  "lodash.isequal": "4.5.0",
@@ -67,9 +66,7 @@
67
66
  "punycode": "^2.1.1",
68
67
  "querystring-es3": "^0.2.1",
69
68
  "readable-stream": "^3.6.0",
70
- "request": "^2.88.2",
71
69
  "serve-static": "1.14.1",
72
- "source-map-concat": "1.0.1",
73
70
  "stream-browserify": "^3.0.0",
74
71
  "stream-http": "^3.2.0",
75
72
  "string_decoder": "^1.3.0",
@@ -86,7 +83,7 @@
86
83
  "webpack-dev-server": "^4.1.0"
87
84
  },
88
85
  "devDependencies": {
89
- "eslint": "6.8.0",
86
+ "eslint": "^7.31.0",
90
87
  "jasmine": "3.5.0",
91
88
  "jasmine-spec-reporter": "5.0.1",
92
89
  "semver": "7.1.3",
@@ -19,7 +19,7 @@
19
19
  "d3": "5.12.0",
20
20
  "powerbi-visuals-utils-dataviewutils": "2.2.1",
21
21
  "powerbi-visuals-api": "~3.8.0",
22
- "core-js": "3.2.1"
22
+ "core-js": "^3.18.1"
23
23
  },
24
24
  "devDependencies": {
25
25
  "ts-loader": "6.1.0",
@@ -9,7 +9,7 @@
9
9
  "dependencies": {
10
10
  "d3": "5.10.0",
11
11
  "powerbi-visuals-utils-dataviewutils": "^2.2.1",
12
- "core-js": "3.2.1"
12
+ "core-js": "3.18.1"
13
13
  },
14
14
  "devDependencies": {
15
15
  "@babel/polyfill": "^7.4.4",
@@ -9,7 +9,7 @@
9
9
  "dependencies": {
10
10
  "d3": "5.10.0",
11
11
  "powerbi-visuals-utils-dataviewutils": "^2.2.1",
12
- "core-js": "3.2.1"
12
+ "core-js": "^3.18.1"
13
13
  },
14
14
  "devDependencies": {
15
15
  "powerbi-visuals-api": "~3.8.0",