Skip to content

Commit

Permalink
Merge pull request #41 from sendbird/feat/support-dashes
Browse files Browse the repository at this point in the history
feat: support dashes in extractVersion
  • Loading branch information
bang9 authored Nov 27, 2024
2 parents 242f5d3 + 4d4fe79 commit cbf1d66
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
8 changes: 8 additions & 0 deletions __tests__/utils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,12 @@ describe('extractVersion', () => {
expect(extractVersion('release/swift/v1.2.3-rc.0')).toBe('1.2.3-rc.0')
expect(extractVersion('hotfix/swift/v1.2.3-rc.0')).toBe('1.2.3-rc.0')
})

test('should handle dashes in the product', () => {
expect(extractVersion('hotfix/chat-ai-widget/v1.2.3')).toBe('1.2.3')
expect(extractVersion('release/chat-ai-widget/v1.2.3')).toBe('1.2.3')

expect(extractVersion('release/ktx/message-template/v1.2.3-beta.0')).toBe('1.2.3-beta.0')
expect(extractVersion('hotfix/ktx/message-template/v1.2.3-beta.0')).toBe('1.2.3-beta.0')
})
})
2 changes: 1 addition & 1 deletion dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,6 @@ function getVersionRegex(inputs: string[]): RegExp {
// release/ktx/0.0.0
// release/compose/0.0.0-beta.0
return new RegExp(
`^(${joinedInputs})(\\/\\w+)*\\/v?(\\d+\\.\\d+\\.\\d+([\\-\\.]\\w+(\\.\\d+)*)?)$`
`^(${joinedInputs})(\\/[-\\w]+)*\\/v?(\\d+\\.\\d+\\.\\d+([\\-\\.]\\w+(\\.\\d+)*)?)$`
)
}

0 comments on commit cbf1d66

Please sign in to comment.