powerbi-visuals-tools 3.4.0 → 4.0.0
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.
- package/.vscode/launch.json +45 -1
- package/Changelog.md +101 -16
- package/config.json +1 -1
- package/lib/CertificateTools.js +6 -8
- package/lib/TemplateFetcher.js +7 -29
- package/lib/WebPackWrap.js +23 -8
- package/lib/utils.js +26 -0
- package/lib/webpack.config.js +4 -2
- package/package.json +6 -9
- package/templates/visuals/default/package.json +1 -1
- package/templates/visuals/slicer/package.json +1 -1
- package/templates/visuals/table/package.json +1 -1
package/.vscode/launch.json
CHANGED
|
@@ -19,10 +19,54 @@
|
|
|
19
19
|
{
|
|
20
20
|
"type": "node",
|
|
21
21
|
"request": "launch",
|
|
22
|
-
"name": "
|
|
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,146 +2,206 @@
|
|
|
2
2
|
|
|
3
3
|
This page contains information about changes to the PowerBI Visual Tools (pbiviz).
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
## 4.0.0
|
|
6
|
+
* This release version includes changes from previous betta versions: 3.4.0, 3.4.1, 3.4.2, 3.4.3.
|
|
7
|
+
|
|
8
|
+
## 3.4.3
|
|
9
|
+
|
|
10
|
+
* Updated webpack assets compilation
|
|
11
|
+
* Added environment logging for debugging purposes
|
|
12
|
+
* Fixed certificate date verification for different regional settings
|
|
13
|
+
|
|
14
|
+
## 3.4.2
|
|
15
|
+
|
|
16
|
+
* Migrated from `request` lib to node `https` standard method
|
|
17
|
+
* Removed `friendly-errors-webpack-plugin` usage
|
|
18
|
+
* Removed or updated deprecated dependencies
|
|
19
|
+
* Fixed vulnerabilities
|
|
20
|
+
|
|
21
|
+
## 3.4.1
|
|
22
|
+
|
|
23
|
+
* Fixed certificate verification for 'non-english' environment
|
|
24
|
+
|
|
25
|
+
## 3.4.0
|
|
26
|
+
|
|
6
27
|
### **⚠ BREAKING CHANGES**
|
|
28
|
+
|
|
7
29
|
* Removed old API ( 2.6.0 and bellow) templates logic
|
|
8
30
|
* Removed `pbiviz-update` method
|
|
9
31
|
* Removed `--api [version]` flag
|
|
10
32
|
* Migrated to `webpack-dev-server` v4
|
|
11
33
|
|
|
12
34
|
## 3.3.2
|
|
35
|
+
|
|
13
36
|
* Extended `"powerbi-visuals-api"` usage up to version 3.2.0 and higher
|
|
14
37
|
|
|
15
38
|
## 3.3.1
|
|
39
|
+
|
|
16
40
|
* Fixed certificate issues
|
|
17
41
|
* Fixed an issue when previous API version was used for a new package build
|
|
18
42
|
|
|
19
43
|
## 3.3.0
|
|
44
|
+
|
|
20
45
|
### **⚠ BREAKING CHANGES**
|
|
46
|
+
|
|
21
47
|
* Starting from tools version 3.3.0, it expects usage of ["powerbi-visuals-api": ">=3.8.0"](https://github.com/microsoft/powerbi-visuals-api/blob/master/CHANGELOG.md#382)
|
|
48
|
+
|
|
22
49
|
### **Features**
|
|
50
|
+
|
|
23
51
|
* Added support for CV modal dialog
|
|
24
52
|
|
|
25
53
|
## 3.2.2
|
|
54
|
+
|
|
26
55
|
* Removed npm-force-resolutions package
|
|
27
56
|
|
|
28
57
|
## 3.2.1
|
|
58
|
+
|
|
29
59
|
* Fixed preinstall to prevent instalation failure because of npm-force-resolutions
|
|
30
60
|
* Fixed pbiviz.json dependencies option usage
|
|
31
61
|
|
|
32
62
|
## 3.2.0
|
|
63
|
+
|
|
33
64
|
* Fixed LessCompiler for old visuals
|
|
34
65
|
|
|
35
66
|
## 3.1.19
|
|
67
|
+
|
|
36
68
|
* Fixed webpack Node.js polyfill issue in webpack 5+"
|
|
37
69
|
|
|
38
70
|
## 3.1.18
|
|
71
|
+
|
|
39
72
|
* Removed deprecated packages
|
|
40
73
|
|
|
41
74
|
## 3.1.16
|
|
75
|
+
|
|
42
76
|
* Added visuals compatibility with webpack v5
|
|
43
77
|
* Removed lodash: _.template, ._findindex, .difference
|
|
44
78
|
* Packages update
|
|
45
79
|
|
|
46
80
|
## 3.1.15
|
|
81
|
+
|
|
47
82
|
* Webpack plugin update
|
|
48
83
|
* npm audit package-lock patch
|
|
49
84
|
|
|
50
85
|
## 3.1.14
|
|
86
|
+
|
|
51
87
|
* Fix output library name for debug mode
|
|
52
88
|
|
|
53
89
|
## 3.1.12
|
|
90
|
+
|
|
54
91
|
* Command package rolling back to fix issues with some commands running
|
|
55
92
|
|
|
56
93
|
## 3.1.11
|
|
57
|
-
|
|
94
|
+
|
|
95
|
+
* Packages update. Fixed <https://github.com/microsoft/PowerBI-visuals-tools/issues/304>
|
|
58
96
|
|
|
59
97
|
## 3.1.10
|
|
98
|
+
|
|
60
99
|
* Packages update: Uglify-js is replaced by Terser
|
|
61
100
|
|
|
62
101
|
## 3.1.9
|
|
102
|
+
|
|
63
103
|
* Fix loading the old visual projects
|
|
64
104
|
* Fix loading old [`formattingutils`](https://github.com/microsoft/powerbi-visuals-utils-formattingutils/tree/72a136aca836e60042be35b1cd2ae10a07837ba8) in the old visual projects.
|
|
65
105
|
|
|
66
106
|
## 3.1.8
|
|
107
|
+
|
|
67
108
|
* Update `powerbi-visuals-webpack-plugin` to 2.2.1
|
|
68
109
|
|
|
69
110
|
## 3.1.7
|
|
111
|
+
|
|
70
112
|
* Fix vscode workspace settings template
|
|
71
113
|
* Fix certificate tool error handling
|
|
72
114
|
|
|
73
115
|
## 3.1.6
|
|
116
|
+
|
|
74
117
|
* Fix webpack configureation include regex
|
|
75
118
|
* Templates update
|
|
76
119
|
|
|
77
120
|
## 3.1.5
|
|
121
|
+
|
|
78
122
|
* Templates update
|
|
79
123
|
|
|
80
124
|
## 3.1.4
|
|
125
|
+
|
|
81
126
|
* Packages update
|
|
82
127
|
|
|
83
128
|
## 3.1.3
|
|
129
|
+
|
|
84
130
|
* Remove `@babel/polyfill`
|
|
85
131
|
* Replace `webpack-visualizer-plugin` by `webpack-bundle-analyzer`
|
|
86
132
|
|
|
87
133
|
## 3.1.2
|
|
88
|
-
|
|
134
|
+
|
|
135
|
+
* Add extensions for *.svg*.eot files to `base64-inline-loader` configuration
|
|
89
136
|
* Exclude `code-js` package to process by Babel
|
|
90
137
|
* Include `@babel/plugin-syntax-dynamic-import` plugin for Babel
|
|
91
138
|
* Update `core-js` package to version 3.x.x.
|
|
92
139
|
|
|
93
140
|
## 3.1.1
|
|
141
|
+
|
|
94
142
|
* Add `base64-inline-loader` to load images
|
|
95
143
|
|
|
96
144
|
## pbiviz v3.1.0
|
|
145
|
+
|
|
97
146
|
* Release. Now Webpack is default builder for Custom Visuals.
|
|
98
147
|
* What’s new in powerbi-visuals-tools v3?
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
* For the full details please check [this article](https://microsoft.github.io/PowerBI-visuals/docs/how-to-guide/migrating-to-powerbi-visuals-tools-3-0/).
|
|
105
|
-
|
|
106
|
-
## pbiviz v2.5.0
|
|
148
|
+
* TypeScript v3.0.1 by default
|
|
149
|
+
* ES6 Modules supported
|
|
150
|
+
* New versions of D3v5 and other external libraries are supported
|
|
151
|
+
* Reduced package size
|
|
152
|
+
* Improved API performance
|
|
153
|
+
* For the full details please check [this article](https://microsoft.github.io/PowerBI-visuals/docs/how-to-guide/migrating-to-powerbi-visuals-tools-3-0/).
|
|
154
|
+
|
|
155
|
+
## pbiviz v2.5.0
|
|
156
|
+
|
|
107
157
|
* Added Analytics Pane support
|
|
108
158
|
Note: API v2.4.0 skipped as it does not include any public changes
|
|
109
159
|
|
|
110
160
|
## pbiviz v2.3.0
|
|
161
|
+
|
|
111
162
|
* custom visuals now support a landing page
|
|
112
163
|
|
|
113
164
|
## pbiviz v2.2.2
|
|
165
|
+
|
|
114
166
|
* Update package-lock.json to fix vulnerabilities
|
|
115
167
|
|
|
116
168
|
## pbiviz v2.2.1
|
|
169
|
+
|
|
117
170
|
* Deprecated `applySelectionFilter` from `ISelectionManager`
|
|
118
171
|
|
|
119
172
|
## pbiviz v3.0.12 Beta
|
|
173
|
+
|
|
120
174
|
* Compression option for compressing visual package
|
|
121
175
|
* Fix launch webpack build triggering
|
|
122
176
|
* Update powerbi-visuals-webpack-plugin to 2.1.0
|
|
123
177
|
|
|
124
178
|
## pbiviz v3.0.11 Beta
|
|
125
|
-
|
|
179
|
+
|
|
180
|
+
* Add support to import *.css and*.less files
|
|
126
181
|
* Fix reloading capabilities.json
|
|
127
182
|
* Resolve issue of starting dev server after copy certs from global instance
|
|
128
183
|
* Serve old visual project by nodejs server instead webpack dev server
|
|
129
184
|
|
|
130
185
|
## pbiviz v3.0.10 Beta
|
|
186
|
+
|
|
131
187
|
* Resolve dev server certificates from global instance of pbiviz.
|
|
132
188
|
* Replace VisualServer.js by webpack-dev-server
|
|
133
189
|
|
|
134
190
|
## pbiviz v3.0.9 Beta
|
|
191
|
+
|
|
135
192
|
* Set `sourceType` to "unambiguous" for babel configuration
|
|
136
193
|
|
|
137
194
|
## pbiviz v3.0.8 Beta
|
|
195
|
+
|
|
138
196
|
* Update powerbi-visuals-webpack-plugin to 2.0.0
|
|
139
197
|
* Remove minification by babel (remove `babel-preset-minify` package).
|
|
140
198
|
|
|
141
199
|
## pbiviz v3.0.7 Beta
|
|
200
|
+
|
|
142
201
|
* Update powerbi-visuals-webpack-plugin to 1.0.15
|
|
143
202
|
|
|
144
203
|
## pbiviz v3.0.6 Beta
|
|
204
|
+
|
|
145
205
|
* Install the latest patch of `powerbi-visuals-api`
|
|
146
206
|
* The `pbiviz.json` values of visual templates overrides global template values
|
|
147
207
|
* Remove unnecessary `setApiVersion` and `updateApi` from `VisualGenerator`
|
|
@@ -149,85 +209,110 @@ Note: API v2.4.0 skipped as it does not include any public changes
|
|
|
149
209
|
* Update powerbi-visuals-plugin to version 1.0.13
|
|
150
210
|
|
|
151
211
|
## pbiviz v3.0.5 Beta
|
|
212
|
+
|
|
152
213
|
* Prevent using define function in context of module
|
|
153
214
|
|
|
154
215
|
## pbiviz v3.0.4 Beta
|
|
216
|
+
|
|
155
217
|
* Update powerbi-visuals-plugin to version 1.0.11
|
|
156
218
|
|
|
157
219
|
## pbiviz v3.0.3 Beta
|
|
220
|
+
|
|
158
221
|
* Update powerbi-visuals-plugin to version 1.0.10
|
|
159
222
|
* Remove jasmine-node package
|
|
160
223
|
|
|
161
224
|
## pbiviz v3.0.2 Beta
|
|
225
|
+
|
|
162
226
|
* Tools observe changes in `pbiviz.json` and `capabilities.json` files and rebuild the visual.
|
|
163
227
|
* `webpack-visualizer-plugin` replaced by `webpack-bundle-analyzer` to visualize the webpack bundle stats.
|
|
164
228
|
|
|
165
229
|
## pbiviz v3.0.1 Beta
|
|
230
|
+
|
|
166
231
|
* Webpack based tools
|
|
167
232
|
|
|
168
|
-
## pbiviz v2.0.2
|
|
233
|
+
## pbiviz v2.0.2
|
|
234
|
+
|
|
169
235
|
* Skip precompilation for the visual with ES6 modules
|
|
170
236
|
|
|
171
237
|
## pbiviz v2.0.1
|
|
238
|
+
|
|
172
239
|
* Update package.json. Fix package installation
|
|
173
240
|
|
|
174
241
|
## pbiviz v2.0.0
|
|
242
|
+
|
|
175
243
|
* TypeScript external modules support
|
|
176
244
|
|
|
177
245
|
## pbiviz v1.12.1
|
|
178
|
-
|
|
246
|
+
|
|
247
|
+
* Generate certificates on development server starts
|
|
179
248
|
|
|
180
249
|
## pbiviz v1.11.3
|
|
250
|
+
|
|
181
251
|
* Resolve PowerShell params issue on Win8.
|
|
182
252
|
|
|
183
253
|
## pbiviz v1.11.2
|
|
254
|
+
|
|
184
255
|
* Resolve PowerShell script launching issue.
|
|
185
256
|
|
|
186
257
|
## pbiviz v1.11.1
|
|
258
|
+
|
|
187
259
|
* Check certificate path in `--install-cert` command.
|
|
188
260
|
|
|
189
261
|
## pbiviz v1.11.0
|
|
262
|
+
|
|
190
263
|
* Added `selectionManager.registerOnSelectCallback()` method for Report Bookmarks support
|
|
191
264
|
|
|
192
265
|
## pbiviz v1.10.2
|
|
266
|
+
|
|
193
267
|
* Added `pbiviz --create-cert` for generating new unique certificate
|
|
194
268
|
|
|
195
269
|
## pbiviz v1.10.1
|
|
270
|
+
|
|
196
271
|
* Increase typescript to 2.3.3 version
|
|
197
272
|
|
|
198
273
|
## pbiviz v1.10.0
|
|
274
|
+
|
|
199
275
|
* Added ILocalizationManager
|
|
200
276
|
* Upgrade dependencies
|
|
201
277
|
* Added Authentication API call support
|
|
202
278
|
|
|
203
279
|
## pbiviz v1.9.0
|
|
280
|
+
|
|
204
281
|
* Added launchUrl API call support
|
|
205
282
|
|
|
206
283
|
## pbiviz v1.8.1
|
|
284
|
+
|
|
207
285
|
* FIX: Localization schema will be ignored if API doesn't support localization
|
|
208
286
|
|
|
209
287
|
## pbiviz v1.8.0
|
|
288
|
+
|
|
210
289
|
* Added new type "fillRule" (gradient) support in capabilities schema
|
|
211
290
|
* Added "rule" property support in capabilities schema for object properties
|
|
212
291
|
* Fixed sub commands help output in "Using:" section
|
|
213
292
|
|
|
214
293
|
## pbiviz v1.7.5
|
|
215
|
-
|
|
294
|
+
|
|
295
|
+
* Return innerHTML method for RHTML visual sample
|
|
216
296
|
|
|
217
297
|
## pbiviz v1.7.4
|
|
298
|
+
|
|
218
299
|
* Remove innerHTML method from sample visual
|
|
219
300
|
|
|
220
301
|
## pbiviz v1.7.3
|
|
221
|
-
|
|
302
|
+
|
|
303
|
+
* Added RESJSON support
|
|
222
304
|
|
|
223
305
|
## pbiviz v1.7.2
|
|
306
|
+
|
|
224
307
|
* Add name validation to pbiviz new command, restrict usage of symbols in the file visual name.
|
|
225
308
|
|
|
226
309
|
## pbiviz v1.7.1
|
|
310
|
+
|
|
227
311
|
* Added visual name validation
|
|
228
312
|
* Added auto-install npm dependencies
|
|
229
313
|
|
|
230
314
|
## pbiviz v1.6.5
|
|
315
|
+
|
|
231
316
|
* Updated npm dependencies
|
|
232
317
|
* Fixed settings generation
|
|
233
318
|
|
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":"
|
|
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":"2375745128890907"},"visualTemplates":{"circlecard":"https://codeload.github.com/microsoft/powerbi-visuals-circlecard-react/zip/master"}}
|
package/lib/CertificateTools.js
CHANGED
|
@@ -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 =
|
|
59
|
+
const validPeriod = 365;
|
|
60
60
|
|
|
61
61
|
if (typeof open === 'undefined') {
|
|
62
62
|
open = false;
|
|
@@ -383,16 +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(`powershell
|
|
393
|
-
|
|
394
|
-
endDateStr = regex.exec(certStr);
|
|
395
|
-
|
|
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 =
|
|
406
|
-
verifyCertDate = (endDate -
|
|
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 {
|
package/lib/TemplateFetcher.js
CHANGED
|
@@ -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
|
-
|
|
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 =
|
|
15
|
+
this.folderName = `${this.visualName}`;
|
|
15
16
|
this.apiVersion = apiVersion;
|
|
16
|
-
console.log();
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
fetch() {
|
|
20
|
-
this.
|
|
21
|
-
|
|
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 =
|
|
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
|
package/lib/WebPackWrap.js
CHANGED
|
@@ -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
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
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
|
+
};
|
package/lib/webpack.config.js
CHANGED
|
@@ -50,7 +50,9 @@ module.exports = {
|
|
|
50
50
|
{
|
|
51
51
|
loader: require.resolve('less-loader'),
|
|
52
52
|
options: {
|
|
53
|
-
|
|
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
|
-
|
|
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
|
+
"version": "4.0.0",
|
|
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": "^
|
|
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,33 +43,30 @@
|
|
|
43
43
|
"connect": "3.7.0",
|
|
44
44
|
"console-browserify": "^1.2.0",
|
|
45
45
|
"constants-browserify": "^1.0.0",
|
|
46
|
-
"core-js": "3.
|
|
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": "^
|
|
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",
|
|
62
61
|
"mini-css-extract-plugin": "^1.4.0",
|
|
63
62
|
"os-browserify": "^0.3.0",
|
|
64
63
|
"path-browserify": "^1.0.1",
|
|
65
|
-
"powerbi-visuals-webpack-plugin": "^
|
|
64
|
+
"powerbi-visuals-webpack-plugin": "^3.0.0",
|
|
66
65
|
"process": "^0.11.10",
|
|
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": "
|
|
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",
|