powerbi-visuals-tools 3.3.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.
Files changed (122) hide show
  1. package/.vscode/launch.json +52 -0
  2. package/Changelog.md +105 -16
  3. package/bin/pbiviz-new.js +3 -12
  4. package/bin/pbiviz-package.js +12 -8
  5. package/bin/pbiviz-start.js +25 -51
  6. package/bin/pbiviz.js +0 -1
  7. package/config.json +1 -1
  8. package/lib/CertificateTools.js +6 -8
  9. package/lib/TemplateFetcher.js +7 -29
  10. package/lib/VisualGenerator.js +5 -94
  11. package/lib/WebPackWrap.js +69 -75
  12. package/lib/utils.js +26 -0
  13. package/lib/webpack.config.js +9 -6
  14. package/package.json +14 -16
  15. package/templates/visuals/default/package.json +2 -2
  16. package/templates/visuals/rhtml/package.json +1 -1
  17. package/templates/visuals/rvisual/package.json +1 -1
  18. package/templates/visuals/slicer/package.json +2 -2
  19. package/templates/visuals/table/package.json +2 -2
  20. package/bin/pbiviz-update.js +0 -128
  21. package/lib/LessCompiler.js +0 -86
  22. package/lib/TypescriptCompiler.js +0 -243
  23. package/templates/visuals/.api/v1.0.0/PowerBI-visuals.d.ts +0 -1139
  24. package/templates/visuals/.api/v1.0.0/schema.capabilities.json +0 -758
  25. package/templates/visuals/.api/v1.0.0/schema.pbiviz.json +0 -95
  26. package/templates/visuals/.api/v1.1.0/PowerBI-visuals.d.ts +0 -1179
  27. package/templates/visuals/.api/v1.1.0/schema.capabilities.json +0 -828
  28. package/templates/visuals/.api/v1.1.0/schema.pbiviz.json +0 -95
  29. package/templates/visuals/.api/v1.10.0/PowerBI-visuals.d.ts +0 -1406
  30. package/templates/visuals/.api/v1.10.0/schema.capabilities.json +0 -1143
  31. package/templates/visuals/.api/v1.10.0/schema.dependencies.json +0 -38
  32. package/templates/visuals/.api/v1.10.0/schema.pbiviz.json +0 -103
  33. package/templates/visuals/.api/v1.10.0/schema.stringResources.json +0 -67
  34. package/templates/visuals/.api/v1.11.0/PowerBI-visuals.d.ts +0 -1406
  35. package/templates/visuals/.api/v1.11.0/schema.capabilities.json +0 -1143
  36. package/templates/visuals/.api/v1.11.0/schema.dependencies.json +0 -38
  37. package/templates/visuals/.api/v1.11.0/schema.pbiviz.json +0 -103
  38. package/templates/visuals/.api/v1.11.0/schema.stringResources.json +0 -67
  39. package/templates/visuals/.api/v1.12.0/PowerBI-visuals.d.ts +0 -1408
  40. package/templates/visuals/.api/v1.12.0/schema.capabilities.json +0 -1173
  41. package/templates/visuals/.api/v1.12.0/schema.dependencies.json +0 -38
  42. package/templates/visuals/.api/v1.12.0/schema.pbiviz.json +0 -103
  43. package/templates/visuals/.api/v1.12.0/schema.stringResources.json +0 -67
  44. package/templates/visuals/.api/v1.13.0/PowerBI-visuals.d.ts +0 -1450
  45. package/templates/visuals/.api/v1.13.0/schema.capabilities.json +0 -1181
  46. package/templates/visuals/.api/v1.13.0/schema.dependencies.json +0 -38
  47. package/templates/visuals/.api/v1.13.0/schema.pbiviz.json +0 -103
  48. package/templates/visuals/.api/v1.13.0/schema.stringResources.json +0 -67
  49. package/templates/visuals/.api/v1.2.0/PowerBI-visuals.d.ts +0 -1188
  50. package/templates/visuals/.api/v1.2.0/schema.capabilities.json +0 -951
  51. package/templates/visuals/.api/v1.2.0/schema.dependencies.json +0 -38
  52. package/templates/visuals/.api/v1.2.0/schema.pbiviz.json +0 -99
  53. package/templates/visuals/.api/v1.3.0/PowerBI-visuals.d.ts +0 -1293
  54. package/templates/visuals/.api/v1.3.0/schema.capabilities.json +0 -951
  55. package/templates/visuals/.api/v1.3.0/schema.dependencies.json +0 -38
  56. package/templates/visuals/.api/v1.3.0/schema.pbiviz.json +0 -95
  57. package/templates/visuals/.api/v1.4.0/PowerBI-visuals.d.ts +0 -1282
  58. package/templates/visuals/.api/v1.4.0/schema.capabilities.json +0 -951
  59. package/templates/visuals/.api/v1.4.0/schema.dependencies.json +0 -38
  60. package/templates/visuals/.api/v1.4.0/schema.pbiviz.json +0 -95
  61. package/templates/visuals/.api/v1.5.0/PowerBI-visuals.d.ts +0 -1205
  62. package/templates/visuals/.api/v1.5.0/schema.capabilities.json +0 -987
  63. package/templates/visuals/.api/v1.5.0/schema.dependencies.json +0 -38
  64. package/templates/visuals/.api/v1.5.0/schema.pbiviz.json +0 -95
  65. package/templates/visuals/.api/v1.6.0/PowerBI-visuals.d.ts +0 -1297
  66. package/templates/visuals/.api/v1.6.0/schema.capabilities.json +0 -1007
  67. package/templates/visuals/.api/v1.6.0/schema.dependencies.json +0 -38
  68. package/templates/visuals/.api/v1.6.0/schema.pbiviz.json +0 -103
  69. package/templates/visuals/.api/v1.6.0/schema.stringResources.json +0 -67
  70. package/templates/visuals/.api/v1.7.0/PowerBI-visuals.d.ts +0 -1381
  71. package/templates/visuals/.api/v1.7.0/schema.capabilities.json +0 -1007
  72. package/templates/visuals/.api/v1.7.0/schema.dependencies.json +0 -38
  73. package/templates/visuals/.api/v1.7.0/schema.pbiviz.json +0 -103
  74. package/templates/visuals/.api/v1.7.0/schema.stringResources.json +0 -67
  75. package/templates/visuals/.api/v1.8.0/PowerBI-visuals.d.ts +0 -1389
  76. package/templates/visuals/.api/v1.8.0/schema.capabilities.json +0 -1131
  77. package/templates/visuals/.api/v1.8.0/schema.dependencies.json +0 -38
  78. package/templates/visuals/.api/v1.8.0/schema.pbiviz.json +0 -103
  79. package/templates/visuals/.api/v1.8.0/schema.stringResources.json +0 -67
  80. package/templates/visuals/.api/v1.9.0/PowerBI-visuals.d.ts +0 -1391
  81. package/templates/visuals/.api/v1.9.0/schema.capabilities.json +0 -1131
  82. package/templates/visuals/.api/v1.9.0/schema.dependencies.json +0 -38
  83. package/templates/visuals/.api/v1.9.0/schema.pbiviz.json +0 -103
  84. package/templates/visuals/.api/v1.9.0/schema.stringResources.json +0 -67
  85. package/templates/visuals/.api/v2.0.0/PowerBI-visuals.d.ts +0 -1417
  86. package/templates/visuals/.api/v2.0.0/schema.capabilities.json +0 -1177
  87. package/templates/visuals/.api/v2.0.0/schema.dependencies.json +0 -38
  88. package/templates/visuals/.api/v2.0.0/schema.pbiviz.json +0 -103
  89. package/templates/visuals/.api/v2.0.0/schema.stringResources.json +0 -67
  90. package/templates/visuals/.api/v2.1.0/PowerBI-visuals.d.ts +0 -1417
  91. package/templates/visuals/.api/v2.1.0/schema.capabilities.json +0 -1177
  92. package/templates/visuals/.api/v2.1.0/schema.dependencies.json +0 -38
  93. package/templates/visuals/.api/v2.1.0/schema.pbiviz.json +0 -103
  94. package/templates/visuals/.api/v2.1.0/schema.stringResources.json +0 -67
  95. package/templates/visuals/.api/v2.2.0/PowerBI-visuals.d.ts +0 -1423
  96. package/templates/visuals/.api/v2.2.0/schema.capabilities.json +0 -1189
  97. package/templates/visuals/.api/v2.2.0/schema.dependencies.json +0 -38
  98. package/templates/visuals/.api/v2.2.0/schema.pbiviz.json +0 -103
  99. package/templates/visuals/.api/v2.2.0/schema.stringResources.json +0 -67
  100. package/templates/visuals/.api/v2.3.0/PowerBI-visuals.d.ts +0 -1480
  101. package/templates/visuals/.api/v2.3.0/schema.capabilities.json +0 -1193
  102. package/templates/visuals/.api/v2.3.0/schema.dependencies.json +0 -38
  103. package/templates/visuals/.api/v2.3.0/schema.pbiviz.json +0 -103
  104. package/templates/visuals/.api/v2.3.0/schema.stringResources.json +0 -67
  105. package/templates/visuals/.api/v2.5.0/PowerBI-visuals.d.ts +0 -1483
  106. package/templates/visuals/.api/v2.5.0/schema.capabilities.json +0 -1197
  107. package/templates/visuals/.api/v2.5.0/schema.dependencies.json +0 -38
  108. package/templates/visuals/.api/v2.5.0/schema.pbiviz.json +0 -103
  109. package/templates/visuals/.api/v2.5.0/schema.stringResources.json +0 -67
  110. package/templates/visuals/.api/v2.6.0/PowerBI-visuals.d.ts +0 -1485
  111. package/templates/visuals/.api/v2.6.0/schema.capabilities.json +0 -1323
  112. package/templates/visuals/.api/v2.6.0/schema.dependencies.json +0 -38
  113. package/templates/visuals/.api/v2.6.0/schema.pbiviz.json +0 -103
  114. package/templates/visuals/.api/v2.6.0/schema.stringResources.json +0 -67
  115. package/templates/visuals/default1/assets/icon.png +0 -0
  116. package/templates/visuals/default1/capabilities.json +0 -84
  117. package/templates/visuals/default1/package.json +0 -6
  118. package/templates/visuals/default1/pbiviz.json +0 -3
  119. package/templates/visuals/default1/src/settings.ts +0 -32
  120. package/templates/visuals/default1/src/visual.ts +0 -71
  121. package/templates/visuals/default1/style/visual.less +0 -9
  122. package/templates/visuals/default1/tsconfig.json +0 -16
