Refactor - use renderVersionBadge - part 3 [luarocks gitlab nuget feedz] (#10630)

* Refactor luarocks to use renderVersionBadge

Loarocks does not appear to have version conventions and there are no issues in history that require usage of existing color usage.
For better consistency use color scheme as the rest of the badges.

Also add scm and cvs as preview in renderVersionBadge

* add missing test for version color formatter

* refactor nuget to use renderVersionBadge

* Refactor GitlabTag to use renderVersionBadge

* add comment about non-standard render of coljarsVersion

* Refactor FeedzVersionService to use renderVersionBadge from version.js

* Refactor nuget.tester.js to remove unnecessary version tests

* add missing label in gitlab-tag.spec
This commit is contained in:
jNullj
2024-10-27 15:35:03 +02:00
committed by GitHub
parent 48e25771ee
commit cc90c190f2
14 changed files with 24 additions and 159 deletions

View File

@@ -1,8 +1,6 @@
import Joi from 'joi'
import { version as versionColor } from '../color-formatters.js'
import { optionalUrl } from '../validators.js'
import { latest } from '../version.js'
import { addv } from '../text-formatters.js'
import { latest, renderVersionBadge } from '../version.js'
import { NotFound, pathParam, queryParam } from '../index.js'
import { description, httpErrorsFor } from './gitlab-helper.js'
import GitLabBase from './gitlab-base.js'
@@ -63,13 +61,6 @@ export default class GitlabTag extends GitLabBase {
static defaultBadgeData = { label: 'tag' }
static render({ version, sort }) {
return {
message: addv(version),
color: sort === 'semver' ? versionColor(version) : 'blue',
}
}
async fetch({ project, baseUrl }) {
// https://docs.gitlab.com/ee/api/tags.html
// N.B. the documentation has contradictory information about default sort order.
@@ -114,6 +105,6 @@ export default class GitlabTag extends GitLabBase {
sort,
includePrereleases: pre !== undefined,
})
return this.constructor.render({ version, sort })
return renderVersionBadge({ version })
}
}

View File

@@ -39,6 +39,7 @@ describe('GitLabTag', function () {
).to.deep.equal({
message: 'v1.9',
color: 'blue',
label: undefined,
})
scope.done()