Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ They had been made public by mistake, and had been considered internal since the
- `stringUtils.getStringValue`
- `Client.isBrowserSupported` has been removed. It didn't correctly validate all prerequisites required to know if the browser supports maxGraph.
So, remove it without replacement.
- `Client.VERSION` moved to `constants.VERSION`. VERSION is supposed to be immutable as it represents the actual version of maxGraph.
When it was stored in Client, it was a static property that could be modified. Moving it to the constants module ensures that it cannot be modified.

## 0.15.1

Expand Down
7 changes: 0 additions & 7 deletions packages/core/src/Client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,6 @@ limitations under the License.
import { NS_SVG } from './util/Constants';

class Client {
/**
* The version of the `maxGraph` library.
*/
// WARN: this constant is updated at release time by the script located at `scripts/update-versions.mjs`.
// So, if you modify the name of this file or this constant, please update the script accordingly.
static VERSION = '0.15.1';

/**
* Base path for all URLs in the core without trailing slash.
*
Expand Down
3 changes: 2 additions & 1 deletion packages/core/src/gui/MaxLog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import MaxWindow, { popup } from './MaxWindow';
import { KeyboardEventListener, MouseEventListener } from '../types';
import { copyTextToClipboard } from '../util/Utils';
import { getElapseMillisecondsMessage } from '../util/logger';
import { VERSION } from '../util/Constants';

/**
* A singleton class that implements a simple console.
Expand All @@ -40,7 +41,7 @@ class MaxLog {
*/
static init(): void {
if (MaxLog.window == null && document.body != null) {
const title = `${MaxLog.consoleName} - mxGraph ${Client.VERSION}`;
const title = `${MaxLog.consoleName} - mxGraph ${VERSION}`;

// Creates a table that maintains the layout
const table = document.createElement('table');
Expand Down
7 changes: 7 additions & 0 deletions packages/core/src/util/Constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

/**
* The version of the `maxGraph` library.
*/
// WARN: this constant is updated at release time by the script located at 'scripts/update-versions.mjs'.
// So, if you modify the name of this file or this constant, please update the script accordingly.
export const VERSION = '0.15.1';

/**
* Defines the portion of the cell which is to be used as a connectable
* region. Default is 0.3. Possible values are 0 < x <= 1.
Expand Down
3 changes: 1 addition & 2 deletions packages/js-example-without-defaults/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ limitations under the License.
import './style.css';
import {
CellRenderer,
Client,
constants,
Graph,
InternalEvent,
Expand Down Expand Up @@ -105,7 +104,7 @@ const initializeGraph = (container) => {

// display the maxGraph version in the footer
const footer = document.querySelector('footer');
footer.innerText = `Built with maxGraph ${Client.VERSION}`;
footer.innerText = `Built with maxGraph ${constants.VERSION}`;

// Creates the graph inside the given container
initializeGraph(document.querySelector('#graph-container'));
4 changes: 2 additions & 2 deletions packages/js-example/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ limitations under the License.
import '@maxgraph/core/css/common.css';
import './style.css';
import {
Client,
constants,
DomHelpers,
getDefaultPlugins,
Graph,
Expand Down Expand Up @@ -74,7 +74,7 @@ const initializeGraph = (container) => {

// display the maxGraph version in the footer
const footer = document.querySelector('footer');
footer.innerText = `Built with maxGraph ${Client.VERSION}`;
footer.innerText = `Built with maxGraph ${constants.VERSION}`;

// Creates the graph inside the given container
const container = document.querySelector('#graph-container');
Expand Down
3 changes: 1 addition & 2 deletions packages/ts-example-without-defaults/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ limitations under the License.
import './style.css';
import {
CellRenderer,
Client,
constants,
Graph,
InternalEvent,
Expand Down Expand Up @@ -105,7 +104,7 @@ const initializeGraph = (container: HTMLElement) => {

// display the maxGraph version in the footer
const footer = <HTMLElement>document.querySelector('footer');
footer.innerText = `Built with maxGraph ${Client.VERSION}`;
footer.innerText = `Built with maxGraph ${constants.VERSION}`;

// Creates the graph inside the given container
initializeGraph(<HTMLElement>document.querySelector('#graph-container'));
3 changes: 1 addition & 2 deletions packages/ts-example/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ limitations under the License.
import '@maxgraph/core/css/common.css'; // required by RubberBandHandler
import './style.css';
import {
Client,
constants,
getDefaultPlugins,
Graph,
Expand Down Expand Up @@ -116,7 +115,7 @@ const initializeGraph = (container: HTMLElement) => {

// display the maxGraph version in the footer
const footer = <HTMLElement>document.querySelector('footer');
footer.innerText = `Built with maxGraph ${Client.VERSION}`;
footer.innerText = `Built with maxGraph ${constants.VERSION}`;

// Creates the graph inside the given container
initializeGraph(<HTMLElement>document.querySelector('#graph-container'));
4 changes: 2 additions & 2 deletions packages/ts-support/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

import { Client, Graph, InternalEvent } from '@maxgraph/core';
import { constants, Graph, InternalEvent } from '@maxgraph/core';

const version = Client.VERSION;
const version = constants.VERSION;

// Creates the graph inside the given container
const container = <HTMLElement>document.getElementById('graph-container');
Expand Down
6 changes: 3 additions & 3 deletions scripts/update-versions.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,13 @@ function updateVersionInCorePackageJsonFile(newVersion) {
}

function updateVersionInSourceFile(newVersion) {
const path = 'packages/core/src/Client.ts';
const path = 'packages/core/src/util/Constants.ts';
console.info('Updating', path);
const content = readFileContent(path);
// replace the 1st occurrence, this is OK as the constant appears only once in the file
const updatedContent = content.replace(
/static VERSION =.*/,
`static VERSION = '${newVersion}';`
/const VERSION =.*/,
`const VERSION = '${newVersion}';`
);
writeFileSync(path, updatedContent);
}
Expand Down