I am building an Angular Library to be used in other Angular Applications. I want to create a build pipeline in DevOps (VSTS) so after each commit to git, the library will be built and published as Artefacts to be used.
Till now everything works fine, my problem is with Angular Library version. If I tried to publish the Library with the same version, I receive this error:
Forbidden The feed already contains the package 'my-lib' at version '0.0.1': my-lib
My build pipeline:
To solve this problem, I have either to change the Version in the package.json before every builds
Or through the cli: npm version 0.0.2
Can I do it automatically? which means, no need for extra actions except commit/push? I had searched for a long time, but couldn't find a solution. Thanks
To update your version you need to run
npm version
command by passing one of the following:patch, minor
ormajor
->npm version patch
would update your package version from1.3.0
to1.3.1
npm version minor
would update your package version from1.3.0
to1.4.0
npm version major
would update your package version from1.3.0
to2.3.0
You can add this command to your pipeline to be run when you merge to
master
or however you pipeline is set up.Please see: https://docs.npmjs.com/cli/version