We are building a Node.js app. As we are practicing Continuous Delivery with Trunk Based Development we would only have one branch and one build to work with.
For several reasons including legal requirements we are expected to deliver a patch version for the currently released version any time we are developing a next feature release. What's more: There are features and/or activities that would not make it to the next feature version.
Obviously any new features have to be excluded from the patch release, any we-will-not-make-the-next-feature-release stuff has to be excluded from the next release.
In order to test (and ship betas) we are building and testing three versions of the product, say 1.0, 1.1 and 1.2.
Exclusion of features is done using feature toggles.
Question: How could I exclude dependencies only valid for next feature release or even later from being put into the node_modules
during build?
If it were for two lines I would try something using the optional dependencies of package.json
.
Is there any other way to make sure:
- dependencies for 1.1 and after are not making it into 1.0
- dependencies for 1.2 and after are not making it into 1.0 and 1.1
- require(...) does not fail for not existing dependencies (wrapping with feature toggle???)
Is there a way to avoid keeping three package.json
's and pick the "just right" one during build of each version?