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
Thomas Bouffard 2022-11-07 18:31:40 +01:00 committed by GitHub
parent 9428ba2a4a
commit 27f75a59f3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 78 additions and 1 deletions

View File

@ -47,6 +47,9 @@ jobs:
- name: Generate @maxgraph/core types
working-directory: packages/core
run: npm run generate-types
- name: Test TypeScript support
working-directory: packages/ts-support
run: npm test
- name: Build ts-example
working-directory: packages/ts-example
run: npm run build

View File

@ -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` requires **TypeScript 3.8** or greater.
## Support

View File

@ -12,6 +12,6 @@
"@maxgraph/core": "*"
},
"devDependencies": {
"vite": "~3.1.0"
"vite": "~3.2.3"
}
}

View File

@ -0,0 +1 @@
package-lock=false

View File

@ -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`

View File

@ -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"
}
}

View File

@ -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

View File

@ -0,0 +1,16 @@
{
"compilerOptions": {
"module": "ES2015",
"target": "ES2015",
"lib": [
"ES2015",
"DOM"
],
"moduleResolution": "Node",
"strict": true,
"noEmit": true
},
"include": [
"src/**/*"
],
}