@@ -15,6 +15,58 @@
15
15
  "circlecard",
16
16
  "mynewsample"
17
17
  ]
18
+ },
19
+ {
20
+ "type": "node",
21
+ "request": "launch",
22
+ "name": "pbiviz-start t1",
23
+ "cwd": "${workspaceFolder}\\testGround\\t1",
24
+ "program": "${workspaceFolder}\\bin\\pbiviz.js",
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
+ ]
18
70
  }
19
71
  ]
20
72
  }
package/Changelog.md CHANGED
@@ -2,139 +2,203 @@
2
2
 
3
3
  This page contains information about changes to the PowerBI Visual Tools (pbiviz).
4
4
 
5
- # 3.3.2
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
+
11
+ ## 3.4.2
12
+
13
+ * Migrated from `request` lib to node `https` standard method
14
+ * Removed `friendly-errors-webpack-plugin` usage
15
+ * Removed or updated deprecated dependencies
16
+ * Fixed vulnerabilities
17
+
18
+ ## 3.4.1
19
+
20
+ * Fixed certificate verification for 'non-english' environment
21
+
22
+ ## 3.4.0
23
+
24
+ ### **⚠ BREAKING CHANGES**
25
+
26
+ * Removed old API ( 2.6.0 and bellow) templates logic
27
+ * Removed `pbiviz-update` method
28
+ * Removed `--api [version]` flag
29
+ * Migrated to `webpack-dev-server` v4
30
+
31
+ ## 3.3.2
32
+
6
33
  * Extended `"powerbi-visuals-api"` usage up to version 3.2.0 and higher
