When building an Angular Library application, is there an automated way to keep the root level package.json and the library application's package.json (e.g. under projects/my-library
) file versions in sync when using npm version
commands?
When I use the command, it's only incrementing the root level package.json, is there a special command, or any other way to propagate the version number down to the library package.json file?
I have seen some solutions such as running a script after ng build
to read the root level package.json version number and write that into the library one but I'm not sure this is the best approach.
Has anyone else faced this when building libraries in Angular and if so what was your way to deal with it?
package.json
file, the child one not the parent work space one. I don't know why there are two versions properties in these two files. Now I'm trying to use your script with a bash find command to find thepackage.json
file and read the version property from it. – Induct