powerbi-visuals-tools 5.3.0 → 5.4.1

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/Changelog.md CHANGED
@@ -2,6 +2,13 @@
2
2
 
3
3
  This page contains information about changes to the PowerBI Visual Tools (pbiviz).
4
4
 
5
+ ## 5.4.1
6
+ * Updated R-based visuals settings.ts file to work properly with the new API
7
+
8
+ ## 5.4.0
9
+ * Updated packages
10
+ * New command `pbiviz lint` to run lint check from tools. It'll use eslintrc file from the root of the visual, if there is no such file, recommended one will be used instead.
11
+
5
12
  ## 5.3.0
6
13
  * Updated packages
7
14
  * Updated to Typescript 5.0 **⚠**
package/bin/pbiviz.js CHANGED
@@ -69,6 +69,13 @@ pbiviz
69
69
  CommandManager.installCert();
70
70
  });
71
71
 
72
+ pbiviz
73
+ .command('lint')
74
+ .option('--fix', 'Enable autofixing of lint errors')
75
+ .action(options => {
76
+ CommandManager.lint({ ...options, verbose: true }, rootPath);
77
+ });
78
+
72
79
  pbiviz
73
80
  .command('start')
74
81
  .usage('[options]')
@@ -92,6 +99,7 @@ pbiviz
92
99
  .option('--skip-api', "Skips powerbi-visuals-api verifying")
93
100
  .option('-l, --all-locales', "Keeps all locale files in the package. By default only used inside stringResources folder locales are included.")
94
101
  .option('-v, --verbose', "Enables verbose logging")
102
+ .option('--fix', 'Enable autofixing of lint errors')
95
103
  .option('-p, --pbiviz-file <pbiviz-file>', "Path to pbiviz.json file (useful for debugging)", pbivizFile)
96
104
  .addOption(new Option('-c, --compression <compressionLevel>', "Enables compression of visual package")
97
105
  .choices(['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'])
@@ -1,28 +1,28 @@
1
1
  -----BEGIN PRIVATE KEY-----
2
- MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCx/HmkjsM35nQ+
3
- lxhUgadUKwZdhluu7yD34plxV/6Jbzu/1uux2TL5+UmRpvC6TWuiC6FUMIJSr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dn8HEf75kxz+QcYIeD9DS4SRFW
14
+ 93FvbLWIC+l9acXFrgNCN17+r2wzIKQ3NbORiaPi6WRcNd6h8fYTU3EgsC+Wm9EF
15
+ MeRxgscOuZVx3gcib6BP6Q1wWL4VdqDKApoN3IOX/rOQNdFckn48XGLxTfQCJWtL
16
+ 5J1jWaqf2H0eSSuDXbHINOA6WRNLaMKUAc0Po4zl5lxfRCSUI3M1SHgaaYtdSNKy
17
+ fhyKYhkIOuc3zlwVOfr6gK0NwMasuvPpYIYiM+re2IIfvhSpPs7iEVueZmWUXYUV
18
+ mr1gzRPv5N321GdYuw==
19
19
  -----END CERTIFICATE-----
package/config.json CHANGED
@@ -16,7 +16,6 @@
16
16
  },
17
17
  "package": { "dropFolder": "dist" },
