Skip to content

@itk-demo-sw npm-packages

This software environment comes with a number of custom npm-packages, currently stored in the @itk-demo-sw package registry. All packages are introduced and explained in this section. Additionally, instructions on how these packages can be included in a node-project are given.

Access to the package registry

The package registry is linked with the itk-demo-chassis repository. You must provide npm with the link to the registry in order to access it. This can be done by calling:

Text Only
npm config set @itk-demo-sw:registry https://gitlab.cern.ch/api/v4/projects/123904/packages/npm/

Now the @itk-demo-sw registry is globally available. Packages can be installed using:

Text Only
npm i @itk-demo-sw/<package-name>

Existing packages

utility-functions (documentation)

This package provides helper functions that are used throughout itk-demo-sw microservice GUIs. Most importantly, it provides a simple API for http GET and POST requests that is used to communicate with the REST APIs of microservices.

components (documentation)

This package provides a number of React-components to be used in itk-demo-sw microservice GUIs. Most of them are based on existing Patternfly components, with adaptations and additions to optimally fit this project. In accordance with current React standards, these components are only visual. Any stateful logic that is necessary for the functionality of a component is provided in a corrresponding React hook in the hooks package.

hooks (documentation)

This package provides React hooks containing the stateful logic for the components in the components package. Separating the logic from the visual component allows for easy access to stateful variables outside of the component. For more information on this, check out this tutorial for more information on React hooks and their use.