This document contains instructions for developers working on the @api3/commons package.
# To install dependencies
pnpm i
# To run tests
pnpm testInspect the package.json for more scripts.
Releases are generated by the tag-and-release CI workflow job. To release a new version follow this step:
- Merge a PR that bumps the
versionnumber withinpackage.json.
- Create a new directory in
srcwith the name of the utility. - Create
index.tsfile in the directory. This file will be the entry point for the utility. - Re-export the new utility from
universal-index.tsornode-index.tsfile. - Create a
README.mdwith documentation.
It is preferred (simpler and faster) to test the package using the file: protocol.
- Implement some changes and run
pnpm run buildto build the commons package. - In some other project, specify
file:<RELATIVE_PATH_TO_COMMONS>. For example:"@api3/commons": "file:../commons". - Re-install the dependencies in the project (doesn't matter what package manager you use). For example:
pnpm i.
You can repeat the above steps as many times as you want. The package will be re-installed from the local directory with the locally built content.
The common pattern is to move some part of implementation to commons and then use it in some other repo. It is valuable to see whether nothing broke in the process (before publishing the package). You can use verdaccio.
- Start verdaccio (either as a docker service or directly on host machine). See: https://verdaccio.org/docs/installation.
- Implement and commit your changes. You should have a clean working tree.
pnpm version minor --no-git-tag-version- Will bump thepackage.jsonversion. Feel free to replaceminorwith apathormajorif necessary.pnpm publish --access public --registry http://localhost:4873 --no-git-checks- Will do the publishing to the local registry. It will disable git checks (which ensure that the working tree is clean).- You can now install the package in the target repository. Use
pnpm add @api3/commons --registry http://localhost:4873.
Tip: To unpublish a package from the local registry, you can just remove verdaccio storage. On my machine it can be done
via rm -rf $HOME/.local/share/verdaccio/storage.