18
18
  "server": {
19
- "root": "webRoot",
20
19
  "assetsRoute": "/assets",
21
20
  "privateKey": "certs/PowerBICustomVisualTest_private.key",
22
21
  "certificate": "certs/PowerBICustomVisualTest_public.crt",
@@ -23,6 +23,12 @@ export default class CommandManager {
23
23
  .initializeWebpack(webpackOptions);
24
24
  visualManager.startWebpackServer(options.drop);
25
25
  }
26
+ static async lint(options, rootPath) {
27
+ const visualManager = new VisualManager(rootPath);
28
+ await visualManager
29
+ .prepareVisual()
30
+ .runLintValidation(options);
31
+ }
26
32
  static async package(options, rootPath) {
27
33
  if (!options.pbiviz && !options.resources) {
28
34
  ConsoleWriter.error('Nothing to build. Cannot use --no-pbiviz without --resources');
@@ -40,9 +46,13 @@ export default class CommandManager {
40
46
  allLocales: options.allLocales,
41
47
  pbivizFile: options.pbivizFile,
42
48
  };
43
- new VisualManager(rootPath)
44
- .prepareVisual(options.pbivizFile)
45
- .validateVisual(options.verbose)
49
+ const lintOptions = {
50
+ verbose: options.verbose,
51
+ fix: options.fix,
52
+ };
53
+ const visual = new VisualManager(rootPath).prepareVisual(options.pbivizFile);
54
+ await visual.runLintValidation(lintOptions);
55
+ visual.validateVisual(options.verbose)
46
56
  .initializeWebpack(webpackOptions)
47
57
  .then(visualManager => visualManager.generatePackage(options.verbose));
48
58
  }
@@ -0,0 +1,78 @@
1
+ import { ESLint } from "eslint";
2
+ import ConsoleWriter from "./ConsoleWriter.js";
3
+ import { fileExists, getRootPath } from "./utils.js";
4
+ export class LintValidator {
5
+ visualPath;
6
+ rootPath;
7
+ config;
8
+ defaultConfig;
9
+ linterInstance;
10
+ constructor(fix = false) {
11
+ this.visualPath = process.cwd();
12
+ this.rootPath = getRootPath();
13
+ this.prepareConfig(fix);
14
+ this.linterInstance = new ESLint(this.config);
15
+ }
16
+ /**
17
+ * Runs lint validation in the visual folder
18
+ */
19
+ async runLintValidation({ verbose, fix }) {
20
+ ConsoleWriter.info("Running lint check...");
21
+ // By default it will lint all files in the src of current working directory, but some files can be excluded in .eslintignore
22
+ const results = await this.linterInstance.lintFiles("src/**/*");
23
+ if (fix) {
24
+ await this.fixErrors(results);
25
+ }
26
+ await this.outputResults(results, verbose);
27
+ ConsoleWriter.info("Lint check completed.");
28
+ }
29
+ async fixErrors(results) {
30
+ ConsoleWriter.info("Lint fixing errors...");
31
+ await ESLint.outputFixes(results);
32
+ }
33
+ async outputResults(results, verbose) {
34
+ if (verbose) {
35
+ const formatter = await this.linterInstance.loadFormatter("stylish");
36
+ const formattedResults = await formatter.format(results);
37
+ console.log(formattedResults);
38
+ }
39
+ else {
40
+ const filteredResults = ESLint.getErrorResults(results);
41
+ // get total amount of errors and warnings in all elements of filteredResults
42
+ const totalErrors = filteredResults.reduce((acc, curr) => acc + curr.errorCount, 0);
43
+ const totalWarnings = filteredResults.reduce((acc, curr) => acc + curr.warningCount, 0);
44
+ if (totalErrors > 0 || totalWarnings > 0) {
45
+ ConsoleWriter.error(`Linter found ${totalErrors} errors and ${totalWarnings} warnings. Run with --verbose flag to see details.`);
46
+ }
47
+ }
48
+ }
49
+ prepareConfig(fix) {
50
+ this.defaultConfig = {
51
+ overrideConfig: {
52
+ env: {
53
+ browser: true,
54
+ es6: true,
55
+ es2022: true
56
+ },
57
+ plugins: [
58
+ "powerbi-visuals"
59
+ ],
60
+ extends: [
61
+ "plugin:powerbi-visuals/recommended"
62
+ ]
63
+ },
64
+ extensions: [".ts", ".tsx"],
65
+ resolvePluginsRelativeTo: this.rootPath,
66
+ useEslintrc: false,
67
+ fix
68
+ };
69
+ const eslintrcExtensions = ['.json', '.js', '.ts'];
70
+ if (eslintrcExtensions.some(el => fileExists(this.visualPath, `.eslintrc${el}`))) {
71
+ this.config = { fix };
72
+ }
73
+ else {
74
+ ConsoleWriter.warning("No .eslintrc file found in the visual folder. Using default config.");
75
+ this.config = this.defaultConfig;
76
+ }
77
+ }
78
+ }
package/lib/Visual.js CHANGED
@@ -4,21 +4,16 @@ export class Visual {
4
4
  visualFeatureType;
5
5
  capabilities;
6
6
  config;
7
- packageJSON;
8
7
  visualVersion;
9
- constructor(capabilities, config, packageJson) {
8
+ constructor(capabilities, config) {
10
9
  this.capabilities = capabilities;
11
10
  this.config = config;
12
11
  this.visualFeatureType = this.getVisualFeatureType();
13
- this.packageJSON = packageJson;
14
12
  this.visualVersion = config.visual.version;
15
13
  }
16
14
  doesAPIVersionMatch(minAPIversion) {
17
15
  return compareVersions(this.config.apiVersion ?? minAPIversion, minAPIversion) !== -1;
18
16
  }
19
- doesESLlintSupported() {
20
- return Object.entries(this.packageJSON.scripts).some(([, value]) => value.includes("eslint"));
21
- }
22
17
  isVisualVersionValid(length) {
23
18
  return this.visualVersion.split(".").length === length;
24
19
  }
@@ -38,6 +38,7 @@ import { Visual } from "./Visual.js";
38
38
  import { FeatureManager, Status } from "./FeatureManager.js";
39
39
  import { Severity, Stage } from "./features/FeatureTypes.js";
40
40
  import TemplateFetcher from "./TemplateFetcher.js";
41
+ import { LintValidator } from "./LintValidator.js";
41
42
  const globalConfig = readJsonFromRoot('config.json');
42
43
  const PBIVIZ_FILE = 'pbiviz.json';
43
44
  /**
@@ -67,10 +68,13 @@ export default class VisualManager {
67
68
  }
68
69
  return this;
69
70
  }
71
+ runLintValidation(options) {
72
+ const linter = new LintValidator(options.fix);
73
+ linter.runLintValidation(options);
74
+ }
70
75
  createVisualInstance() {
71
76
  this.capabilities = readJsonFromVisual("capabilities.json", this.basePath);
72
- const packageJSON = readJsonFromVisual("package.json", this.basePath);
73
- this.visual = new Visual(this.capabilities, this.pbivizConfig, packageJSON);
77
+ this.visual = new Visual(this.capabilities, this.pbivizConfig);
74
78
  }
75
79
  async initializeWebpack(webpackOptions) {
76
80
  const webpackWrap = new WebpackWrap();
@@ -87,6 +91,9 @@ export default class VisualManager {
87
91
  };
88
92
  this.compiler.run(callback);
89
93
  }
94
+ /**
95
+ * Starts webpack server
96
+ */
90
97
  startWebpackServer(generateDropFiles = false) {
91
98
  ConsoleWriter.blank();
92
99
  ConsoleWriter.info('Starting server...');
@@ -114,6 +121,9 @@ export default class VisualManager {
114
121
  process.exit(1);
115
122
  }
116
123
  }
124
+ /**
125
+ * Validates the visual code
126
+ */
117
127
  validateVisual(verbose = false) {
118
128
  this.featureManager = new FeatureManager();
119
129
  const { status, logs } = this.featureManager.validate(Stage.PreBuild, this.visual);
@@ -123,11 +133,17 @@ export default class VisualManager {
123
133
  }
124
134
  return this;
125
135
  }
136
+ /**
137
+ * Validates the visual package
138
+ */
126
139
  validatePackage() {
127
140
  const featureManager = new FeatureManager();
128
141
  const { logs } = featureManager.validate(Stage.PostBuild, this.package);
129
142
  return logs;
130
143
  }
144
+ /**
145
+ * Outputs the results of the validation
146
+ */
131
147
  outputResults({ errors, deprecation, warnings, info }, verbose) {
132
148
  const headerMessage = {
133
149
  error: `Visual doesn't support some features required for all custom visuals:`,
@@ -144,6 +160,9 @@ export default class VisualManager {
144
160
  const infoLogs = (!info.length || verbose) ? info : [verboseSuggestion];
145
161
  this.outputLogsWithHeadMessage(headerInfoMessage, infoLogs, Severity.Info);
146
162
  }
163
+ /**
164
+ * Displays visual info
165
+ */
147
166
  displayInfo() {
148
167
  if (this.pbivizConfig) {
149
168
  ConsoleWriter.infoTable(this.pbivizConfig);
@@ -153,7 +172,7 @@ export default class VisualManager {
153
172
  }
154
173
  }
155
174
  /**
156
- * Creates a new visual package
175
+ * Creates a new visual
157
176
  */
158
177
  static async createVisual(rootPath, visualName, generateOptions) {
159
178
  ConsoleWriter.info('Creating new visual');
@@ -24,6 +24,5 @@ import Tooltips from './Tooltips.js';
24
24
  import TotalSubTotal from './TotalSubTotal.js';
25
25
  import WarningIcon from './WarningIcon.js';
26
26
  import APIVersion from './APIVersion.js';
27
- import ESLint from './ESLint.js';
28
27
  import VisualVersion from './VisualVersion.js';
29
- export { AdvancedEditMode, AllowInteractions, AnalyticsPane, Bookmarks, ColorPalette, ConditionalFormatting, ContextMenu, DrillDown, FetchMoreData, FileDownload, FormatPane, HighContrast, HighlightData, KeyboardNavigation, LandingPage, LaunchURL, Localizations, LocalStorage, ModalDialog, RenderingEvents, SelectionAcrossVisuals, SyncSlicer, Tooltips, TotalSubTotal, WarningIcon, APIVersion, ESLint, VisualVersion };
28
+ export { AdvancedEditMode, AllowInteractions, AnalyticsPane, Bookmarks, ColorPalette, ConditionalFormatting, ContextMenu, DrillDown, FetchMoreData, FileDownload, FormatPane, HighContrast, HighlightData, KeyboardNavigation, LandingPage, LaunchURL, Localizations, LocalStorage, ModalDialog, RenderingEvents, SelectionAcrossVisuals, SyncSlicer, Tooltips, TotalSubTotal, WarningIcon, APIVersion, VisualVersion };
package/lib/utils.js CHANGED
@@ -31,3 +31,6 @@ export function readJsonFromRoot(filePath) {
31
31
  export function readJsonFromVisual(filePath, visualPath) {
32
32
  return JSON.parse(fs.readFileSync(path.join(visualPath ?? process.cwd(), filePath), "utf8"));
33
33
  }
34
+ export function fileExists(pathToFile, fileName) {
35
+ return fs.existsSync(path.join(pathToFile, fileName));
36
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "powerbi-visuals-tools",
3
- "version": "5.3.0",
3
+ "version": "5.4.1",
4
4
  "description": "Command line tool for creating and publishing visuals for Power BI",
5
5
  "main": "./bin/pbiviz.js",
6
6
  "type": "module",
@@ -29,7 +29,7 @@
29
29
  },
30
30
  "homepage": "https://github.com/Microsoft/PowerBI-visuals-tools#readme",
31
31
  "dependencies": {
32
- "@typescript-eslint/parser": "^6.12.0",
32
+ "@typescript-eslint/parser": "^6.17.0",
33
33
  "assert": "^2.1.0",
34
34
  "async": "^3.2.5",
35
35
  "browserify-zlib": "^0.2.0",
@@ -41,16 +41,16 @@
41
41
  "constants-browserify": "^1.0.0",
42
42
  "crypto-browserify": "^3.12.0",
43
43
  "css-loader": "^6.8.1",
44
- "domain-browser": "^5.4.0",
44
+ "domain-browser": "^5.7.0",
45
45
  "events": "^3.3.0",
46
46
  "extra-watch-webpack-plugin": "^1.0.3",
47
- "fs-extra": "^11.1.1",
47
+ "fs-extra": "^11.2.0",
48
48
  "https-browserify": "^1.0.0",
49
49
  "inline-source-map": "^0.6.2",
50
50
  "json-loader": "0.5.7",
51
51
  "jszip": "^3.10.1",
52
52
  "less": "^4.2.0",
53
- "less-loader": "^11.1.3",
53
+ "less-loader": "^11.1.4",
54
54
  "lodash.clonedeep": "4.5.0",
55
55
  "lodash.defaults": "4.2.0",
56
56
  "lodash.isequal": "4.5.0",
@@ -62,11 +62,11 @@
62
62
  "process": "^0.11.10",
63
63
  "punycode": "^2.3.1",
64
64
  "querystring-es3": "^0.2.1",
65
- "readable-stream": "^4.4.2",
65
+ "readable-stream": "^4.5.2",
66
66
  "stream-browserify": "^3.0.0",
67
67
  "stream-http": "^3.2.0",
68
68
  "string_decoder": "^1.3.0",
69
- "terser-webpack-plugin": "^5.3.9",
69
+ "terser-webpack-plugin": "^5.3.10",
70
70
  "timers-browserify": "^2.0.12",
71
71
  "ts-loader": "^9.5.1",
72
72
  "tty-browserify": "^0.0.1",
@@ -79,8 +79,8 @@
79
79
  "webpack-dev-server": "^4.15.1"
80
80
  },
81
81
  "devDependencies": {
82
- "@typescript-eslint/eslint-plugin": "^6.12.0",
83
- "eslint": "^8.54.0",
82
+ "@typescript-eslint/eslint-plugin": "^6.17.0",
83
+ "eslint": "^8.56.0",
84
84
  "eslint-plugin-powerbi-visuals": "^0.8.1",
85
85
  "jasmine": "5.1.0",
86
86
  "jasmine-spec-reporter": "7.0.0",
@@ -6,8 +6,7 @@
6
6
  "type": "chrome",
7
7
  "request": "attach",
8
8
  "port": 9222,
9
- "sourceMaps": true,
10
- "webRoot": "${cwd}/"
9
+ "sourceMaps": true
11
10
  }
12
11
  ]
13
12
  }
@@ -31,14 +31,24 @@ import { formattingSettings } from "powerbi-visuals-utils-formattingmodel";
31
31
  import FormattingSettingsCard = formattingSettings.SimpleCard;
32
32
  import FormattingSettingsSlice = formattingSettings.Slice;
33
33
  import FormattingSettingsModel = formattingSettings.Model;
34
-
34
+ import TextInput = formattingSettings.TextInput;
35
35
 
36
36
  /**
37
37
  * RCV Script Formatting Card
38
38
  */
39
39
  class rcvScriptCardSettings extends FormattingSettingsCard {
40
- provider: FormattingSettingsSlice = undefined;
41
- source: FormattingSettingsSlice = undefined;
40
+ provider: FormattingSettingsSlice = new TextInput({
41
+ name: "provider",
42
+ displayName: "Provider",
43
+ value: undefined,
44
+ placeholder: "Provider"
45
+ });
46
+ source: FormattingSettingsSlice = new TextInput({
47
+ name: "source",
48
+ displayName: "Source",
49
+ value: undefined,
50
+ placeholder: "Source"
51
+ });
42
52
 
43
53
  name: string = "rcv_script";
44
54
  displayName: string = "rcv_script";
@@ -46,8 +56,7 @@ class rcvScriptCardSettings extends FormattingSettingsCard {
46
56
  }
47
57
 
48
58
  /**
49
- * visual settings model class
50
- *
59
+ * Visual settings model class
51
60
  */
52
61
  export class VisualFormattingSettingsModel extends FormattingSettingsModel {
53
62
  // Create formatting settings model formatting cards
@@ -31,14 +31,24 @@ import { formattingSettings } from "powerbi-visuals-utils-formattingmodel";
31
31
  import FormattingSettingsCard = formattingSettings.SimpleCard;
32
32
  import FormattingSettingsSlice = formattingSettings.Slice;
33
33
  import FormattingSettingsModel = formattingSettings.Model;
34
-
34
+ import TextInput = formattingSettings.TextInput;
35
35
 
36
36
  /**
37
37
  * RCV Script Formatting Card
38
38
  */
39
39
  class rcvScriptCardSettings extends FormattingSettingsCard {
40
- provider: FormattingSettingsSlice = undefined;
41
- source: FormattingSettingsSlice = undefined;
40
+ provider: FormattingSettingsSlice = new TextInput({
41
+ name: "provider",
42
+ displayName: "Provider",
43
+ value: undefined,
44
+ placeholder: "Provider"
45
+ });
46
+ source: FormattingSettingsSlice = new TextInput({
47
+ name: "source",
48
+ displayName: "Source",
49
+ value: undefined,
50
+ placeholder: "Source"
51
+ });
42
52
 
43
53
  name: string = "rcv_script";
44
54
  displayName: string = "rcv_script";
@@ -46,8 +56,7 @@ class rcvScriptCardSettings extends FormattingSettingsCard {
46
56
  }
47
57
 
48
58
  /**
49
- * visual settings model class
50
- *
59
+ * Visual settings model class
51
60
  */
52
61
  export class VisualFormattingSettingsModel extends FormattingSettingsModel {
53
62
  // Create formatting settings model formatting cards
@@ -1,12 +0,0 @@
1
- import { Severity, Stage, VisualFeatureType } from "./FeatureTypes.js";
2
- export default class ESLint {
3
- static featureName = "ESLint";
4
- static documentationLink = "https://github.com/microsoft/eslint-plugin-powerbi-visuals";
5
- static severity = Severity.Warning;
6
- static stage = Stage.PreBuild;
7
- static visualFeatureType = VisualFeatureType.All;
8
- static errorMessage = `${this.featureName} - ${this.documentationLink}`;
9
- static isSupported(visual) {
10
- return visual.doesESLlintSupported();
11
- }
12
- }
Binary file
@@ -1,34 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <title>PowerBI Custom Visual</title>
5
- <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.3/jquery.min.js"></script>
6
- <script src="/assets/visual.js"></script>
7
- <link rel="stylesheet" href="/assets/visual.css">
8
- </head>
9
- <body>
10
- <div id="visual" style="width: 500px; height: 500px; background: white; margin: 0;"></div>
11
-
12
-
13
- <script>
14
- var plugin, plugins = powerbi.visuals.plugins;
15
-
16
- for(var key in plugins) {
17
- plugin = plugins[key];
18
- }
19
- console.log('plugin', plugin.name);
20
- var visual = plugin.create();
21
- console.log('visual', visual);
22
- visual.init({
23
- element: $('#visual'),
24
- viewport: {
25
- width:500,
26
- height:500
27
- }
28
- });
29
- setInterval(function(){
30
- visual.update({dataView:Math.round(Math.random()*1000)})
31
- },500)
32
- </script>
33
- </body>
34
- </html>