import { BumpInfo } from '../types/BumpInfo' ; import { generateTag } from '../tag' ; import { gitFailFast } from 'workspace-tools' ; function createTag ( tag , cwd ) { gitFailFast ( [ 'tag' , '-a' , '-f' , tag , '-m' , tag ] , { cwd } ) ; } export function tagPackages ( bumpInfo , cwd ) { const { modifiedPackages , newPackages } = bumpInfo ; [ ... modifiedPackages , ... newPackages ] . forEach ( pkg => { const packageInfo = bumpInfo . packageInfos [ pkg ] ; const changeType = bumpInfo . calculatedChangeTypes [ pkg ] ; if ( changeType === 'none' || packageInfo . private || ! packageInfo . combinedOptions . gitTags ) { return ; } console . log ( `Tagging - ${ packageInfo . name }@${ packageInfo . version }` ) ; const generatedTag = generateTag ( packageInfo . name , packageInfo . version ) ; createTag ( generatedTag , cwd ) ; } ) ; } export function tagDistTag ( tag , cwd ) { if ( tag && tag !== 'latest' ) { createTag ( tag , cwd ) ; } }