docs: set the minimum TypeScript requirement to 3.8 (#128)
We use a recent TypeScript version to build maxGraph but applications that integrates it may be forced to use old TypeScript versions. We never explain what is the minimum TypeScript version requires to use `maxGraph`. The changes proposed here are a first step to make this information available. It is only informative for now (mentioned in the README) and the minimum TypeScript version is tested in the `ts-support` package (part of the 'build' GitHub workflow).development
parent
9428ba2a4a
commit
27f75a59f3
|
@ -47,6 +47,9 @@ jobs:
|
||||||
- name: Generate @maxgraph/core types
|
- name: Generate @maxgraph/core types
|
||||||
working-directory: packages/core
|
working-directory: packages/core
|
||||||
run: npm run generate-types
|
run: npm run generate-types
|
||||||
|
- name: Test TypeScript support
|
||||||
|
working-directory: packages/ts-support
|
||||||
|
run: npm test
|
||||||
- name: Build ts-example
|
- name: Build ts-example
|
||||||
working-directory: packages/ts-example
|
working-directory: packages/ts-example
|
||||||
run: npm run build
|
run: npm run build
|
||||||
|
|
|
@ -70,6 +70,7 @@ For more details, have a look at the [storybook stories](packages/html/stories).
|
||||||
|
|
||||||
maxGraph is written in TypeScript and provides type definitions so maxGraph can be easily integrated into TypeScript projects.
|
maxGraph is written in TypeScript and provides type definitions so maxGraph can be easily integrated into TypeScript projects.
|
||||||
|
|
||||||
|
`maxGraph` requires **TypeScript 3.8** or greater.
|
||||||
|
|
||||||
## Support
|
## Support
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,6 @@
|
||||||
"@maxgraph/core": "*"
|
"@maxgraph/core": "*"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"vite": "~3.1.0"
|
"vite": "~3.2.3"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
package-lock=false
|
|
@ -0,0 +1,15 @@
|
||||||
|
# ts-support
|
||||||
|
|
||||||
|
Check the minimum TypeScript version required to use `maxGraph`.
|
||||||
|
|
||||||
|
## Setup
|
||||||
|
|
||||||
|
Initialize all packages
|
||||||
|
> From the repository root, run `npm install`.
|
||||||
|
|
||||||
|
Build maxgraph@core
|
||||||
|
> From the `packages/core` directory, run `npm run generate-types`.
|
||||||
|
|
||||||
|
## Run the test
|
||||||
|
|
||||||
|
Run `npm test`
|
|
@ -0,0 +1,14 @@
|
||||||
|
{
|
||||||
|
"name": "@maxgraph/ts-support",
|
||||||
|
"version": "0.0.0",
|
||||||
|
"private": true,
|
||||||
|
"scripts": {
|
||||||
|
"test": "tsc --version && tsc"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"@maxgraph/core": "*"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"typescript": "3.8.2"
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,27 @@
|
||||||
|
/*
|
||||||
|
Copyright 2022-present The maxGraph project Contributors
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import { Client, Graph, InternalEvent } from '@maxgraph/core';
|
||||||
|
|
||||||
|
const version = Client.VERSION;
|
||||||
|
|
||||||
|
// Creates the graph inside the given container
|
||||||
|
const container = <HTMLElement>document.getElementById('graph-container');
|
||||||
|
// Disables the built-in context menu
|
||||||
|
InternalEvent.disableContextMenu(container);
|
||||||
|
|
||||||
|
const graph = new Graph(container);
|
||||||
|
graph.setPanning(true); // Use mouse right button for panning
|
|
@ -0,0 +1,16 @@
|
||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"module": "ES2015",
|
||||||
|
"target": "ES2015",
|
||||||
|
"lib": [
|
||||||
|
"ES2015",
|
||||||
|
"DOM"
|
||||||
|
],
|
||||||
|
"moduleResolution": "Node",
|
||||||
|
"strict": true,
|
||||||
|
"noEmit": true
|
||||||
|
},
|
||||||
|
"include": [
|
||||||
|
"src/**/*"
|
||||||
|
],
|
||||||
|
}
|
Loading…
Reference in New Issue