All customers can use the go.js
and go-debug.js
files or the corresponding ES module files to run their app.
However, if you have purchased a license to the GoJS TypeScript source code, you can build your app from the TypeScript source.
Popular module bundlers such as Webpack are able to remove a number of modules from the source, provided you are not using them,
to shrink the size of the deliverable file.
Because the go.js
and go-debug.js
files are built in a custom process to reduce size,
using Webpack or another bundler with the GoJS source, even though it removes unused modules,
may result in a larger file size than just using go.js
. However, programmers using TypeScript
may appreciate the feedback and debugging capabilities of building from source.
The GoJS kit has two subdirectories under the /projects
directory,
/minimalSource
and /maximalSource
.
The minimalSource project shows how to build GoJS while removing all possible optional modules. The maximalSource project shows how to build GoJS while matching the functionality of the released go.js and go-debug.js files.
Both projects require webpack
and npm
to run.
There is additionally minimalSourceBrowserify, which shows how to build from source with Browserify instead of Webpack.
Several classes, such as CommandHandler
and the Tools,
may be essential to add to your project, while others such as all but one Layout
and one type of Model
can often be removed.
Below is a list of modules that webpack can remove from builds, provided they are not referenced in your code:
SVGSurface
, used by Diagram.makeSvg.
Model
.
There are several "built in" Panel types, each of which is a PanelLayout. Some of these are required for building the source:
PanelLayoutPosition
PanelLayoutVertical
PanelLayoutLink
PanelLayoutAuto
PanelLayoutGrid
PanelLayoutHorizontal
PanelLayoutSpot
PanelLayoutTable
PanelLayoutViewbox
PanelLayoutTableRow
PanelLayoutTableColumn
PanelLayoutGraduated
The source index files demonstrate the necessary calls to Panel.addPanelLayout
to include each panel type.
Many of the classes simply need to be used to be included in source building.
For some functionality, like the Tools, CommandHandler, and SVGSurface, you need to make sure you explicitly initalize them.
Examples of this can be found in the maximal-index.ts code
for the maximalSource project.
Doing so is not necessary with the full go.js
library because the go
object already has references to each.
A typical GoJS project is not expected to remove all or even most of these modules, and may use the majority of them.
Because Northwood's internal build process is optimized to use the Google Closure Compiler in Advanced Mode,
it may take considerable effort to produce a go.js
bundle from source that is smaller than the one we include in the project's release directory.
The GoJS source code is subject to the terms of our license, contained in SoftwareLicenseAgreement.pdf.
Do not use, release (deploy), or distribute the unminified source code. To build GoJS for your own application you must use a popular obfuscation/minification tool, such as the Google Closure Compiler.
GoJS