Compare commits

...

30 Commits

Author SHA1 Message Date
github-actions[bot]
1838979d56 Changelog for Release server-2024-07-01 (#10318)
* Update Changelog

* Update CHANGELOG.md

---------

Co-authored-by: release[bot] <actions@users.noreply.github.com>
Co-authored-by: chris48s <chris48s@users.noreply.github.com>
2024-07-01 07:00:51 +00:00
Matin Lotfaliei
7c787b364a Add [AUR] Popularity Badge (#10304)
* Add AUR Popularity

* Apply Prettier formatting

* Update aur.service.js based on chris48s comments

* Update aur.tester.js from isMetric to decimal number

* Update aur.tester.js to import Joi

* Update aur.tester.js to fix the mistakenly placed Joi

* Update services/aur/aur.service.js

* Update services/aur/aur.tester.js

* update mocked data

---------

Co-authored-by: chris48s <chris48s@users.noreply.github.com>
Co-authored-by: chris48s <git@chris-shaw.dev>
2024-06-30 18:55:31 +00:00
dependabot[bot]
0e79f75030 chore(deps): bump simple-icons from 12.3.0 to 12.4.0 (#10312)
Bumps [simple-icons](https://github.com/simple-icons/simple-icons) from 12.3.0 to 12.4.0.
- [Release notes](https://github.com/simple-icons/simple-icons/releases)
- [Commits](https://github.com/simple-icons/simple-icons/compare/12.3.0...12.4.0)

---
updated-dependencies:
- dependency-name: simple-icons
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-06-28 20:14:52 +00:00
dependabot[bot]
f25c3f265d chore(deps): bump graphql from 16.8.2 to 16.9.0 (#10313)
Bumps [graphql](https://github.com/graphql/graphql-js) from 16.8.2 to 16.9.0.
- [Release notes](https://github.com/graphql/graphql-js/releases)
- [Commits](https://github.com/graphql/graphql-js/compare/v16.8.2...v16.9.0)

---
updated-dependencies:
- dependency-name: graphql
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-06-28 20:09:26 +00:00
dependabot[bot]
740a682f05 chore(deps): bump prom-client from 15.1.2 to 15.1.3 (#10311)
Bumps [prom-client](https://github.com/siimon/prom-client) from 15.1.2 to 15.1.3.
- [Release notes](https://github.com/siimon/prom-client/releases)
- [Changelog](https://github.com/siimon/prom-client/blob/master/CHANGELOG.md)
- [Commits](https://github.com/siimon/prom-client/compare/v15.1.2...v15.1.3)

---
updated-dependencies:
- dependency-name: prom-client
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-06-28 19:57:39 +00:00
dependabot[bot]
f7b1796807 chore(deps): bump smol-toml from 1.2.1 to 1.2.2 (#10307)
Bumps [smol-toml](https://github.com/squirrelchat/smol-toml) from 1.2.1 to 1.2.2.
- [Release notes](https://github.com/squirrelchat/smol-toml/releases)
- [Commits](https://github.com/squirrelchat/smol-toml/compare/v1.2.1...v1.2.2)

---
updated-dependencies:
- dependency-name: smol-toml
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-06-28 19:56:47 +00:00
dependabot[bot]
2439cd2fce chore(deps-dev): bump node-mocks-http from 1.14.1 to 1.15.0 (#10308)
Bumps [node-mocks-http](https://github.com/eugef/node-mocks-http) from 1.14.1 to 1.15.0.
- [Release notes](https://github.com/eugef/node-mocks-http/releases)
- [Changelog](https://github.com/eugef/node-mocks-http/blob/master/HISTORY.md)
- [Commits](https://github.com/eugef/node-mocks-http/compare/v1.14.1...v1.15.0)

---
updated-dependencies:
- dependency-name: node-mocks-http
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-06-28 18:53:16 +00:00
dependabot[bot]
aa10d0b092 chore(deps-dev): bump @typescript-eslint/parser from 7.13.1 to 7.14.1 (#10305)
Bumps [@typescript-eslint/parser](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/parser) from 7.13.1 to 7.14.1.
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/parser/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v7.14.1/packages/parser)

---
updated-dependencies:
- dependency-name: "@typescript-eslint/parser"
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-06-28 18:52:47 +00:00
dependabot[bot]
035e729313 chore(deps): bump @sentry/node from 8.11.0 to 8.13.0 (#10306)
Bumps [@sentry/node](https://github.com/getsentry/sentry-javascript) from 8.11.0 to 8.13.0.
- [Release notes](https://github.com/getsentry/sentry-javascript/releases)
- [Changelog](https://github.com/getsentry/sentry-javascript/blob/develop/CHANGELOG.md)
- [Commits](https://github.com/getsentry/sentry-javascript/compare/8.11.0...8.13.0)

---
updated-dependencies:
- dependency-name: "@sentry/node"
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-06-28 18:52:44 +00:00
dependabot[bot]
5f6a48eabd chore(deps-dev): bump mocha from 10.4.0 to 10.5.2 (#10309)
Bumps [mocha](https://github.com/mochajs/mocha) from 10.4.0 to 10.5.2.
- [Release notes](https://github.com/mochajs/mocha/releases)
- [Changelog](https://github.com/mochajs/mocha/blob/main/CHANGELOG.md)
- [Commits](https://github.com/mochajs/mocha/compare/v10.4.0...v10.5.2)

---
updated-dependencies:
- dependency-name: mocha
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-06-28 18:52:42 +00:00
dependabot[bot]
5b813ce908 chore(deps): bump config from 3.3.11 to 3.3.12 (#10310)
Bumps [config](https://github.com/node-config/node-config) from 3.3.11 to 3.3.12.
- [Release notes](https://github.com/node-config/node-config/releases)
- [Changelog](https://github.com/node-config/node-config/blob/master/History.md)
- [Commits](https://github.com/node-config/node-config/compare/v3.3.11...v3.3.12)

---
updated-dependencies:
- dependency-name: config
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-06-28 18:52:39 +00:00
dependabot[bot]
c63244562d chore(deps): bump node-pg-migrate from 7.5.0 to 7.5.2 (#10314)
Bumps [node-pg-migrate](https://github.com/salsita/node-pg-migrate) from 7.5.0 to 7.5.2.
- [Release notes](https://github.com/salsita/node-pg-migrate/releases)
- [Changelog](https://github.com/salsita/node-pg-migrate/blob/main/CHANGELOG.md)
- [Commits](https://github.com/salsita/node-pg-migrate/compare/v7.5.0...v7.5.2)

---
updated-dependencies:
- dependency-name: node-pg-migrate
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-06-28 18:49:54 +00:00
dependabot[bot]
97ca295662 chore(deps-dev): bump eslint-plugin-jsdoc from 48.2.12 to 48.5.0 (#10315)
Bumps [eslint-plugin-jsdoc](https://github.com/gajus/eslint-plugin-jsdoc) from 48.2.12 to 48.5.0.
- [Release notes](https://github.com/gajus/eslint-plugin-jsdoc/releases)
- [Changelog](https://github.com/gajus/eslint-plugin-jsdoc/blob/main/.releaserc)
- [Commits](https://github.com/gajus/eslint-plugin-jsdoc/compare/v48.2.12...v48.5.0)

---
updated-dependencies:
- dependency-name: eslint-plugin-jsdoc
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-06-28 18:49:43 +00:00
chris48s
61a6963919 fix npm badges when maintainers not in response (#10286) 2024-06-26 18:56:17 +00:00
chris48s
5c8129904f Expose logoBase64 and links in badge-maker NPM package (#10283)
* expose `logoBase64` and `links` in badge-maker NPM package

* add test assertion for logoBase64

* pass (public) `logoBase64` as (internal) `logo`

* badge-maker 4.0.0 release

---------

Co-authored-by: Sergey Kupletsky <s.kupletsky@gmail.com>
2024-06-24 14:53:31 +01:00
chris48s
677e713310 Remove logoPosition (#10284)
* remove logoPosition param

* finish the job of removing logoPosition

---------

Co-authored-by: Sergey Kupletsky <s.kupletsky@gmail.com>
2024-06-24 13:26:48 +00:00
Chris Young
92718ff98b [MBIN] Add subscribers badge (#10270)
* Add Mbin support

* Add tests for Mbin

* Update services/mbin/mbin.service.js

Remove extra space from description

Co-authored-by: Pierre-Yves Bigourdan <10694593+PyvesB@users.noreply.github.com>

* Remove test for bad server or connection

* Removed timeout

* Run not found test against live server

* Use isMetric for test

---------

Co-authored-by: Pierre-Yves Bigourdan <10694593+PyvesB@users.noreply.github.com>
2024-06-23 21:25:29 +00:00
dependabot[bot]
0c17d9d44d chore(deps): bump node-pg-migrate from 7.4.0 to 7.5.0 (#10273)
Bumps [node-pg-migrate](https://github.com/salsita/node-pg-migrate) from 7.4.0 to 7.5.0.
- [Release notes](https://github.com/salsita/node-pg-migrate/releases)
- [Changelog](https://github.com/salsita/node-pg-migrate/blob/main/CHANGELOG.md)
- [Commits](https://github.com/salsita/node-pg-migrate/compare/v7.4.0...v7.5.0)

---
updated-dependencies:
- dependency-name: node-pg-migrate
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-06-22 16:37:02 +00:00
dependabot[bot]
02608e1242 chore(deps-dev): bump cypress from 13.11.0 to 13.12.0 (#10276)
Bumps [cypress](https://github.com/cypress-io/cypress) from 13.11.0 to 13.12.0.
- [Release notes](https://github.com/cypress-io/cypress/releases)
- [Changelog](https://github.com/cypress-io/cypress/blob/develop/CHANGELOG.md)
- [Commits](https://github.com/cypress-io/cypress/compare/v13.11.0...v13.12.0)

---
updated-dependencies:
- dependency-name: cypress
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-06-21 19:27:59 +00:00
dependabot[bot]
250686f147 chore(deps-dev): bump @easyops-cn/docusaurus-search-local (#10278)
Bumps [@easyops-cn/docusaurus-search-local](https://github.com/easyops-cn/docusaurus-search-local/tree/HEAD/packages/docusaurus-search-local) from 0.44.0 to 0.44.2.
- [Release notes](https://github.com/easyops-cn/docusaurus-search-local/releases)
- [Commits](https://github.com/easyops-cn/docusaurus-search-local/commits/v0.44.2/packages/docusaurus-search-local)

---
updated-dependencies:
- dependency-name: "@easyops-cn/docusaurus-search-local"
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-06-21 19:23:54 +00:00
dependabot[bot]
35d5e9d964 chore(deps): bump glob from 10.4.1 to 10.4.2 (#10275)
Bumps [glob](https://github.com/isaacs/node-glob) from 10.4.1 to 10.4.2.
- [Changelog](https://github.com/isaacs/node-glob/blob/main/changelog.md)
- [Commits](https://github.com/isaacs/node-glob/compare/v10.4.1...v10.4.2)

---
updated-dependencies:
- dependency-name: glob
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-06-21 19:22:48 +00:00
dependabot[bot]
8eff4f51e4 chore(deps): bump @sentry/node from 8.9.2 to 8.11.0 (#10274)
Bumps [@sentry/node](https://github.com/getsentry/sentry-javascript) from 8.9.2 to 8.11.0.
- [Release notes](https://github.com/getsentry/sentry-javascript/releases)
- [Changelog](https://github.com/getsentry/sentry-javascript/blob/8.11.0/CHANGELOG.md)
- [Commits](https://github.com/getsentry/sentry-javascript/compare/8.9.2...8.11.0)

---
updated-dependencies:
- dependency-name: "@sentry/node"
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-06-21 19:22:26 +00:00
dependabot[bot]
1445c3d21a chore(deps): bump joi from 17.13.1 to 17.13.3 (#10272)
Bumps [joi](https://github.com/hapijs/joi) from 17.13.1 to 17.13.3.
- [Commits](https://github.com/hapijs/joi/compare/v17.13.1...v17.13.3)

---
updated-dependencies:
- dependency-name: joi
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-06-21 19:21:38 +00:00
dependabot[bot]
95382dd5ce chore(deps): bump docker/build-push-action from 5 to 6 (#10266)
Bumps [docker/build-push-action](https://github.com/docker/build-push-action) from 5 to 6.
- [Release notes](https://github.com/docker/build-push-action/releases)
- [Commits](https://github.com/docker/build-push-action/compare/v5...v6)

---
updated-dependencies:
- dependency-name: docker/build-push-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-06-21 19:20:15 +00:00
dependabot[bot]
5ae8b29923 chore(deps-dev): bump ws from 6.2.2 to 6.2.3 (#10267)
Bumps [ws](https://github.com/websockets/ws) from 6.2.2 to 6.2.3.
- [Release notes](https://github.com/websockets/ws/releases)
- [Commits](https://github.com/websockets/ws/compare/6.2.2...6.2.3)

---
updated-dependencies:
- dependency-name: ws
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-06-21 19:14:04 +00:00
dependabot[bot]
8303f43f2a chore(deps-dev): bump tsd from 0.31.0 to 0.31.1 (#10280)
Bumps [tsd](https://github.com/tsdjs/tsd) from 0.31.0 to 0.31.1.
- [Release notes](https://github.com/tsdjs/tsd/releases)
- [Commits](https://github.com/tsdjs/tsd/compare/v0.31.0...v0.31.1)

---
updated-dependencies:
- dependency-name: tsd
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-06-21 19:12:25 +00:00
dependabot[bot]
3509d1faf6 chore(deps-dev): bump nodemon from 3.1.3 to 3.1.4 (#10279)
Bumps [nodemon](https://github.com/remy/nodemon) from 3.1.3 to 3.1.4.
- [Release notes](https://github.com/remy/nodemon/releases)
- [Commits](https://github.com/remy/nodemon/compare/v3.1.3...v3.1.4)

---
updated-dependencies:
- dependency-name: nodemon
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-06-21 19:12:10 +00:00
dependabot[bot]
283ef0bade chore(deps-dev): bump danger from 12.3.1 to 12.3.3 (#10281)
Bumps [danger](https://github.com/danger/danger-js) from 12.3.1 to 12.3.3.
- [Release notes](https://github.com/danger/danger-js/releases)
- [Changelog](https://github.com/danger/danger-js/blob/main/CHANGELOG.md)
- [Commits](https://github.com/danger/danger-js/compare/12.3.1...12.3.3)

---
updated-dependencies:
- dependency-name: danger
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-06-21 19:11:52 +00:00
dependabot[bot]
d2344ed220 chore(deps-dev): bump eslint-plugin-react from 7.34.2 to 7.34.3 (#10271)
Bumps [eslint-plugin-react](https://github.com/jsx-eslint/eslint-plugin-react) from 7.34.2 to 7.34.3.
- [Release notes](https://github.com/jsx-eslint/eslint-plugin-react/releases)
- [Changelog](https://github.com/jsx-eslint/eslint-plugin-react/blob/master/CHANGELOG.md)
- [Commits](https://github.com/jsx-eslint/eslint-plugin-react/compare/v7.34.2...v7.34.3)

---
updated-dependencies:
- dependency-name: eslint-plugin-react
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-06-21 19:11:36 +00:00
dependabot[bot]
5aae2fdbd5 chore(deps-dev): bump @typescript-eslint/parser from 7.13.0 to 7.13.1 (#10277)
Bumps [@typescript-eslint/parser](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/parser) from 7.13.0 to 7.13.1.
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/parser/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v7.13.1/packages/parser)

---
updated-dependencies:
- dependency-name: "@typescript-eslint/parser"
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-06-21 19:11:22 +00:00
27 changed files with 661 additions and 310 deletions

View File

@@ -21,7 +21,7 @@ jobs:
run: echo "SHORT_SHA=${GITHUB_SHA::7}" >> $GITHUB_ENV
- name: Build
uses: docker/build-push-action@v5
uses: docker/build-push-action@v6
with:
context: .
push: false

View File

@@ -46,7 +46,7 @@ jobs:
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push snapshot release to DockerHub
uses: docker/build-push-action@v5
uses: docker/build-push-action@v6
with:
context: .
push: true
@@ -62,7 +62,7 @@ jobs:
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push snapshot release to GHCR
uses: docker/build-push-action@v5
uses: docker/build-push-action@v6
with:
context: .
push: true

View File

@@ -30,7 +30,7 @@ jobs:
- name: Build and push to DockerHub
id: docker_build_push
uses: docker/build-push-action@v5
uses: docker/build-push-action@v6
with:
context: .
push: true
@@ -49,7 +49,7 @@ jobs:
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push to GHCR
uses: docker/build-push-action@v5
uses: docker/build-push-action@v6
with:
context: .
push: true

View File

@@ -4,6 +4,17 @@ Note: this changelog is for the shields.io server. The changelog for the badge-m
---
## server-2024-07-01
- Add [AUR] Popularity Badge [#10304](https://github.com/badges/shields/issues/10304)
- fix npm badges when `maintainers` not in response [#10286](https://github.com/badges/shields/issues/10286)
- Expose `logoBase64` and `links` in badge-maker NPM package [#10283](https://github.com/badges/shields/issues/10283)
- Remove `logoPosition` [#10284](https://github.com/badges/shields/issues/10284)
- [MBIN] Add subscribers badge [#10270](https://github.com/badges/shields/issues/10270)
- Add [Docker] support for loong64 arch [#10241](https://github.com/badges/shields/issues/10241)
- Add puppetforge quality score badges [#10201](https://github.com/badges/shields/issues/10201)
- Dependency updates
## server-2024-06-01
- Remove namedLogo from defaultBadgeData of non-social badges [#10195](https://github.com/badges/shields/issues/10195)

View File

@@ -1,9 +1,15 @@
# Changelog
## 4.0.0 [WIP]
## 4.0.0
### Breaking Changes
- Drop compatibility with Node < 16
### Features
- Add `links` and `logoBase64` params
## 3.3.1
- Improve font measuring in for-the-badge and social styles

View File

@@ -67,6 +67,8 @@ The format is the following:
message: 'passed', // (Required) Badge message
labelColor: '#555', // (Optional) Label color
color: '#4c1', // (Optional) Message color
logoBase64: 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI2NCIgaGVpZ2h0PSI2NCI+PHJlY3Qgd2lkdGg9IjY0IiBoZWlnaHQ9IjY0IiByeD0iOCIgZmlsbD0iI2IxY2U1NiIvPjxwYXRoIGQ9Ik04IDBoMjR2NjRIOGMtNC40MzIgMC04LTMuNTY4LTgtOFY4YzAtNC40MzIgMy41NjgtOCA4LTh6IiBmaWxsPSIjNWQ1ZDVkIi8+PC9zdmc+' // (Optional) Any custom logo can be passed in a URL parameter by base64 encoding
links: ['https://example.com', 'https://example.com'], // (Optional) Links array of maximum two links
// (Optional) One of: 'plastic', 'flat', 'flat-square', 'for-the-badge' or 'social'
// Each offers a different visual design.

View File

@@ -4,6 +4,8 @@ interface Format {
labelColor?: string
color?: string
style?: 'plastic' | 'flat' | 'flat-square' | 'for-the-badge' | 'social'
logoBase64?: string
links?: Array<string>
}
export declare class ValidationError extends Error {}

View File

@@ -16,13 +16,30 @@ function _validate(format) {
throw new ValidationError('Field `message` is required')
}
const stringFields = ['labelColor', 'color', 'message', 'label']
const stringFields = ['labelColor', 'color', 'message', 'label', 'logoBase64']
stringFields.forEach(function (field) {
if (field in format && typeof format[field] !== 'string') {
throw new ValidationError(`Field \`${field}\` must be of type string`)
}
})
if ('links' in format) {
if (!Array.isArray(format.links)) {
throw new ValidationError('Field `links` must be an array of strings')
} else {
if (format.links.length > 2) {
throw new ValidationError(
'Field `links` must not have more than 2 elements',
)
}
format.links.forEach(function (field) {
if (typeof field !== 'string') {
throw new ValidationError('Field `links` must be an array of strings')
}
})
}
}
const styleValues = [
'plastic',
'flat',
@@ -38,11 +55,21 @@ function _validate(format) {
}
function _clean(format) {
const expectedKeys = ['label', 'message', 'labelColor', 'color', 'style']
const expectedKeys = [
'label',
'message',
'labelColor',
'color',
'style',
'logoBase64',
'links',
]
const cleaned = {}
Object.keys(format).forEach(key => {
if (format[key] != null && expectedKeys.includes(key)) {
if (format[key] != null && key === 'logoBase64') {
cleaned.logo = format[key]
} else if (format[key] != null && expectedKeys.includes(key)) {
cleaned[key] = format[key]
} else {
throw new ValidationError(
@@ -65,7 +92,9 @@ function _clean(format) {
* @param {string} format.message (Required) Badge message (e.g: 'passing')
* @param {string} format.labelColor (Optional) Label color
* @param {string} format.color (Optional) Message color
* @param {string} format.style (Optional) Visual style e.g: 'flat'
* @param {string} format.style (Optional) Visual style (e.g: 'flat')
* @param {string} format.logoBase64 (Optional) Logo data URL
* @param {Array} format.links (Optional) Links array (e.g: ['https://example.com', 'https://example.com'])
* @returns {string} Badge in SVG format
* @see https://github.com/badges/shields/tree/master/badge-maker/README.md
*/

View File

@@ -25,6 +25,21 @@ describe('makeBadge function', function () {
style: 'flat',
}),
).to.satisfy(isSvg)
expect(
makeBadge({
label: 'build',
message: 'passed',
color: 'green',
style: 'flat',
labelColor: 'blue',
logoBase64: 'data:image/svg+xml;base64,PHN2ZyB4bWxu',
links: ['https://example.com', 'https://example.com'],
}),
)
.to.satisfy(isSvg)
// explicitly make an assertion about logoBase64
// this param is not a straight passthrough
.and.to.include('data:image/svg+xml;base64,PHN2ZyB4bWxu')
})
it('should throw a ValidationError with invalid inputs', function () {
@@ -46,6 +61,21 @@ describe('makeBadge function', function () {
expect(() =>
makeBadge({ label: 'build', message: 'passed', labelColor: 7 }),
).to.throw(ValidationError, 'Field `labelColor` must be of type string')
expect(() =>
makeBadge({ label: 'build', message: 'passed', logoBase64: 7 }),
).to.throw(ValidationError, 'Field `logoBase64` must be of type string')
expect(() =>
makeBadge({ label: 'build', message: 'passed', links: 'test' }),
).to.throw(ValidationError, 'Field `links` must be an array of strings')
expect(() =>
makeBadge({ label: 'build', message: 'passed', links: [1] }),
).to.throw(ValidationError, 'Field `links` must be an array of strings')
expect(() =>
makeBadge({ label: 'build', message: 'passed', links: ['1', '2', '3'] }),
).to.throw(
ValidationError,
'Field `links` must not have more than 2 elements',
)
expect(() =>
makeBadge({ label: 'build', message: 'passed', format: 'png' }),
).to.throw(ValidationError, "Unexpected field 'format'")

View File

@@ -17,7 +17,6 @@ module.exports = function makeBadge({
color,
labelColor,
logo,
logoPosition,
logoSize,
logoWidth,
links = ['', ''],
@@ -55,7 +54,6 @@ module.exports = function makeBadge({
message,
links,
logo,
logoPosition,
logoWidth,
logoSize,
logoPadding: logo && label.length ? 3 : 0,

View File

@@ -1,6 +1,6 @@
{
"name": "badge-maker",
"version": "3.3.1",
"version": "4.0.0",
"description": "Shields.io badge library",
"keywords": [
"GitHub",

View File

@@ -66,7 +66,6 @@ const serviceDataSchema = Joi.object({
logoSvg: Joi.string(),
logoColor: optionalStringWhenNamedLogoPresent,
logoWidth: optionalNumberWhenAnyLogoPresent,
logoPosition: optionalNumberWhenAnyLogoPresent,
cacheSeconds: Joi.number().integer().min(0),
style: Joi.string(),
})

View File

@@ -378,7 +378,6 @@ describe('BaseService', function () {
logo: undefined,
logoWidth: undefined,
logoSize: undefined,
logoPosition: undefined,
links: [],
labelColor: undefined,
cacheLengthSeconds: undefined,

View File

@@ -23,9 +23,8 @@ import toArray from './to-array.js'
// base64-encoded logos). Otherwise the default color is used. If the color
// is specified for a multicolor Shield logo, the named logo will be used and
// colored. The appearance of the logo can be customized using `logoWidth`,
// and in the case of the popout badge, `logoPosition`. When `?logo=` is
// specified, any logo-related parameters specified dynamically by the
// service, or by default in the service, are ignored.
// When `?logo=` is specified, any logo-related parameters specified
// dynamically by the service, or by default in the service, are ignored.
// 2. The second precedence is the dynamic logo returned by a service. This is
// used only by the Endpoint badge. The `logoColor` can be overridden by the
// query string.
@@ -56,7 +55,6 @@ export default function coalesceBadge(
} = overrides
let {
logoWidth: overrideLogoWidth,
logoPosition: overrideLogoPosition,
logoSize: overrideLogoSize,
color: overrideColor,
labelColor: overrideLabelColor,
@@ -78,7 +76,6 @@ export default function coalesceBadge(
overrideLabelColor = `${overrideLabelColor}`
}
overrideLogoWidth = +overrideLogoWidth || undefined
overrideLogoPosition = +overrideLogoPosition || undefined
const {
isError,
@@ -91,7 +88,6 @@ export default function coalesceBadge(
logoColor: serviceLogoColor,
logoSize: serviceLogoSize,
logoWidth: serviceLogoWidth,
logoPosition: serviceLogoPosition,
link: serviceLink,
cacheSeconds: serviceCacheSeconds,
style: serviceStyle,
@@ -122,12 +118,7 @@ export default function coalesceBadge(
style = 'flat'
}
let namedLogo,
namedLogoColor,
logoSize,
logoWidth,
logoPosition,
logoSvgBase64
let namedLogo, namedLogoColor, logoSize, logoWidth, logoSvgBase64
if (overrideLogo) {
// `?logo=` could be a named logo or encoded svg.
const overrideLogoSvgBase64 = decodeDataUrlFromQueryParam(overrideLogo)
@@ -143,7 +134,6 @@ export default function coalesceBadge(
// original width or position.
logoSize = overrideLogoSize
logoWidth = overrideLogoWidth
logoPosition = overrideLogoPosition
} else {
if (serviceLogoSvg) {
logoSvgBase64 = svg2base64(serviceLogoSvg)
@@ -156,7 +146,6 @@ export default function coalesceBadge(
}
logoSize = coalesce(overrideLogoSize, serviceLogoSize)
logoWidth = coalesce(overrideLogoWidth, serviceLogoWidth)
logoPosition = coalesce(overrideLogoPosition, serviceLogoPosition)
}
if (namedLogo) {
const iconSize = getIconSize(String(namedLogo).toLowerCase())
@@ -195,7 +184,6 @@ export default function coalesceBadge(
namedLogo,
logo: logoSvgBase64,
logoWidth,
logoPosition,
logoSize,
links: toArray(overrideLink || serviceLink),
cacheLengthSeconds: coalesce(serviceCacheSeconds, defaultCacheSeconds),

View File

@@ -195,14 +195,13 @@ describe('coalesceBadge', function () {
).to.equal(getSimpleIcon({ name: 'npm', color: 'blue' })).and.not.be.empty
})
it("when the logo is overridden, it ignores the service's logo color, position, and width", function () {
it("when the logo is overridden, it ignores the service's logo color and width", function () {
expect(
coalesceBadge(
{ logo: 'npm' },
{
namedLogo: 'appveyor',
logoColor: 'red',
logoPosition: -3,
logoWidth: 100,
},
{},
@@ -288,20 +287,6 @@ describe('coalesceBadge', function () {
})
})
describe('Logo position', function () {
it('overrides the logoPosition', function () {
expect(coalesceBadge({ logoPosition: -10 }, {}, {})).to.include({
logoPosition: -10,
})
})
it('applies the logo position', function () {
expect(
coalesceBadge({}, { namedLogo: 'npm', logoPosition: -10 }, {}),
).to.include({ logoPosition: -10 })
})
})
describe('Links', function () {
it('overrides the links', function () {
expect(

View File

@@ -11,7 +11,6 @@ const globalQueryParams = new Set([
'link',
'logo',
'logoColor',
'logoPosition',
'logoSize',
'logoWidth',
'link',

578
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -23,7 +23,7 @@
"dependencies": {
"@renovatebot/pep440": "^3.0.20",
"@renovatebot/ruby-semver": "^3.0.23",
"@sentry/node": "^8.9.2",
"@sentry/node": "^8.13.0",
"@shields_io/camp": "^18.1.2",
"@xmldom/xmldom": "0.8.10",
"badge-maker": "file:badge-maker",
@@ -32,19 +32,19 @@
"chalk": "^5.3.0",
"check-node-version": "^4.2.1",
"cloudflare-middleware": "^1.0.4",
"config": "^3.3.11",
"config": "^3.3.12",
"cross-env": "^7.0.3",
"dayjs": "^1.11.11",
"decamelize": "^3.2.0",
"emojic": "^1.1.17",
"escape-string-regexp": "^4.0.0",
"fast-xml-parser": "^4.4.0",
"glob": "^10.4.1",
"glob": "^10.4.2",
"global-agent": "^3.0.0",
"got": "^14.4.1",
"graphql": "16.8.2",
"graphql": "16.9.0",
"graphql-tag": "^2.12.6",
"joi": "17.13.1",
"joi": "17.13.3",
"joi-extension-semver": "5.0.0",
"js-yaml": "^4.1.0",
"jsonpath": "~1.1.1",
@@ -53,18 +53,18 @@
"lodash.times": "^4.3.2",
"matcher": "^5.0.0",
"node-env-flag": "^0.1.0",
"node-pg-migrate": "^7.4.0",
"node-pg-migrate": "^7.5.2",
"parse-link-header": "^2.0.0",
"path-to-regexp": "^6.2.2",
"pg": "^8.12.0",
"pretty-bytes": "^6.1.1",
"priorityqueuejs": "^2.0.0",
"prom-client": "^15.1.2",
"prom-client": "^15.1.3",
"qs": "^6.12.1",
"query-string": "^9.0.0",
"semver": "~7.6.2",
"simple-icons": "12.3.0",
"smol-toml": "1.2.1",
"simple-icons": "12.4.0",
"smol-toml": "1.2.2",
"svg-path-commander": "^2.0.9",
"webextension-store-meta": "^1.2.3",
"xpath": "~0.0.34"
@@ -147,9 +147,9 @@
"devDependencies": {
"@docusaurus/core": "^3.4.0",
"@docusaurus/preset-classic": "^3.4.0",
"@easyops-cn/docusaurus-search-local": "^0.44.0",
"@easyops-cn/docusaurus-search-local": "^0.44.2",
"@mdx-js/react": "^3.0.1",
"@typescript-eslint/parser": "^7.13.0",
"@typescript-eslint/parser": "^7.14.1",
"c8": "^10.1.2",
"caller": "^1.1.0",
"chai": "^4.4.1",
@@ -159,9 +159,9 @@
"child-process-promise": "^2.2.1",
"clsx": "^2.1.1",
"concurrently": "^8.2.2",
"cypress": "^13.11.0",
"cypress": "^13.12.0",
"cypress-wait-for-stable-dom": "^0.1.0",
"danger": "^12.3.1",
"danger": "^12.3.3",
"deepmerge": "^4.3.1",
"docusaurus-preset-openapi": "0.7.5",
"eslint": "8.57.0",
@@ -173,12 +173,12 @@
"eslint-plugin-cypress": "^3.3.0",
"eslint-plugin-icedfrisby": "^0.1.0",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-jsdoc": "^48.2.12",
"eslint-plugin-jsdoc": "^48.5.0",
"eslint-plugin-mocha": "^10.4.3",
"eslint-plugin-no-extension-in-require": "^0.2.0",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-promise": "6.2.0",
"eslint-plugin-react": "^7.34.2",
"eslint-plugin-react": "^7.34.3",
"eslint-plugin-react-hooks": "^4.6.2",
"eslint-plugin-sort-class-members": "^1.20.0",
"form-data": "^4.0.0",
@@ -189,13 +189,13 @@
"lint-staged": "^15.2.7",
"lodash.difference": "^4.5.0",
"minimist": "^1.2.8",
"mocha": "^10.4.0",
"mocha": "^10.5.2",
"mocha-env-reporter": "^4.0.0",
"mocha-junit-reporter": "^2.2.1",
"mocha-yaml-loader": "^1.0.3",
"nock": "13.5.4",
"node-mocks-http": "^1.14.1",
"nodemon": "^3.1.3",
"node-mocks-http": "^1.15.0",
"nodemon": "^3.1.4",
"npm-run-all": "^4.1.5",
"open-cli": "^8.0.0",
"portfinder": "^1.0.32",
@@ -211,7 +211,7 @@
"sinon-chai": "^3.7.0",
"snap-shot-it": "^7.9.10",
"start-server-and-test": "2.0.4",
"tsd": "^0.31.0",
"tsd": "^0.31.1",
"url": "^0.11.3"
},
"engines": {

View File

@@ -20,6 +20,7 @@ const aurSchema = Joi.object({
Joi.object({
License: Joi.array().items(Joi.string().required()).allow(null),
NumVotes: nonNegativeInteger,
Popularity: Joi.number().precision(2).min(0).required(),
Version: Joi.string().required(),
OutOfDate: nonNegativeInteger.allow(null),
Maintainer: Joi.string().required().allow(null),
@@ -118,6 +119,36 @@ class AurVotes extends BaseAurService {
}
}
class AurPopularity extends BaseAurService {
static category = 'rating'
static route = { base: 'aur/popularity', pattern: ':packageName' }
static openApi = {
'/aur/popularity/{packageName}': {
get: {
summary: 'AUR Popularity',
description: 'Arch linux User Repository Popularity',
parameters: pathParams({ name: 'packageName', example: 'dropbox' }),
},
},
}
static defaultBadgeData = { label: 'popularity' }
static render({ popularity }) {
return {
message: popularity,
color: floorCountColor(popularity, 0.5, 2.5, 5),
}
}
async handle({ packageName }) {
const json = await this.fetch({ packageName })
return this.constructor.render({ popularity: json.results[0].Popularity })
}
}
class AurVersion extends BaseAurService {
static category = 'version'
static route = { base: 'aur/version', pattern: ':packageName' }
@@ -224,4 +255,11 @@ class AurLastModified extends BaseAurService {
}
}
export { AurLicense, AurVersion, AurVotes, AurMaintainer, AurLastModified }
export {
AurLicense,
AurVersion,
AurVotes,
AurPopularity,
AurMaintainer,
AurLastModified,
}

View File

@@ -1,3 +1,4 @@
import Joi from 'joi'
import { ServiceTester } from '../tester.js'
import {
isVPlusDottedVersionNClausesWithOptionalSuffix,
@@ -35,6 +36,19 @@ t.create('votes (not found)')
.get('/votes/not-a-package.json')
.expectBadge({ label: 'votes', message: 'package not found' })
// popularity tests
t.create('popularity (valid)')
.get('/popularity/google-chrome.json')
.expectBadge({
label: 'popularity',
message: Joi.number().precision(2).required(),
})
t.create('popularity (not found)')
.get('/popularity/not-a-package.json')
.expectBadge({ label: 'popularity', message: 'package not found' })
// license tests
t.create('license (valid)')
@@ -57,6 +71,7 @@ t.create('license (no license)')
{
License: null,
NumVotes: 1,
Popularity: 0,
Version: '1',
OutOfDate: null,
Maintainer: null,

View File

@@ -36,9 +36,14 @@ const endpointSchema = Joi.object({
logoSvg: Joi.string(),
logoColor: optionalStringWhenNamedLogoPresent,
logoWidth: optionalNumberWhenAnyLogoPresent,
logoPosition: optionalNumberWhenAnyLogoPresent,
style: Joi.string(),
cacheSeconds: Joi.number().integer().min(0),
/*
Retained for legacy compatibility
Although this does nothing,
passing it should not throw an error
*/
logoPosition: optionalNumberWhenAnyLogoPresent,
})
// `namedLogo` or `logoSvg`; not both.
.oxor('namedLogo', 'logoSvg')

View File

@@ -102,13 +102,6 @@ The endpoint badge takes a single required query param: <code>url</code>, which
the query string.
</td>
</tr>
<tr>
<td><code>logoPosition</code></td>
<td>
Default: none. Same meaning as the query string. Can be overridden by
the query string.
</td>
</tr>
<tr>
<td><code>style</code></td>
<td>
@@ -157,7 +150,6 @@ export default class Endpoint extends BaseJsonService {
logoSvg,
logoColor,
logoWidth,
logoPosition,
style,
cacheSeconds,
}) {
@@ -171,7 +163,6 @@ export default class Endpoint extends BaseJsonService {
logoSvg,
logoColor,
logoWidth,
logoPosition,
style,
// don't allow the user to set cacheSeconds any shorter than this._cacheLength
cacheSeconds: Math.max(

View File

@@ -119,6 +119,24 @@ t.create('logoWidth')
logoWidth: 30,
})
// The logoPosition param was removed, but passing it should not
// throw a validation error. It should just do nothing.
t.create('logoPosition')
.get('.json?url=https://example.com/badge')
.intercept(nock =>
nock('https://example.com/').get('/badge').reply(200, {
schemaVersion: 1,
label: 'hey',
message: 'yo',
logoSvg,
logoPosition: 30,
}),
)
.expectBadge({
label: 'hey',
message: 'yo',
})
t.create('Invalid schema')
.get('.json?url=https://example.com/badge')
.intercept(nock =>

View File

@@ -0,0 +1,70 @@
import Joi from 'joi'
import { metric } from '../text-formatters.js'
import { BaseJsonService, InvalidParameter, pathParams } from '../index.js'
const schema = Joi.object({
subscriptionsCount: Joi.number().required(),
}).required()
export default class Mbin extends BaseJsonService {
static category = 'social'
static route = {
base: 'mbin',
pattern: ':magazine',
}
static openApi = {
'/mbin/{magazine}': {
get: {
summary: 'Mbin',
description:
'Mbin is a fork of Kbin, a content aggregator for the Fediverse.',
parameters: pathParams({
name: 'magazine',
description: 'The magazine to query. This is CASE SENSITIVE.',
example: 'teletext@fedia.io',
}),
},
},
}
static defaultBadgeData = { label: 'magazine', namedLogo: 'activitypub' }
static render({ magazine, members }) {
return {
label: `subscribe to ${magazine}`,
message: metric(members),
style: 'social',
color: 'brightgreen',
}
}
async fetch({ magazine }) {
const splitAlias = magazine.split('@')
// The magazine will be in the format of 'magazine@server'
if (splitAlias.length !== 2) {
throw new InvalidParameter({
prettyMessage: 'invalid magazine',
})
}
const mag = splitAlias[0]
const host = splitAlias[1]
const data = await this._requestJson({
url: `https://${host}/api/magazine/name/${mag}`,
schema,
httpErrors: {
404: 'magazine not found',
},
})
return data.subscriptionsCount
}
async handle({ magazine }) {
const members = await this.fetch({ magazine })
return this.constructor.render({ magazine, members })
}
}

View File

@@ -0,0 +1,43 @@
import { isMetric } from '../test-validators.js'
import { createServiceTester } from '../tester.js'
export const t = await createServiceTester()
t.create('get magazine subscribers')
.get('/magazine@instance.tld.json')
.intercept(nock =>
nock('https://instance.tld/')
.get('/api/magazine/name/magazine')
.reply(
200,
JSON.stringify({
subscriptionsCount: 42,
}),
),
)
.expectBadge({
label: 'subscribe to magazine@instance.tld',
message: '42',
color: 'brightgreen',
})
t.create('unknown community')
.get('/01J12N2ETYG3W5B6G8Y11F5EXG@fedia.io.json')
.expectBadge({
label: 'magazine',
message: 'magazine not found',
color: 'red',
})
t.create('invalid magazine').get('/magazine.invalid.json').expectBadge({
label: 'magazine',
message: 'invalid magazine',
color: 'red',
})
t.create('test on real mbin magazine for API compliance')
.get('/teletext@fedia.io.json')
.expectBadge({
label: 'subscribe to teletext@fedia.io',
message: isMetric,
color: 'brightgreen',
})

View File

@@ -21,7 +21,7 @@ const packageDataSchema = Joi.object({
maintainers: Joi.array()
// We don't need the keys here, just the length.
.items(Joi.object({}))
.required(),
.default([]),
types: Joi.string(),
// `typings` is an alias for `types` and often used
// https://www.typescriptlang.org/docs/handbook/declaration-files/publishing.html#including-declarations-in-your-npm-package

View File

@@ -16,3 +16,12 @@ t.create('contributor count for unknown package')
label: 'npm collaborators',
message: 'package not found',
})
t.create('contributor count for package package without a maintainers property')
.get('/package-without-maintainers.json')
.intercept(nock =>
nock('https://registry.npmjs.org')
.get('/package-without-maintainers/latest')
.reply(200, {}),
)
.expectBadge({ label: 'npm collaborators', message: '0' })