Skip to content

Commit

Permalink
refactor!: remove BpmnVisualization.getVersion
Browse files Browse the repository at this point in the history
This method was deprecated in 0.43.0 and replaced by the `getVersion` function.

BREAKING CHANGES: The `BpmnVisualization.getVersion` method is now removed. Use the `getVersion` function instead.
  • Loading branch information
tbouffard committed Dec 17, 2024
1 parent ef24b98 commit 7e28698
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 35 deletions.
9 changes: 0 additions & 9 deletions src/component/BpmnVisualization.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import { Navigation } from './navigation';
import { newBpmnParser } from './parser/BpmnParser';
import { createNewBpmnElementsRegistry } from './registry/bpmn-elements-registry';
import { BpmnModelRegistry } from './registry/bpmn-model-registry';
import { getVersion, type Version } from './version';

/**
* Let initialize `bpmn-visualization`. It requires at minimum to pass the HTMLElement in the page where the BPMN diagram is rendered.
Expand Down Expand Up @@ -95,12 +94,4 @@ export class BpmnVisualization {
const renderedModel = this.bpmnModelRegistry.load(bpmnModel, options?.modelFilter);
newBpmnRenderer(this.graph, this.rendererOptions).render(renderedModel, options?.fit);
}

/**
* Returns the version of `bpmn-visualization` and the version of its dependencies.
* @deprecated As of `0.43.0`, use {@link getVersion} instead. This method will be removed in `0.45.0`.
*/
getVersion(): Version {
return getVersion();
}
}
26 changes: 0 additions & 26 deletions test/integration/BpmnVisualization.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,26 +65,6 @@ describe('BpmnVisualization API', () => {
});
});

// Note: the tests here are duplicated with test/unit/component/version.test.ts
// They will be removed when the deprecated `BpmnVisualization.getVersion` method is removed
describe('Version', () => {
it('lib version', () => {
expect(bpmnVisualization.getVersion().lib).toBe(getLibraryVersionFromPackageJson());
});
it('mxGraph version', () => {
expect(bpmnVisualization.getVersion().dependencies.get('mxGraph')).toBeDefined();
});
it('not modifiable version', () => {
const initialVersion = bpmnVisualization.getVersion();
initialVersion.lib = 'set by test';
initialVersion.dependencies.set('extra', 'added in test');

const newVersion = bpmnVisualization.getVersion();
expect(newVersion.lib).not.toBe(initialVersion.lib);
expect(newVersion.dependencies).not.toBe(initialVersion.dependencies);
});
});

// The API should not fail
describe('Registry access when no loaded diagram', () => {
const bv = initializeBpmnVisualizationWithContainerId('bpmn-no-loaded-diagram');
Expand Down Expand Up @@ -114,9 +94,3 @@ describe('BpmnVisualization API', () => {
});
});
});

function getLibraryVersionFromPackageJson(): string {
const json = readFileSync('../../package.json');
const packageJson = JSON.parse(json);
return packageJson.version;
}

0 comments on commit 7e28698

Please sign in to comment.