Skip to content

Commit

Permalink
fix: fix pure tag parser
Browse files Browse the repository at this point in the history
  • Loading branch information
antongolub committed Nov 20, 2023
1 parent 80e66b1 commit 41b961d
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/main/js/meta.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ const pure = {
}

const [n, o = ''] = prerelease.reverse()
const name = o === 'x' ? n : `@${o}/${n}`
const name = (!o || o === 'x') ? n : `@${o}/${n}`
const version = tag.slice(0, -1 - n.length - (o ? o.length + 1 : 0))

return {format: this.name, ref: tag, name, version}
Expand Down
18 changes: 18 additions & 0 deletions src/test/js/meta.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,24 @@ test('formatTag() / parseTag()', () => {
format: 'pure',
ref: '1.2.3-my.package'
}
],
[
'0.0.1-topoconfig.cmds',
{
name: '@topoconfig/cmds',
version: '0.0.1',
format: 'pure',
ref: '0.0.1-topoconfig.cmds'
}
],
[
'0.0.1-topoconfig',
{
name: 'topoconfig',
version: '0.0.1',
format: 'pure',
ref: '0.0.1-topoconfig'
}
]
]

Expand Down

0 comments on commit 41b961d

Please sign in to comment.