7
34
 
8
35
  ## 3.3.1
36
+
9
37
  * Fixed certificate issues
10
38
  * Fixed an issue when previous API version was used for a new package build
11
39
 
12
40
  ## 3.3.0
41
+
13
42
  ### **⚠ BREAKING CHANGES**
43
+
14
44
  * 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)
45
+
15
46
  ### **Features**
47
+
16
48
  * Added support for CV modal dialog
17
49
 
18
50
  ## 3.2.2
51
+
19
52
  * Removed npm-force-resolutions package
20
53
 
21
54
  ## 3.2.1
55
+
22
56
  * Fixed preinstall to prevent instalation failure because of npm-force-resolutions
23
57
  * Fixed pbiviz.json dependencies option usage
24
58
 
25
59
  ## 3.2.0
60
+
26
61
  * Fixed LessCompiler for old visuals
27
62
 
28
63
  ## 3.1.19
64
+
29
65
  * Fixed webpack Node.js polyfill issue in webpack 5+"
30
66
 
31
67
  ## 3.1.18
68
+
32
69
  * Removed deprecated packages
33
70
 
34
71
  ## 3.1.16
72
+
35
73
  * Added visuals compatibility with webpack v5
36
74
  * Removed lodash: _.template, ._findindex, .difference
37
75
  * Packages update
