Wednesday, 11 December 2019

Local development of multiple modules

I'm developing at the same time a program and some libraries for it. Something like the following scenario:app, which requires dep and peerDepdep, which requires peerDep both as a dev dependency (since it needs it to run tests), and as a peer dependency (since it needs to use exactly the same version that app uses)peerDep​When I change something in peerDep I want to test the changes on dep and app before committing and publishing the new version.In order to test app against the local version of peerDep, I need to:Remove the package-lock.json for both app and dep and the node_modules directory.Change all the dependencies, devDependencies and peerDependiencs in the package.json of all my projects, so that the local version of peerDep and dep is used instad of the NPM one.And then renpm installing all the packages.If I forgot something (e.g. forgot to change one of the peerDependiencs) then I end up with a wrong version of peerDep in my node_modules, and in order to get rid of it, I need to fix the package.json and remove again all the package-lock.jsons and node_modules directories.​My actual situation is quite trickier than the example scenario: I'm working with a total of 6 packages. Having to fix all those deps is hell.Am I doing something wrong? Are there better ways to test the modules I'm working on against local dependencies instead of the remote ones?

Submitted December 12, 2019 at 02:11AM by NoNoDeDev

No comments:

Post a Comment