Skip to main content

Build a library providing Olympe bricks

Once you have built a first set of bricks, you may want to publish them as a library, which you may then reimport in other projects.

Create a library#

Build the library#

To build your project as a library, run

npm run build:lib

The script will ask you if you want to snapshot the project first. If you have done any work in DRAW since you last snapshot your project, you must resnapshot it again before continuing. Otherwise, the library will not provide the last version of the data cloud initialisation files.

build:lib command builds the project as a npm installable library in the dist/ directory of your project. This library provides both the project's data cloud initialisation JSON files and source code.


Webpack creates automatically a package.json for the library. You may change it at your convenience. However, it must always contain the field dcInitConfig. If this field misses, the Olympe dev-tools will not identify that the library provides data cloud initialisation files and the data cloud initialisation will fail.

Default value:

dcInitConfig: import/dcInitConfig.json

dcInitConfig.json is the data cloud initialisation configuration file, i.e. the list of modules to load during the data cloud initialisation step.

Make the library available#

The library is built and ready in the dist/ directory of your project, but not yet accessible to anyone. You can navigate to the dist/ directory and either

  • publish the library on a npm registry with npm publish
  • link the library on your system to use it in another of your projects with npm link

Note that string-utils is a very common name. You will not be able to publish that on an official npm registry.

Link the library on your system#

Linking the library on your system is the most efficient way to be able to use its development version in another of your projects. After doing

npm link

you can check that the library was correctly linked in your system. It should appear in the list of globally installed npm packages (npm list -g), e.g. :

โ”œโ”€โ”€ string-lib-example@0.1.0 -> /Users/olympe-dev/tutorials/string-utils/dist