38
76
 
39
77
  ## 3.1.15
78
+
40
79
  * Webpack plugin update
41
80
  * npm audit package-lock patch
42
81
 
43
82
  ## 3.1.14
83
+
44
84
  * Fix output library name for debug mode
45
85
 
46
86
  ## 3.1.12
87
+
47
88
  * Command package rolling back to fix issues with some commands running
48
89
 
49
90
  ## 3.1.11
50
- * Packages update. Fixed https://github.com/microsoft/PowerBI-visuals-tools/issues/304
91
+
92
+ * Packages update. Fixed <https://github.com/microsoft/PowerBI-visuals-tools/issues/304>
51
93
 
52
94
  ## 3.1.10
95
+
53
96
  * Packages update: Uglify-js is replaced by Terser
54
97
 
55
98
  ## 3.1.9
99
+
56
100
  * Fix loading the old visual projects
57
101
  * Fix loading old [`formattingutils`](https://github.com/microsoft/powerbi-visuals-utils-formattingutils/tree/72a136aca836e60042be35b1cd2ae10a07837ba8) in the old visual projects.
58
102
 
59
103
  ## 3.1.8
104
+
60
105
  * Update `powerbi-visuals-webpack-plugin` to 2.2.1
61
106
 
62
107
  ## 3.1.7
108
+
63
109
  * Fix vscode workspace settings template
64
110
  * Fix certificate tool error handling
65
111
 
66
112
  ## 3.1.6
113
+
67
114
  * Fix webpack configureation include regex
68
115
  * Templates update
69
116
 
70
117
  ## 3.1.5
118
+
71
119
  * Templates update
72
120
 
73
121
  ## 3.1.4
122
+
74
123
  * Packages update
75
124
 
76
125
  ## 3.1.3
126
+
77
127
  * Remove `@babel/polyfill`
78
128
  * Replace `webpack-visualizer-plugin` by `webpack-bundle-analyzer`
79
129
 
80
130
  ## 3.1.2
81
- * Add extensions for *.svg *.eot files to `base64-inline-loader` configuration
131
+
132
+ * Add extensions for *.svg*.eot files to `base64-inline-loader` configuration
82
133
  * Exclude `code-js` package to process by Babel
83
134
  * Include `@babel/plugin-syntax-dynamic-import` plugin for Babel
84
135
  * Update `core-js` package to version 3.x.x.
85
136
 
86
137
  ## 3.1.1
138
+
87
139
  * Add `base64-inline-loader` to load images
88
140
 
89
141
  ## pbiviz v3.1.0
142
+
90
143
  * Release. Now Webpack is default builder for Custom Visuals.
91
144
  * What’s new in powerbi-visuals-tools v3?
92
- * TypeScript v3.0.1 by default
93
- * ES6 Modules supported
94
- * New versions of D3v5 and other external libraries are supported
95
- * Reduced package size
96
- * Improved API performance
97
- * 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/).
98
-
99
- ## pbiviz v2.5.0
145
+ * TypeScript v3.0.1 by default
146
+ * ES6 Modules supported
147
+ * New versions of D3v5 and other external libraries are supported
148
+ * Reduced package size
149
+ * Improved API performance
150
+ * 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/).
151
+
152
+ ## pbiviz v2.5.0
153
+
100
154
  * Added Analytics Pane support
101
155
  Note: API v2.4.0 skipped as it does not include any public changes
102
156
 
103
157
  ## pbiviz v2.3.0
158
+
104
159
  * custom visuals now support a landing page
105
160
 
106
161
  ## pbiviz v2.2.2
162
+
107
163
  * Update package-lock.json to fix vulnerabilities
