Converting ES Module Imports to UMD
Location: tools/es-modules-to-umd
Based on jscodeshift
Most demos use the ES module variant of the yFiles for HTML library via import statements. This tool converts them so that they use the UMD variant and load their dependencies via require.js. To run it, use the following command in the terminal:
Instead of the demos folder, you can of course transform any other folder you like, e.g. only a single demo folder.
Note that the resulting demos are not runnable in this state yet, as they are missing a require.js implementation. To fix that, simply add an AMD module loader like RequireJS to the index.html
of a demo:
Converting UMD Imports to ES Modules
Location: tools/umd-to-es-modules
Based on jscodeshift
This script converts UMD imports of the yFiles library into the corresponding ES module imports.
To convert your source code, open a terminal and run:
Instead of the demos folder, you can of course transform any other folder you like, e.g. only a single demo folder.
Note that the resulting files may not be runnable in this state yet, as the transformation
might introduce syntax errors due to the removed require()
calls.
Split Single 'yfiles' Import
Location: tools/transform-split-import
Based on jscodeshift
This script converts a single import { … } from 'yfiles'
statement to import
statements that use the specific yFiles module where the imported types reside. Additionally, it inserts an import of
'view-layout-bridge'
if it detects both a view module as well as a layout module being used.