powerbi-visuals-tools 3.4.2 → 3.4.3

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.
@@ -24,6 +24,22 @@
24
24
  "program": "${workspaceFolder}\\bin\\pbiviz.js",
25
25
  "args": ["start"]
26
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
+ },
27
43
  {
28
44
  "type": "node",
29
45
  "request": "launch",
package/Changelog.md CHANGED
@@ -2,11 +2,18 @@
2
2
 
3
3
  This page contains information about changes to the PowerBI Visual Tools (pbiviz).
4
4
 
5
+ ## 3.4.3
6
+
7
+ * Updated webpack assets compilation
8
+ * Added environment logging for debugging purposes
9
+ * Fixed certificate date verification for different regional settings
10
+
5
11
  ## 3.4.2
6
12
 
7
13
  * Migrated from `request` lib to node `https` standard method
8
14
  * Removed `friendly-errors-webpack-plugin` usage
9
15
  * Removed or updated deprecated dependencies
16
+ * Fixed vulnerabilities
10
17
 
11
18
  ## 3.4.1
12
19
 
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":"29494060387342613"},"visualTemplates":{"circlecard":"https://codeload.github.com/microsoft/powerbi-visuals-circlecard-react/zip/master"}}
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":"558507214814856"},"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;
@@ -389,10 +389,8 @@ async function veryfyCertFile(keyPath, certPath, pfxPath, passphrase) {
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]);
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();
396
394
  }
397
395
  // For Linux and Mac/darwin OS:
398
396
  else if (os.platform() === "linux" || os.platform() === "darwin") {
@@ -402,8 +400,8 @@ async function veryfyCertFile(keyPath, certPath, pfxPath, passphrase) {
402
400
  endDateStr = await exec(`openssl x509 -enddate -noout -in ${certPath} | cut -d = -f 2`);
403
401
  }
404
402
 
405
- let endDate = new Date(Date.parse(endDateStr));
406
- verifyCertDate = (endDate - new Date()) > certSafePeriod;
403
+ let endDate = Date.parse(endDateStr);
404
+ verifyCertDate = (endDate - Date.now()) > certSafePeriod;
407
405
  if (verifyCertDate) {
408
406
  ConsoleWriter.info(`Certificate is valid.`);
409
407
  } else {
@@ -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');
@@ -14,6 +15,7 @@ const exec = util.promisify(require('child_process').exec);
14
15
  const CertificateTools = require("../lib/CertificateTools");
15
16
  const visualPlugin = "visualPlugin.ts";
16
17
  const lodashCloneDeep = require('lodash.clonedeep');
18
+ const npmPackage = require('../package.json');
17
19
 
18
20
  class WebPackGenerator {
19
21
 
@@ -80,11 +82,14 @@ class WebPackGenerator {
80
82
  directory: path.join(visualPackage.basePath, config.build.dropFolder),
81
83
  publicPath: config.server.assetsRoute
82
84
  },
83
- https: {
84
- key: options.key,
85
- cert: options.cert,
86
- pfx: options.pfx,
87
- 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
+ }
88
93
  }
89
94
  };
90
95
  }
@@ -108,6 +113,16 @@ class WebPackGenerator {
108
113
  }
109
114
  }
110
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
+
111
126
  async configureCustomVisualsWebpackPlugin(visualPackage, options, tsconfig) {
112
127
  let pluginConfiguration = lodashCloneDeep(visualPackage.config);
113
128
  //(?=\D*$) - positive look-ahead to find last version symbols and exclude any non-digit symbols after the version.
@@ -127,6 +142,8 @@ class WebPackGenerator {
127
142
  await this.installAPIpackage();
128
143
  }
129
144
 
145
+ pluginConfiguration.env = await this.getEnvironmentDetails();
146
+
130
147
  let api = WebPackGenerator.loadAPIPackage(visualPackage);
131
148
  pluginConfiguration.apiVersion = api.version;
132
149
  pluginConfiguration.capabilitiesSchema = api.schemas.capabilities;
@@ -179,7 +196,7 @@ class WebPackGenerator {
179
196
  new webpack.SourceMapDevToolPlugin({
180
197
  filename: '[file].map',
181
198
  publicPath: `https://localhost:${this.webpackConfig.devServer.port}/assets/`
182
- })
199
+ })
183
200
  );
184
201
  }
185
202
  }
@@ -121,7 +121,7 @@ module.exports = {
121
121
  compress: true,
122
122
  port: 8080,
123
123
  hot: false,
124
- https: true,
124
+ server: 'https',
125
125
  headers: {
126
126
  "access-control-allow-origin": "*",
127
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.2",
3
+ "version": "3.4.3",
4
4
  "description": "Command line tool for creating and publishing visuals for Power BI",
5
5
  "main": "./lib/VisualPackage.js",
6
6
  "scripts": {
@@ -61,7 +61,7 @@
61
61
  "mini-css-extract-plugin": "^1.4.0",
62
62
  "os-browserify": "^0.3.0",
63
63
  "path-browserify": "^1.0.1",
64
- "powerbi-visuals-webpack-plugin": "^2.3.1",
64
+ "powerbi-visuals-webpack-plugin": "^3.0.0",
65
65
  "process": "^0.11.10",
66
66
  "punycode": "^2.1.1",
67
67
  "querystring-es3": "^0.2.1",
@@ -83,7 +83,7 @@
83
83
  "webpack-dev-server": "^4.1.0"
84
84
  },
85
85
  "devDependencies": {
86
- "eslint": "6.8.0",
86
+ "eslint": "^7.31.0",
87
87
  "jasmine": "3.5.0",
88
88
  "jasmine-spec-reporter": "5.0.1",
89
89
  "semver": "7.1.3",