108
164
 
109
165
  ## pbiviz v2.2.1
166
+
110
167
  * Deprecated `applySelectionFilter` from `ISelectionManager`
111
168
 
112
169
  ## pbiviz v3.0.12 Beta
170
+
113
171
  * Compression option for compressing visual package
114
172
  * Fix launch webpack build triggering
115
173
  * Update powerbi-visuals-webpack-plugin to 2.1.0
116
174
 
117
175
  ## pbiviz v3.0.11 Beta
118
- * Add support to import *.css and *.less files
176
+
177
+ * Add support to import *.css and*.less files
119
178
  * Fix reloading capabilities.json
120
179
  * Resolve issue of starting dev server after copy certs from global instance
121
180
  * Serve old visual project by nodejs server instead webpack dev server
122
181
 
123
182
  ## pbiviz v3.0.10 Beta
183
+
124
184
  * Resolve dev server certificates from global instance of pbiviz.
125
185
  * Replace VisualServer.js by webpack-dev-server
126
186
 
127
187
  ## pbiviz v3.0.9 Beta
188
+
128
189
  * Set `sourceType` to "unambiguous" for babel configuration
129
190
 
130
191
  ## pbiviz v3.0.8 Beta
192
+
131
193
  * Update powerbi-visuals-webpack-plugin to 2.0.0
132
194
  * Remove minification by babel (remove `babel-preset-minify` package).
133
195
 
134
196
  ## pbiviz v3.0.7 Beta
197
+
135
198
  * Update powerbi-visuals-webpack-plugin to 1.0.15
136
199
 
137
200
  ## pbiviz v3.0.6 Beta
201
+
138
202
  * Install the latest patch of `powerbi-visuals-api`
139
203
  * The `pbiviz.json` values of visual templates overrides global template values
140
204
  * Remove unnecessary `setApiVersion` and `updateApi` from `VisualGenerator`
@@ -142,85 +206,110 @@ Note: API v2.4.0 skipped as it does not include any public changes
142
206
  * Update powerbi-visuals-plugin to version 1.0.13
143
207
 
144
208
  ## pbiviz v3.0.5 Beta
209
+
145
210
  * Prevent using define function in context of module
146
211
 
147
212
  ## pbiviz v3.0.4 Beta
213
+
148
214
  * Update powerbi-visuals-plugin to version 1.0.11
149
215
 
150
216
  ## pbiviz v3.0.3 Beta
217
+
151
218
  * Update powerbi-visuals-plugin to version 1.0.10
152
219
  * Remove jasmine-node package
153
220
 
154
221
  ## pbiviz v3.0.2 Beta
222
+
155
223
  * Tools observe changes in `pbiviz.json` and `capabilities.json` files and rebuild the visual.
156
224
  * `webpack-visualizer-plugin` replaced by `webpack-bundle-analyzer` to visualize the webpack bundle stats.
157
225
 
158
226
  ## pbiviz v3.0.1 Beta
227
+
159
228
  * Webpack based tools
160
229
 
161
- ## pbiviz v2.0.2
230
+ ## pbiviz v2.0.2
231
+
162
232
  * Skip precompilation for the visual with ES6 modules
163
233
 
164
234
  ## pbiviz v2.0.1
235
+
165
236
  * Update package.json. Fix package installation
166
237
 
167
238
  ## pbiviz v2.0.0
239
+
168
240
  * TypeScript external modules support
169
241
 
170
242
  ## pbiviz v1.12.1
171
- * Generate certificates on development server starts
243
+
244
+ * Generate certificates on development server starts
172
245
 
173
246
  ## pbiviz v1.11.3
247
+
174
248
  * Resolve PowerShell params issue on Win8.
175
249
 
176
250
  ## pbiviz v1.11.2
251
+
177
252
  * Resolve PowerShell script launching issue.
178
253
 
179
254
  ## pbiviz v1.11.1
255
+
180
256
  * Check certificate path in `--install-cert` command.
181
257
 
182
258
  ## pbiviz v1.11.0
259
+
183
260
  * Added `selectionManager.registerOnSelectCallback()` method for Report Bookmarks support
184
261
 
185
262
  ## pbiviz v1.10.2
263
+
186
264
  * Added `pbiviz --create-cert` for generating new unique certificate
187
265
 
188
266
  ## pbiviz v1.10.1
