NodeJS Scripts

react-utils-build – The script for Babel, and Webpack build of the library and derived apps. Can be used to work around issues with npm link command for the library development within dependant projects.

server – Easy creation and launch of web-server with standard configuration, that serves a ReactJS application with or without server-side rendering, supports development tools (Hop Module Reloading), and can be further configured for the needs of specific projects.

Development

Whenever you are to do any changes in the library, keep in mind the following:

Different projects rely on this library, the tooling it provides should be as generic and flexible as possible. When you change existing components, do your best to keep backward compatibility of the updated components, any changes that demand updates in the projects relying on the library, must be documented in the changelog.

Rely on unit tests to verify your changes, and prevent regression. Update existing unit tests to keep up with your changes, and add new unit tests when necessary.

For the final testing of your updates within a host project relying on this lib, see the next section.

The library use semantic versioning. In case your changes demand any changes in the project relying on the library, you should release it as a minor library update (more severe comparing to patch update). Consider to use a new branch, called after the minor version, and to not merge your changes into the main devel / master branches until everybody is prepared for that.

Local Testing of Library Updates within a Host Project

To locally test how your library updates work within a host project relying on the lib (without releasing them to NPM), use npm link to link local copy of the lib into the host project, then run npm run build:dev:watch in the library root to automatically re-build the lib when you change it, and use the host project to see the final effect of changes you make.

Library Releases to NPM

Continious Integration and Delivery (CI/CD) is set up for this repository with CircleCI 2.0. Commits to all branches trigger testing of the code with $ npm test (it runs linters and unit tests), and also build the library. CI/CD flow is interrupted in case of any problems.

To release updated library version to NPM do the following:

Bump library version in package.json and package-lock.json by $ npm version UPDATE_TYPE --no-git-tag command, where UPDATE_TYPE should be one of patch / minor / major to update current version x.y.z to x.y.(z+1) / x.(y+1).0 / (x+1).0.0. The --no-git-tag flag prevents automatic creation of the Git tag with the same name as the version.

Tag the commit to be released with the git tag like v0.1.2, where 0.1.2 is the new version set in the previous step.