Skip to content

Commit

Permalink
✨ Add creating releases without zeroes
Browse files Browse the repository at this point in the history
Closes #12
  • Loading branch information
priestine committed Jul 3, 2020
1 parent 847e00c commit e111f7e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/pipes/make-new-version-pipe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { makeNewVersion } from '../pure/make-new-version'
import { ExtendPipe } from '../utils/pipe'
import { addBuildMetadata } from '../pure/add-build-metadata'
import { addPrefix } from '../pure/add-prefix'
import { removeTrailingZeroes } from '../pure/remove-trailing-zeroes'

interface IDeps {
logSuccess: LogFunction
Expand All @@ -22,6 +23,8 @@ export const makeNewVersionPipe = ({ logSuccess, logInfo, logExitingWarning }: I
.pipeExtend(forceBumping({ key: 'bumpMajor', logInfo }))
.pipeTap(exitIfNoBumping({ logExitingWarning }))
.pipeExtend(makeNewVersion)
.pipeExtend(removeTrailingZeroes)
.pipeExtend(removeTrailingZeroes)
.pipeExtend(addPreRelease)
.pipeExtend(addBuildMetadata)
.pipeExtend(addPrefix)
Expand Down
9 changes: 9 additions & 0 deletions src/pure/remove-trailing-zeroes.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import type { IAppCtx } from '../types/app-ctx'

export const removeTrailingZeroes = ({
newVersion,
noTrailingZeroes,
}: Pick<IAppCtx, 'newVersion' | 'noTrailingZeroes'>) => ({
newVersion:
noTrailingZeroes && newVersion.endsWith('.0') ? newVersion.replace(/\.0$/, '') : newVersion,
})

0 comments on commit e111f7e

Please sign in to comment.