267
+
189
268
  * Increase typescript to 2.3.3 version
190
269
 
191
270
  ## pbiviz v1.10.0
271
+
192
272
  * Added ILocalizationManager
193
273
  * Upgrade dependencies
194
274
  * Added Authentication API call support
195
275
 
196
276
  ## pbiviz v1.9.0
277
+
197
278
  * Added launchUrl API call support
198
279
 
199
280
  ## pbiviz v1.8.1
281
+
200
282
  * FIX: Localization schema will be ignored if API doesn't support localization
201
283
 
202
284
  ## pbiviz v1.8.0
285
+
203
286
  * Added new type "fillRule" (gradient) support in capabilities schema
204
287
  * Added "rule" property support in capabilities schema for object properties
205
288
  * Fixed sub commands help output in "Using:" section
206
289
 
207
290
  ## pbiviz v1.7.5
208
- * Return innerHTML method for RHTML visual sample
291
+
292
+ * Return innerHTML method for RHTML visual sample
209
293
 
210
294
  ## pbiviz v1.7.4
295
+
211
296
  * Remove innerHTML method from sample visual
212
297
 
213
298
  ## pbiviz v1.7.3
214
- * Added RESJSON support
299
+
300
+ * Added RESJSON support
215
301
 
216
302
  ## pbiviz v1.7.2
303
+
217
304
  * Add name validation to pbiviz new command, restrict usage of symbols in the file visual name.
218
305
 
219
306
  ## pbiviz v1.7.1
307
+
220
308
  * Added visual name validation
221
309
  * Added auto-install npm dependencies
222
310
 
223
311
  ## pbiviz v1.6.5
312
+
224
313
  * Updated npm dependencies
225
314
  * Fixed settings generation
226
315
 
package/bin/pbiviz-new.js CHANGED
@@ -36,8 +36,7 @@ const options = process.argv;
36
36
 
37
37
  program
38
38
  .option('-f, --force', 'force creation (overwrites folder if exists)')
39
- .option('-t, --template [template]', 'use a specific template (default, table, slicer, rvisual, rhtml)')
40
- .option('--api-version [version]', 'use a specific api version (1.0.0, 1.1.0, 1.2.0, ...)');
39
+ .option('-t, --template [template]', 'use a specific template (default, table, slicer, rvisual, rhtml)');
41
40
 
