I have a react project that is bundled with tsbuild and publish to npm package through azure devOps. Recently, noticed when someone tried to install the package by running
yarn add packageName --latest
it installs the latest deployed version even though it is from the feature branch. For exampe:
branch-3
But what we would like to do is not installed that feature version but install the version that are deployed from the master branch.
Can someone guide me how to achieve this.
We are actually deploying the npm package to azure artificats through auzre devOps pipeline. And here is some examples that what we are doing:
- task: Npm@1
displayName: 'npm package version'
condition: and(succeeded(), eq(${{parameters.Publish}}, true))
inputs:
workingDir: ${{ parameters.Directory }}
command: 'custom'
customCommand: '--no-git-tag-version version ${{ parameters.Version }}'
- task: Npm@1
displayName: 'npm publish'
condition: and(succeeded(), eq(${{parameters.Publish}}, true))
inputs:
workingDir: ${{ parameters.Directory }}
command: 'publish'
publishRegistry: 'useFeed'
publishFeed: ${{ parameters.Feed }}
2
Answers
The latest version of the package is determined by the tag
latest
. It applies automatically unless you use the option--tag
. Reading the npm docs:Based on the update, it seemed that your pipeline was able to run and
build
the code from different branches of your repo andpublish
the npm package into the Azure Artifacts Feed. The only difference was the package version that was set.For this, you may try and use the command below to install the expected package, whose version was built with the code in the
master
branch.Please also get prepared to Connect to a feed first.