Creating new packages
From version 3, the source code of sigma.js is structured as a monorepo. We use Preconstruct to build the packages for development and production, and Lerna to manage versions lifecycle. Finally, on NPM, sigma is split into the core sigma package, and various @sigma/xxx feature packages.
This approach allows to maintain multiple features, that are too specialized to be included in the main repository, without the cost of creating and managing multiple Git/GitHub repositories.
As of now, the features are prefixed by their general purpose:
@sigma/node-xxxand@sigma/edge-xxxrefer to node and edge renderers@sigma/layer-xxxrefers to additional layers that can be added to sigma instances@sigma/layout-xxxrefers to layout algorithms@sigma/export-xxxrefers to packages that allow exporting somehow a sigma instance@sigma/utilsstores various small specific helpers
Creating a new package
Section titled “Creating a new package”To create a new package, you first need to get a clean local instance of sigma, with up-to-date versions of Git, Node.js and NPM. Then, go to the root of the repository, and run npm run createPackage. You will be prompted for the new package name (excluding the @sigma/ namespace), after which a fresh, empty package will be created and referenced wherever necessary.
Adding examples
Section titled “Adding examples”Each package should have examples in the website’s packages/website/src/examples/ directory. These examples serve both as a development playground and as the public documentation showing what each package can do.
Adding tests
Section titled “Adding tests”Unit tests sit next to the code as src/**/*.test.ts, and run with the package test script (vitest). The website examples are also covered by the end-to-end tests in packages/browser-tests.