42
41
  for (let i = 0; i < options.length; i++) {
43
42
  if (options[i] == '--help' || options[i] == '-h') {
@@ -64,24 +63,16 @@ if (program.force) {
64
63
  ConsoleWriter.warn('Running with force flag. Existing files will be overwritten');
65
64
  }
66
65
 
67
- if (program.apiVersion && parseFloat(program.apiVersion) < parseFloat('3.2.0')) {
68
- ConsoleWriter.error(`Visual creation failed, please use 'powerbi-visuals-api' 3.2.0 or above to build a visual.`);
69
- process.exit(9);
70
- }
71
-
72
66
  let generateOptions = {
73
67
  force: program.force,
74
- template: program.template,
75
- apiVersion: program.apiVersion
68
+ template: program.template
76
69
  };
77
70
 
78
-
79
71
  if (config.visualTemplates[generateOptions.template]) {
80
72
  new TemplateFetcher({
81
73
  force: program.force,
82
74
  templateName: generateOptions.template,
83
- visualName: visualName,
84
- apiVersion: program.apiVersion
75
+ visualName: visualName
85
76
  }).fetch();
86
77
  } else {
87
78
  VisualPackage.createVisualPackage(cwd, visualName, generateOptions).then(() => {
@@ -26,13 +26,17 @@
26
26
 
27
27
  "use strict";
28
28
 
29
- let program = require('commander');
30
- let VisualPackage = require('../lib/VisualPackage');
31
- let ConsoleWriter = require('../lib/ConsoleWriter');
32
- let WebPackWrap = require('../lib/WebPackWrap');
29
+ const program = require('commander');
30
+ const compareVersions = require("compare-versions");
31
+ const config = require('../config.json');
32
+ const VisualPackage = require('../lib/VisualPackage');
33
+ const ConsoleWriter = require('../lib/ConsoleWriter');
34
+ const WebPackWrap = require('../lib/WebPackWrap');
33
35
  const webpack = require("webpack");
34
- let CommandHelpManager = require('../lib/CommandHelpManager');
36
+ const CommandHelpManager = require('../lib/CommandHelpManager');
37
+
35
38
  let options = process.argv;
39
+ const minAPIversion = config.constants.minAPIversion;
36
40
 
37
41
  program
38
42
  .option('-t, --target [target]', 'Enable babel loader to compile JS into ES5 standart', 'es5')
@@ -59,9 +63,9 @@ if (!program.pbiviz && !program.resources) {
59
63
  }
60
64
 
61
65
  VisualPackage.loadVisualPackage(cwd).then((visualPackage) => {
62
- if (parseFloat(visualPackage.config.apiVersion) < parseFloat('3.2.0')) {
66
+ if (visualPackage.config.apiVersion && compareVersions.compare(visualPackage.config.apiVersion, minAPIversion, "<")) {
63
67
  ConsoleWriter.error(`Package wasn't created, your current API is '${visualPackage.config.apiVersion}'.
64
- Please use 'powerbi-visuals-api' 3.2.0 or above to build a visual.`);
68
+ Please use 'powerbi-visuals-api' ${minAPIversion} or above to build a visual.`);
65
69
  process.exit(9);
66
70
  }
67
71
  ConsoleWriter.info('Building visual...');
@@ -99,7 +103,7 @@ function displayCertificationRules() {
99
103
  ConsoleWriter.blank();
100
104
  ConsoleWriter.warn("Please, make sure that the visual source code matches to requirements of certification:");
101
105
  ConsoleWriter.blank();
102
- ConsoleWriter.info("Visual must use API v3.8 and above");
106
+ ConsoleWriter.info(`Visual must use API v${minAPIversion} and above`);
103
107
  ConsoleWriter.info("The project repository must:");
104
108
  ConsoleWriter.info("Include package.json and package-lock.json;");
105
109
  ConsoleWriter.info("Not include node_modules folder");
@@ -27,6 +27,8 @@
27
27
  "use strict";
28
28
 
29
29
  const program = require('commander');
30
+ const compareVersions = require("compare-versions");
31
+ const config = require('../config.json');
30
32
  const VisualPackage = require('../lib/VisualPackage');
31
33
  const WebpackDevServer = require("webpack-dev-server");
32
34
  const ConsoleWriter = require('../lib/ConsoleWriter');
@@ -36,11 +38,8 @@ const CommandHelpManager = require('../lib/CommandHelpManager');
36
38
  const fs = require('fs-extra');
37
39
  const path = require('path');
38
40
 
39
- let https = require('https');
40
- let connect = require('connect');
41
- let serveStatic = require('serve-static');
42
-
43
41
  const options = process.argv;
42
+ const minAPIversion = config.constants.minAPIversion;
44
43
 
45
44
  program
46
45
  .option('-t, --target [target]', 'Enable babel loader to compile JS into ES5 standart')
@@ -60,13 +59,14 @@ program.parse(options);
60
59
  let cwd = process.cwd();
61
60
  let server;
62
61
  VisualPackage.loadVisualPackage(cwd).then((visualPackage) => {
63
- if (parseFloat(visualPackage.config.apiVersion) < parseFloat('3.2.0')) {
62
+ if (visualPackage.config.apiVersion && compareVersions.compare(visualPackage.config.apiVersion, minAPIversion, "<")) {
64
63
  ConsoleWriter.error(`Can't start the visual because of the current API is '${visualPackage.config.apiVersion}'.
65
- Please use 'powerbi-visuals-api' 3.2.0 or above to build a visual.`);
64
+ Please use 'powerbi-visuals-api' ${minAPIversion} or above to build a visual.`);
66
65
  throw new Error(`Invalid API version.`);
67
66
  }
68
67
  new WebPackWrap().applyWebpackConfig(visualPackage, {
69
68
  devMode: true,
69
+ devtool: "source-map",
70
70
  generateResources: true,
71
71
  generatePbiviz: false,
72
72
  minifyJS: false,
@@ -74,13 +74,13 @@ VisualPackage.loadVisualPackage(cwd).then((visualPackage) => {
74
74
  target: typeof program.target === 'undefined' ? "es5" : program.target,
75
75
  devServerPort: program.port
76
76
  })
77
- .then(({ webpackConfig, oldProject }) => {
77
+ .then(({ webpackConfig }) => {
78
78
  let compiler = webpack(webpackConfig);
79
79
  ConsoleWriter.blank();
80
80
  ConsoleWriter.info('Starting server...');
81
81
  // webpack dev server serves bundle from disk instead memory
82
82
  if (program.drop) {
83
- webpackConfig.devServer.before = (app) => {
83
+ webpackConfig.devServer.onBeforeSetupMiddleware = (devServer) => {
84
84
  let setHeaders = (res) => {
85
85
  Object.getOwnPropertyNames(webpackConfig.devServer.headers)
86
86
  .forEach(property => res.header(property, webpackConfig.devServer.headers[property]));
@@ -96,54 +96,28 @@ VisualPackage.loadVisualPackage(cwd).then((visualPackage) => {
96
96
  'visual.css',
97
97
  'pbiviz.json'
98
98
  ].forEach(asset => {
99
- app.get(`${webpackConfig.devServer.publicPath}/${asset}`, function (req, res) {
99
+ devServer.app.get(`${webpackConfig.devServer.publicPath}/${asset}`, function (req, res) {
100
100
  setHeaders(res);
101
- readFile(path.join(webpackConfig.devServer.contentBase, asset), res);
101
+ readFile(path.join(webpackConfig.devServer.static.directory, asset), res);
102
102
  });
103
103
  });
104
104
  };
105
105
  }
106
- // server old project by NodeJS server, need to skip build step
107
- if (!oldProject) {
108
- server = new WebpackDevServer(compiler, {
109
- ...webpackConfig.devServer,
110
- hot: !program.drop,
111
- writeToDisk: program.drop
112
- });
113
- server.listen(webpackConfig.devServer.port, () => {
114
- ConsoleWriter.info(`Server listening on port ${webpackConfig.devServer.port}`);
115
- });
116
- } else {
117
- compiler.watch({
118
- aggregateTimeout: 1000, // wait so long for more changes
119
- poll: false, // use polling instead of native watchers
120
- ignored: /node_modules/
121
- },
122
- function (err) {
123
- if (err) {
124
- ConsoleWriter.error('Visual rebuild failed');
125
- ConsoleWriter.error(err);
126
- return;
127
- }
128
- ConsoleWriter.info('Visual rebuild completed');
129
- }
130
- );
131
- const app = connect();
132
- app.use((req, res, next) => {
133
- res.setHeader('Access-Control-Allow-Origin', '*');
134
- next();
135
- });
136
- app.use(serveStatic(webpackConfig.devServer.contentBase));
137
- app.use('/' + webpackConfig.output.publicPath, serveStatic(webpackConfig.devServer.contentBase));
138
- server = https.createServer({
139
- pfx: webpackConfig.devServer.https.pfx,
140
- cert: webpackConfig.devServer.https.cert,
141
- key: webpackConfig.devServer.https.key,
142
- passphrase: webpackConfig.devServer.https.passphrase
143
- }, app).listen(webpackConfig.devServer, () => {
144
- ConsoleWriter.info(`Server listening on port ${webpackConfig.devServer.port}`);
145
- });
146
- }
106
+
107
+ server = new WebpackDevServer({
108
+ ...webpackConfig.devServer,
109
+ client: false,
110
+ hot: false,
111
+ devMiddleware: {
112
+ writeToDisk: true
113
+ }
114
+ }, compiler);
115
+
116
+ (async () => {
117
+ await server.start();
118
+ ConsoleWriter.info(`Server listening on port ${webpackConfig.devServer.port}`);
119
+ })();
120
+
147
121
  })
148
122
  .catch(e => {
149
123
  ConsoleWriter.error(e.message);
package/bin/pbiviz.js CHANGED
@@ -41,7 +41,6 @@ program
41
41
  .command('info', 'Display info about the current visual')
42
42
  .command('start', 'Start the current visual')
43
43
  .command('package', 'Package the current visual into a pbiviz file')
44
- .command('update [version]', 'Updates the api definitions and schemas in the current visual. Changes the version if specified')
45
44
  .option('--install-cert', 'Creates and installs localhost certificate', onOpenCertFile);
46
45
 
47
46
  //prepend logo to help screen
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"},"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":"9163565813320611"},"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":"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;
@@ -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 "certutil -p ${passphrase} -dump ${pfxPath}"`);
393
- let regex = /(?<=NotAfter: ).*$/gm;
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 = 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 {