To build your project as a library, run
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:libcommand 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.
dcInitConfig.json is the data cloud initialisation configuration file, i.e. the list of modules to load during the data cloud initialisation step.
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
- link the library on your system to use it in another of your projects with
string-utils is a very common name. You will not be able to publish that on an official npm registry.
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
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. :