From 4d0ce0b6bfe6f2780c3cddc626551af25ebb6b78 Mon Sep 17 00:00:00 2001 From: kullJul <86924383+kullJul@users.noreply.github.com> Date: Fri, 10 Jul 2026 18:14:12 +0200 Subject: [PATCH 1/4] Add check for leading zeros in version --- spec/unit/FeatureManagerSpec.js | 44 ++++++++++++++++++++++- src/Visual.ts | 4 +++ src/features/VisualVersionLeadingZeros.ts | 16 +++++++++ src/features/index.ts | 3 +- 4 files changed, 65 insertions(+), 2 deletions(-) create mode 100644 src/features/VisualVersionLeadingZeros.ts diff --git a/spec/unit/FeatureManagerSpec.js b/spec/unit/FeatureManagerSpec.js index 13dbfd90..9958cf3d 100644 --- a/spec/unit/FeatureManagerSpec.js +++ b/spec/unit/FeatureManagerSpec.js @@ -36,7 +36,7 @@ const config = await readJsonFromRoot('config.json'); describe("Features", () => { describe("Visual", () => { - const { APIVersion, VisualVersion, AuthorInfo } = features; + const { APIVersion, VisualVersion, VisualVersionLeadingZeros, AuthorInfo } = features; it("Should support API Version", () => { const Visual = { doesAPIVersionMatch: (minVersion) => { @@ -58,6 +58,48 @@ describe("Features", () => { expect(VisualVersion.isSupported(Visual)).toBeTrue; }); + describe("VisualVersionLeadingZeros", () => { + it("Should support when version has no leading zeros", () => { + const capabilities = {}; + const visualConfig = { + visual: { version: "1.16.345.1" }, + apiVersion: "5.3.0" + }; + const visual = new Visual(capabilities, visualConfig); + expect(VisualVersionLeadingZeros.isSupported(visual)).toBeTrue(); + }); + + it("Should support when version parts are single zeros", () => { + const capabilities = {}; + const visualConfig = { + visual: { version: "1.0.0.0" }, + apiVersion: "5.3.0" + }; + const visual = new Visual(capabilities, visualConfig); + expect(VisualVersionLeadingZeros.isSupported(visual)).toBeTrue(); + }); + + it("Should not support when a version part has a leading zero", () => { + const capabilities = {}; + const visualConfig = { + visual: { version: "1.16.0345.1" }, + apiVersion: "5.3.0" + }; + const visual = new Visual(capabilities, visualConfig); + expect(VisualVersionLeadingZeros.isSupported(visual)).toBeFalse(); + }); + + it("Should not support when multiple version parts have leading zeros", () => { + const capabilities = {}; + const visualConfig = { + visual: { version: "01.02.03.04" }, + apiVersion: "5.3.0" + }; + const visual = new Visual(capabilities, visualConfig); + expect(VisualVersionLeadingZeros.isSupported(visual)).toBeFalse(); + }); + }); + describe("AuthorInfo", () => { it("Should support when author object is defined", () => { const capabilities = {}; diff --git a/src/Visual.ts b/src/Visual.ts index 343ba7d4..f94a1a97 100644 --- a/src/Visual.ts +++ b/src/Visual.ts @@ -22,6 +22,10 @@ export class Visual { return this.visualVersion.split(".").length === length } + public hasVisualVersionLeadingZeros() { + return this.visualVersion.split(".").some(part => /^0\d+/.test(part)); + } + public isAuthorDefined() { const author = this.config?.author; const emailRegex = /^[a-zA-Z0-9._%+\-]+@[a-zA-Z0-9.\-]+\.[a-zA-Z]{2,}$/; diff --git a/src/features/VisualVersionLeadingZeros.ts b/src/features/VisualVersionLeadingZeros.ts new file mode 100644 index 00000000..0eb194cc --- /dev/null +++ b/src/features/VisualVersionLeadingZeros.ts @@ -0,0 +1,16 @@ +import { Visual } from "../Visual.js"; +import BaseFeature from "./BaseFeature.js"; +import { Severity, Stage, VisualFeatureType } from "./FeatureTypes.js"; + +export default class VisualVersionLeadingZeros implements BaseFeature { + public static featureName = "Visual version leading zeros" + public static errorMessage = `${this.featureName} - version parts must not contain leading zeros (e.g. use 1.16.345.1 instead of 1.16.0345.1). Update the pbiviz.json file. Versions with leading zeros are rejected by the Power BI marketplace package acceptance check.` + public static severity = Severity.Warning + public static stage = Stage.PreBuild + public static visualFeatureType = VisualFeatureType.All + public static certificationRequired = true + + static isSupported(visual: Visual) { + return !visual.hasVisualVersionLeadingZeros() + } +} diff --git a/src/features/index.ts b/src/features/index.ts index b3546611..e60ea9d7 100644 --- a/src/features/index.ts +++ b/src/features/index.ts @@ -26,6 +26,7 @@ import TotalSubTotal from './TotalSubTotal.js' import WarningIcon from './WarningIcon.js' import APIVersion from './APIVersion.js' import VisualVersion from './VisualVersion.js' +import VisualVersionLeadingZeros from './VisualVersionLeadingZeros.js' export { AdvancedEditMode, AllowInteractions, AnalyticsPane, Bookmarks, @@ -34,5 +35,5 @@ export { HighlightData, KeyboardNavigation, LandingPage, LaunchURL, Localizations, LocalStorage, ModalDialog, RenderingEvents, SelectionAcrossVisuals, SyncSlicer, Tooltips, TotalSubTotal, - WarningIcon, APIVersion, VisualVersion, AuthorInfo + WarningIcon, APIVersion, VisualVersion, VisualVersionLeadingZeros, AuthorInfo } \ No newline at end of file From c2892a0f1bc24b84ed6895551a0a68f0489c80f4 Mon Sep 17 00:00:00 2001 From: kullJul <86924383+kullJul@users.noreply.github.com> Date: Mon, 13 Jul 2026 09:28:00 +0200 Subject: [PATCH 2/4] Bump version --- Changelog.md | 3 +++ package-lock.json | 4 ++-- package.json | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Changelog.md b/Changelog.md index 03adf3f9..478a02a6 100644 --- a/Changelog.md +++ b/Changelog.md @@ -2,6 +2,9 @@ This page contains information about changes to the PowerBI Visual Tools (pbiviz). +## 7.1.2 +* Added a pre-build validation that warns when the visual version contains parts with leading zeros (rejected by the Power BI marketplace package acceptance check). + ## 7.1.1 * Minor documentation and metadata updates. diff --git a/package-lock.json b/package-lock.json index b301dc76..337d31cb 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "powerbi-visuals-tools", - "version": "7.1.1", + "version": "7.1.2", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "powerbi-visuals-tools", - "version": "7.1.1", + "version": "7.1.2", "license": "MIT", "dependencies": { "@modelcontextprotocol/sdk": "^1.25.3", diff --git a/package.json b/package.json index 336de22f..9f45ef5a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "powerbi-visuals-tools", - "version": "7.1.1", + "version": "7.1.2", "description": "Command line tool for creating and publishing visuals for Power BI", "main": "./bin/pbiviz.js", "type": "module", From 013611cd16972231e9e4cb5034db712895153ef6 Mon Sep 17 00:00:00 2001 From: kullJul <86924383+kullJul@users.noreply.github.com> Date: Tue, 14 Jul 2026 17:23:16 +0200 Subject: [PATCH 3/4] Use Error severity level, bump version --- Changelog.md | 2 +- package-lock.json | 4 ++-- package.json | 2 +- src/features/VisualVersionLeadingZeros.ts | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Changelog.md b/Changelog.md index 6a5b3d5d..c641f7b2 100644 --- a/Changelog.md +++ b/Changelog.md @@ -2,7 +2,7 @@ This page contains information about changes to the PowerBI Visual Tools (pbiviz). ## 7.1.2 -* Added a pre-build validation that warns when the visual version contains parts with leading zeros (rejected by the Power BI marketplace package acceptance check). +* Added a pre-build validation that fails with an error when the visual version contains parts with leading zeros (rejected by the Power BI marketplace package acceptance check). ## 7.1.2 * Npm audit fixes. diff --git a/package-lock.json b/package-lock.json index f7e79546..d98a6569 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "powerbi-visuals-tools", - "version": "7.1.2", + "version": "7.2.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "powerbi-visuals-tools", - "version": "7.1.2", + "version": "7.2.0", "license": "MIT", "dependencies": { "@modelcontextprotocol/sdk": "^1.25.3", diff --git a/package.json b/package.json index 9f45ef5a..90ccd920 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "powerbi-visuals-tools", - "version": "7.1.2", + "version": "7.2.0", "description": "Command line tool for creating and publishing visuals for Power BI", "main": "./bin/pbiviz.js", "type": "module", diff --git a/src/features/VisualVersionLeadingZeros.ts b/src/features/VisualVersionLeadingZeros.ts index 0eb194cc..6f700822 100644 --- a/src/features/VisualVersionLeadingZeros.ts +++ b/src/features/VisualVersionLeadingZeros.ts @@ -4,8 +4,8 @@ import { Severity, Stage, VisualFeatureType } from "./FeatureTypes.js"; export default class VisualVersionLeadingZeros implements BaseFeature { public static featureName = "Visual version leading zeros" - public static errorMessage = `${this.featureName} - version parts must not contain leading zeros (e.g. use 1.16.345.1 instead of 1.16.0345.1). Update the pbiviz.json file. Versions with leading zeros are rejected by the Power BI marketplace package acceptance check.` - public static severity = Severity.Warning + public static errorMessage = `${this.featureName} - version parts must not contain leading zeros (e.g. use 1.2.3.4 instead of 1.2.03.4). Update the pbiviz.json file. Versions with leading zeros are rejected by the Power BI marketplace package acceptance check.` + public static severity = Severity.Error public static stage = Stage.PreBuild public static visualFeatureType = VisualFeatureType.All public static certificationRequired = true From 1883126ad3caf9b5cdeb4ac4999cb2deccb54f21 Mon Sep 17 00:00:00 2001 From: kullJul <86924383+kullJul@users.noreply.github.com> Date: Tue, 14 Jul 2026 17:43:16 +0200 Subject: [PATCH 4/4] Update changelog --- Changelog.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Changelog.md b/Changelog.md index c641f7b2..18e75a87 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,7 +1,7 @@ # Change Log - PowerBI Visual Tools (pbiviz) This page contains information about changes to the PowerBI Visual Tools (pbiviz). -## 7.1.2 +## 7.2.0 * Added a pre-build validation that fails with an error when the visual version contains parts with leading zeros (rejected by the Power BI marketplace package acceptance check). ## 7.1.2