Modify an internal package
Publishing and consuming a new package version
Given you have already made changes in the relevant package for a feature branch (Branch A):
- In the
package.jsonfile (inside the directory of the package you have changed) update the package version in whichever may makes the most sense for the change being implemented (full guide for package versioning here) - Deploy the package changes to a lower
env/*environment, e.g.env/polaris(see Deploying and Testing your code) - Once the package changes are pushed/deployed and the pipeline has passed, go to the package registry on GitLab where you should see a newly published env-specific version of the package (for
env/polarisit will look something like<new-package-version>-env-polaris.<id>) - Checkout or create a separate branch (Branch B)
- On this new branch, modify the package version and reference the env-specific version from the GitLab package registry to consume the newly-deployed version (e.g in
clients/luna-front-end/package.jsonor in whichever client/service needs the package updates) - Run
yarn installin the client/service directory to install the new version of the package - Continue with development as normal on Branch B using this new package version
Merging changes into main
Once you have finished development for the new feature and are ready for review, raise separate MRs for the changes:
- One for Branch A (contains the package changes)
- One for Branch B (contains the remaining changes/consumes the new package version)
- The MR for Branch A should be merged into main first, doing this will publish a 'prod' version of the new package (also viewable from the GitLab package registry)
- Once the MR for Branch A has been merged/deployed, the code for Branch B should be updated to use the 'prod' version of the package instead of the lower environment-specific version (i.e. instead of
2.2.1-env-polaris.<id>the version will now just be2.2.1) - The MR for Branch B can now be merged when ready
