Compare commits

...

49 Commits

Author SHA1 Message Date
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
dependabot[bot]
870b3f4be2 chore(deps): bump simple-icons from 12.2.0 to 12.3.0 (#10263)
Bumps [simple-icons](https://github.com/simple-icons/simple-icons) from 12.2.0 to 12.3.0.
- [Release notes](https://github.com/simple-icons/simple-icons/releases)
- [Commits](https://github.com/simple-icons/simple-icons/compare/12.2.0...12.3.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-16 16:16:10 +00:00
Pierre-Yves Bigourdan
d69661600e Improve Docusaurus Dependabot setup (#10262)
* Improve Docusaurus Dependabot setup

* Add slashes to patterns
2024-06-16 15:50:54 +00:00
dependabot[bot]
05f0d866da chore(deps): bump simple-icons from 12.1.0 to 12.2.0 (#10255)
Bumps [simple-icons](https://github.com/simple-icons/simple-icons) from 12.1.0 to 12.2.0.
- [Release notes](https://github.com/simple-icons/simple-icons/releases)
- [Commits](https://github.com/simple-icons/simple-icons/compare/12.1.0...12.2.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-14 18:05:30 +00:00
dependabot[bot]
2f2df5ba06 chore(deps-dev): bump @typescript-eslint/parser from 7.12.0 to 7.13.0 (#10258)
Bumps [@typescript-eslint/parser](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/parser) from 7.12.0 to 7.13.0.
- [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.0/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-14 17:59:29 +00:00
dependabot[bot]
f905aa4fbe chore(deps): bump graphql from 16.8.1 to 16.8.2 (#10253)
Bumps [graphql](https://github.com/graphql/graphql-js) from 16.8.1 to 16.8.2.
- [Release notes](https://github.com/graphql/graphql-js/releases)
- [Commits](https://github.com/graphql/graphql-js/compare/v16.8.1...v16.8.2)

---
updated-dependencies:
- dependency-name: graphql
  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-14 17:48:51 +00:00
dependabot[bot]
497189f007 chore(deps-dev): bump lint-staged from 15.2.5 to 15.2.7 (#10256)
Bumps [lint-staged](https://github.com/okonet/lint-staged) from 15.2.5 to 15.2.7.
- [Release notes](https://github.com/okonet/lint-staged/releases)
- [Changelog](https://github.com/lint-staged/lint-staged/blob/master/CHANGELOG.md)
- [Commits](https://github.com/okonet/lint-staged/compare/v15.2.5...v15.2.7)

---
updated-dependencies:
- dependency-name: lint-staged
  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-14 17:46:36 +00:00
dependabot[bot]
73c4f45eee chore(deps): bump @sentry/node from 8.8.0 to 8.9.2 (#10259)
Bumps [@sentry/node](https://github.com/getsentry/sentry-javascript) from 8.8.0 to 8.9.2.
- [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.8.0...8.9.2)

---
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-14 17:45:30 +00:00
dependabot[bot]
b5c69ce1bb chore(deps-dev): bump c8 from 9.1.0 to 10.1.2 (#10252)
Bumps [c8](https://github.com/bcoe/c8) from 9.1.0 to 10.1.2.
- [Release notes](https://github.com/bcoe/c8/releases)
- [Changelog](https://github.com/bcoe/c8/blob/main/CHANGELOG.md)
- [Commits](https://github.com/bcoe/c8/compare/v9.1.0...v10.1.2)

---
updated-dependencies:
- dependency-name: c8
  dependency-type: direct:development
  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-14 17:45:07 +00:00
dependabot[bot]
ed9f4bf2ff chore(deps-dev): bump chai-as-promised from 7.1.2 to 8.0.0 (#10254)
Bumps [chai-as-promised](https://github.com/chaijs/chai-as-promised) from 7.1.2 to 8.0.0.
- [Release notes](https://github.com/chaijs/chai-as-promised/releases)
- [Commits](https://github.com/chaijs/chai-as-promised/compare/v7.1.2...v8.0.0)

---
updated-dependencies:
- dependency-name: chai-as-promised
  dependency-type: direct:development
  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-14 17:44:51 +00:00
dependabot[bot]
18e9b2aa37 chore(deps-dev): bump eslint-plugin-jsdoc from 48.2.9 to 48.2.12 (#10257)
Bumps [eslint-plugin-jsdoc](https://github.com/gajus/eslint-plugin-jsdoc) from 48.2.9 to 48.2.12.
- [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.9...v48.2.12)

---
updated-dependencies:
- dependency-name: eslint-plugin-jsdoc
  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-14 17:44:13 +00:00
dependabot[bot]
95df3200f4 chore(deps-dev): bump prettier from 3.3.1 to 3.3.2 (#10260)
Bumps [prettier](https://github.com/prettier/prettier) from 3.3.1 to 3.3.2.
- [Release notes](https://github.com/prettier/prettier/releases)
- [Changelog](https://github.com/prettier/prettier/blob/main/CHANGELOG.md)
- [Commits](https://github.com/prettier/prettier/compare/3.3.1...3.3.2)

---
updated-dependencies:
- dependency-name: prettier
  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-14 17:43:58 +00:00
Pierre-Yves Bigourdan
8698fa1838 Update documentation and tests to [docsrs] (#10240)
* Update documentation and tests to [docsrs]

* Fix language identifier

* Replace tensorflow with tokio
2024-06-10 07:13:42 +00:00
Pierre-Yves Bigourdan
6be6c1d59f Add [Docker] support for loong64 arch (#10241)
* Add [Docker] support for loong64 arch

* Fix Docker version test
2024-06-09 22:42:25 +02:00
dependabot[bot]
0b4f0c837a chore(deps-dev): bump @docusaurus/core from 3.3.2 to 3.4.0 (#10239)
* chore(deps-dev): bump @docusaurus/core from 3.3.2 to 3.4.0

Bumps [@docusaurus/core](https://github.com/facebook/docusaurus/tree/HEAD/packages/docusaurus) from 3.3.2 to 3.4.0.
- [Release notes](https://github.com/facebook/docusaurus/releases)
- [Changelog](https://github.com/facebook/docusaurus/blob/main/CHANGELOG.md)
- [Commits](https://github.com/facebook/docusaurus/commits/v3.4.0/packages/docusaurus)

---
updated-dependencies:
- dependency-name: "@docusaurus/core"
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* update @docusaurus/preset-classic

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: chris48s <git@chris-shaw.dev>
2024-06-09 19:17:09 +00:00
dependabot[bot]
d33d57170f chore(deps-dev): bump cypress from 13.10.0 to 13.11.0 (#10229)
Bumps [cypress](https://github.com/cypress-io/cypress) from 13.10.0 to 13.11.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.10.0...v13.11.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-09 19:01:22 +00:00
dependabot[bot]
0360ba3a1b chore(deps): bump got from 14.3.0 to 14.4.1 (#10236)
Bumps [got](https://github.com/sindresorhus/got) from 14.3.0 to 14.4.1.
- [Release notes](https://github.com/sindresorhus/got/releases)
- [Commits](https://github.com/sindresorhus/got/compare/v14.3.0...v14.4.1)

---
updated-dependencies:
- dependency-name: got
  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-08 09:10:45 +00:00
dependabot[bot]
82769bd588 chore(deps-dev): bump @easyops-cn/docusaurus-search-local (#10233)
Bumps [@easyops-cn/docusaurus-search-local](https://github.com/easyops-cn/docusaurus-search-local/tree/HEAD/packages/docusaurus-search-local) from 0.41.0 to 0.44.0.
- [Release notes](https://github.com/easyops-cn/docusaurus-search-local/releases)
- [Commits](https://github.com/easyops-cn/docusaurus-search-local/commits/v0.44.0/packages/docusaurus-search-local)

---
updated-dependencies:
- dependency-name: "@easyops-cn/docusaurus-search-local"
  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-08 09:08:57 +00:00
dependabot[bot]
ba6bddf4bc chore(deps-dev): bump prettier from 3.2.5 to 3.3.1 (#10232)
Bumps [prettier](https://github.com/prettier/prettier) from 3.2.5 to 3.3.1.
- [Release notes](https://github.com/prettier/prettier/releases)
- [Changelog](https://github.com/prettier/prettier/blob/main/CHANGELOG.md)
- [Commits](https://github.com/prettier/prettier/compare/3.2.5...3.3.1)

---
updated-dependencies:
- dependency-name: prettier
  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-08 09:08:16 +00:00
dependabot[bot]
3bd604bc8e chore(deps-dev): bump @typescript-eslint/parser from 7.11.0 to 7.12.0 (#10228)
Bumps [@typescript-eslint/parser](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/parser) from 7.11.0 to 7.12.0.
- [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.12.0/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-08 09:03:45 +00:00
dependabot[bot]
d0f17a4f00 chore(deps-dev): bump danger from 12.3.0 to 12.3.1 (#10235)
Bumps [danger](https://github.com/danger/danger-js) from 12.3.0 to 12.3.1.
- [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.0...12.3.1)

---
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-08 09:03:16 +00:00
dependabot[bot]
cfa6bb3d69 chore(deps): bump @sentry/node from 8.7.0 to 8.8.0 (#10234)
Bumps [@sentry/node](https://github.com/getsentry/sentry-javascript) from 8.7.0 to 8.8.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.7.0...8.8.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-08 09:02:34 +00:00
dependabot[bot]
7a5628587e chore(deps): bump smol-toml from 1.2.0 to 1.2.1 (#10231)
Bumps [smol-toml](https://github.com/squirrelchat/smol-toml) from 1.2.0 to 1.2.1.
- [Release notes](https://github.com/squirrelchat/smol-toml/releases)
- [Commits](https://github.com/squirrelchat/smol-toml/compare/v1.2.0...v1.2.1)

---
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-08 08:56:54 +00:00
dependabot[bot]
db0ed00d0e chore(deps): bump pg from 8.11.5 to 8.12.0 (#10237)
Bumps [pg](https://github.com/brianc/node-postgres/tree/HEAD/packages/pg) from 8.11.5 to 8.12.0.
- [Changelog](https://github.com/brianc/node-postgres/blob/master/CHANGELOG.md)
- [Commits](https://github.com/brianc/node-postgres/commits/pg@8.12.0/packages/pg)

---
updated-dependencies:
- dependency-name: pg
  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-08 08:56:20 +00:00
dependabot[bot]
3fd95638de chore(deps-dev): bump nodemon from 3.1.2 to 3.1.3 (#10230)
Bumps [nodemon](https://github.com/remy/nodemon) from 3.1.2 to 3.1.3.
- [Release notes](https://github.com/remy/nodemon/releases)
- [Commits](https://github.com/remy/nodemon/compare/v3.1.2...v3.1.3)

---
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-08 08:52:46 +00:00
dependabot[bot]
f6f01a9337 chore(deps): bump simple-icons from 12.0.0 to 12.1.0 (#10227)
Bumps [simple-icons](https://github.com/simple-icons/simple-icons) from 12.0.0 to 12.1.0.
- [Release notes](https://github.com/simple-icons/simple-icons/releases)
- [Commits](https://github.com/simple-icons/simple-icons/compare/12.0.0...12.1.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-08 08:37:58 +00:00
dependabot[bot]
71d11eea4b chore(deps-dev): bump eslint-plugin-chai-friendly from 0.8.0 to 1.0.0 (#10226)
Bumps [eslint-plugin-chai-friendly](https://github.com/ihordiachenko/eslint-plugin-chai-friendly) from 0.8.0 to 1.0.0.
- [Release notes](https://github.com/ihordiachenko/eslint-plugin-chai-friendly/releases)
- [Commits](https://github.com/ihordiachenko/eslint-plugin-chai-friendly/compare/v0.8.0...v1.0.0)

---
updated-dependencies:
- dependency-name: eslint-plugin-chai-friendly
  dependency-type: direct:development
  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-08 08:29:19 +00:00
dependabot[bot]
2b7951f9de chore(deps-dev): bump eslint-plugin-jsdoc from 48.2.7 to 48.2.9 (#10225)
Bumps [eslint-plugin-jsdoc](https://github.com/gajus/eslint-plugin-jsdoc) from 48.2.7 to 48.2.9.
- [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.7...v48.2.9)

---
updated-dependencies:
- dependency-name: eslint-plugin-jsdoc
  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-08 08:26:36 +00:00
dependabot[bot]
1e7819dad4 chore(deps-dev): bump start-server-and-test from 2.0.3 to 2.0.4 (#10238)
Bumps [start-server-and-test](https://github.com/bahmutov/start-server-and-test) from 2.0.3 to 2.0.4.
- [Release notes](https://github.com/bahmutov/start-server-and-test/releases)
- [Commits](https://github.com/bahmutov/start-server-and-test/compare/v2.0.3...v2.0.4)

---
updated-dependencies:
- dependency-name: start-server-and-test
  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-08 08:24:04 +00:00
chris48s
437adc67ce simpleicons 12 blog (#10222) 2024-06-04 19:21:44 +01:00
Romain Tartière
d23f26b8d6 Add puppetforge quality score badges (#10201)
The Puppet Forge run static analysis on modules and provide a score
through a (currently) internal API.

Waybe it will be in the public API in the future, but when this happen
adjusting the URL should be easy.  In the meantime, use this internal
API.
2024-06-04 18:13:06 +00:00
Pierre-Yves Bigourdan
81585acd6b Fix [GithubPullRequestCheckState] test (#10200) 2024-06-02 22:43:55 +02:00
Pierre-Yves Bigourdan
f1727a38c1 Switch Cobertura job URL (#10217) 2024-06-02 20:29:25 +00:00
Pierre-Yves Bigourdan
39a17b69d3 Fully mock flaky [CodeClimate] multi-step tests (#10218) 2024-06-02 20:29:07 +00:00
38 changed files with 1163 additions and 690 deletions

View File

@@ -16,7 +16,20 @@ updates:
# https://caniuse.com/js-regexp-lookbehind
- dependency-name: 'decamelize'
- dependency-name: 'humanize-string'
groups:
# All official @docusaurus/* packages should have the exact same version as @docusaurus/core.
# From https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file#groups:
# "You cannot apply a single grouping set of rules to both version updates and security
# updates [...] you must define two, separately named, grouping sets of rules"
# See https://github.com/badges/shields/issues/10242 for more information.
docusaurus-version-updates:
applies-to: version-updates
patterns:
- '@docusaurus/*'
docusaurus-security-updates:
applies-to: security-updates
patterns:
- '@docusaurus/*'
# badge-maker package dependencies
- package-ecosystem: npm
directory: '/badge-maker'

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

@@ -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',

View File

@@ -71,7 +71,7 @@ Each service has a directory for its files:
`/services/example/example.service.js`.
If you add a badge for a new API, create a new directory.
Example: [wercker](https://github.com/badges/shields/tree/master/services/wercker)
Example: [Docs.rs](https://github.com/badges/shields/tree/master/services/docsrs)
- For service families with multiple badges we usually store the code for each
badge in its own file like this:

View File

@@ -12,7 +12,7 @@ automated tests should be included. They serve three purposes:
3. They speed up future contributors when they are debugging or improving a
badge.
Test should cover:
Tests should cover:
1. Valid behavior
2. Optional parameters like tags or branches
@@ -24,11 +24,11 @@ Test should cover:
Before getting started, set up a development environment by following the
[setup instructions](https://github.com/badges/shields/blob/master/doc/TUTORIAL.md#2-setup)
We will write some tests for the [Wercker Build service](https://github.com/badges/shields/blob/master/services/wercker/wercker.service.js)
We will write some tests for [Docs.rs](https://github.com/badges/shields/blob/master/services/docsrs/docsrs.service.js), a service that builds documentation of crates, which are packages in the Rust programming language.
### (1) Boilerplate
The code for our badge is in `services/wercker/wercker.service.js`. Tests for this badge should be stored in `services/wercker/wercker.tester.js`.
The code for our badge is in `services/docsrs/docsrs.service.js`. Tests for this badge should be stored in `services/docsrs/docsrs.tester.js`.
We'll start by adding some boilerplate to our file:
@@ -41,8 +41,8 @@ export const t = await createServiceTester()
If our `.service.js` module exports a single class, we can
`createServiceTester`, which uses convention to create a
`ServiceTester` object. Calling this inside
`services/wercker/wercker.tester.js` will create a `ServiceTester` object
configured for the service exported in `services/wercker/wercker.service.js`.
`services/docsrs/docsrs.tester.js` will create a `ServiceTester` object
configured for the service exported in `services/docsrs/docsrs.service.js`.
We will add our tests to this `ServiceTester` object `t`, which is exported
from the module.
@@ -51,27 +51,30 @@ from the module.
First we'll add a test for the typical case:
```js
import { isBuildStatus } from '../test-validators.js'
import Joi from 'joi'
t.create('Build status')
.get('/build/wercker/go-wercker-api.json')
.expectBadge({ label: 'build', message: isBuildStatus })
t.create('Docs with no version specified')
.get('/tokio.json')
.expectBadge({
label: 'docs',
message: Joi.allow('passing', 'failing'),
})
```
1. The `create()` method adds a new test to the tester object.
The chained-on calls come from the API testing framework [IcedFrisby][].
Here's a [longer example][] and the complete [API guide][icedfrisby api].
2. We use the `get()` method to request a badge. There are several points to consider here:
- We need a real project to test against. In this case we have used [wercker/go-wercker-api](https://app.wercker.com/wercker/go-wercker-api/runs) but we could have chosen any stable project.
- We need a real crate to test against. In this case we have used [Tokio](https://docs.rs/tokio) but we could have chosen any one.
- Note that when we call our badge, we are allowing it to communicate with an external service without mocking the response. We write tests which interact with external services, which is unusual practice in unit testing. We do this because one of the purposes of service tests is to notify us if a badge has broken due to an upstream API change. For this reason it is important for at least one test to call the live API without mocking the interaction.
- All badges on shields can be requested in a number of formats. As well as calling https://img.shields.io/wercker/build/wercker/go-wercker-api.svg to generate ![](https://img.shields.io/wercker/build/wercker/go-wercker-api.svg) we can also call https://img.shields.io/wercker/build/wercker/go-wercker-api.json to request the same content as JSON. When writing service tests, we request the badge in JSON format so it is easier to make assertions about the content.
- We don't need to explicitly call `/wercker/build/wercker/go-wercker-api.json` here, only `/build/wercker/go-wercker-api.json`. When we create a tester object with `createServiceTester()` the URL base defined in our service class (in this case `/wercker`) is used as the base URL for any requests made by the tester object.
- All badges on shields can be requested in a number of formats. As well as calling https://img.shields.io/docsrs/tokio.svg to generate ![](https://img.shields.io/docsrs/tokio.svg) we can also call https://img.shields.io/docsrs/tokio.json to request the same content as JSON. When writing service tests, we request the badge in JSON format so it is easier to make assertions about the content.
- We don't need to explicitly call `/docsrs/tokio.json` here, only `/tokio.json`. When we create a tester object with `createServiceTester()` the URL base defined in our service class (in this case `/docsrs`) is used as the base URL for any requests made by the tester object.
3. `expectBadge()` is a helper function which accepts either a string literal, a [RegExp][] or a [Joi][] schema for the different fields.
Joi is a validation library that is built into IcedFrisby which you can use to
match based on a set of allowed strings, regexes, or specific values. You can
refer to their [API reference][joi api].
4. We expect `label` to be a string literal `"build"`.
5. Because this test depends on a live service, we don't want our test to depend on our API call returning a particular build status. Instead we should perform a "picture check" to assert that the badge data conforms to an expected pattern. Our test should not depend on the status of the example project's build, but should fail if trying to generate the badge throws an error, or if there is a breaking change to the upstream API. In this case we will use a pre-defined regular expression to check that the badge value looks like a build status. [services/test-validators.js](https://github.com/badges/shields/blob/master/services/test-validators.js) defines a number of useful validators we can use. Many of the common badge types (version, downloads, rank, etc.) already have validators defined here.
4. We expect `label` to be a string literal `"docs"`.
5. Because this test depends on a live service, we don't want our test to depend on our API call returning a particular build status. Instead we should perform a "picture check" to assert that the badge data conforms to an expected pattern. Our test should not depend on the status of the example crates's documentation build, but should fail if trying to generate the badge throws an error, or if there is a breaking change to the upstream API. In this case, we specify a list with all possible response values, `Joi.allow('passing', 'failing')`. For more complex cases, [services/test-validators.js](https://github.com/badges/shields/blob/master/services/test-validators.js) defines a number of useful validators we can use with regular expressions. Many of the common badge types (version, downloads, rank, etc.) already have validators defined there.
When defining an IcedFrisby test, typically you would invoke the `toss()`
method, to register the test. This is not necessary, because the Shields test
@@ -89,7 +92,7 @@ harness will call it for you.
Lets run the test we have written:
```
npm run test:services -- --only=wercker
npm run test:services -- --only=docsrs
```
The `--only=` option indicates which service or services you want to test. You
@@ -101,11 +104,12 @@ runner.
Here's the output:
```
Server is starting up: http://lib/service-test-runner/cli.js:80/
Wercker
Build status
[ GET /build/wercker/go-wercker-api.json ] (572ms)
Server is starting up: http://localhost:1111/
DocsRs
[live] Docs with no version specified
[ GET /tokio.json ] (441ms)
1 passing (1s)
```
@@ -115,80 +119,98 @@ That's looking good!
Sometimes if we have a failing test, it is useful to be able to see some logging output to help work out why the test is failing. We can do that by calling `npm run test:services:trace`. Try running
```
npm run test:services:trace -- --only=wercker
npm run test:services:trace -- --only=docsrs
```
to run the test with some additional debug output.
### (4) Writing More Tests
We should write tests cases for valid paths through our code. The Wercker badge supports an optional branch parameter so we'll add a second test for a branch build.
We should write tests cases for valid paths through our code. The Docs.rs badge supports an optional version parameter so we'll add a second test for a branch build. In this case, we know for sure that the documentation for this older version was successfully built, we specify a string literal instead of a Joi schema for `message`. This narrows down the expectation and gives us a more helpful error message if the test fails.
```js
t.create('Build status (with branch)')
.get('/build/wercker/go-wercker-api/master.json')
.expectBadge({ label: 'build', message: isBuildStatus })
t.create('Passing docs for version').get('/tokio/1.37.0.json').expectBadge({
label: 'docs@1.37.0',
message: 'passing',
color: 'brightgreen',
})
```
```
Server is starting up: http://lib/service-test-runner/cli.js:80/
Wercker
Build status
[ GET /build/wercker/go-wercker-api.json ] (572ms)
Build status (with branch)
[ GET /build/wercker/go-wercker-api/master.json ] (368ms)
Server is starting up: http://localhost:1111/
DocsRs
[live] Docs with no version specified
[ GET /tokio.json ] (408ms)
[live] Passing docs for version
[ GET /tokio/1.37.0.json ] (171ms)
2 passing (1s)
2 passing (2s)
```
Once we have multiple tests, sometimes it is useful to run only one test. We can do this using the `--fgrep` argument. For example:
```
npm run test:services -- --only="wercker" --fgrep="Build status (with branch)"
npm run test:services -- --only="docsrs" --fgrep="Passing docs for version"
```
Having covered the typical and custom cases, we'll move on to errors. We should include a test for the 'not found' response and also tests for any other custom error handling. The Wercker integration defines a custom error condition for 401 as well as a custom 404 message:
Documentation for tokio version 1.32.1 failed to build, we can also add a corresponding test:
```js
httpErrors: {
401: 'private application not supported',
404: 'application not found',
}
t.create('Failing docs for version').get('/tokio/1.32.1.json').expectBadge({
label: 'docs@1.32.1',
message: 'failing',
color: 'red',
})
```
First we'll add a test for a project which will return a 404 error:
Note that in these tests, we have specified a `color` parameter in `expectBadge`. This is helpful in a case like this when we want to test custom color logic, but it is only necessary to explicitly test color values if our badge implements custom logic for setting the badge colors.
Having covered the typical and custom cases, we'll move on to errors. We should include a test for the 'not found' response and also tests for any other custom error handling. When a version is specified, the Docs.rs integration defines a custom error condition for 400 status codes:
```js
t.create('Build status (application not found)')
.get('/build/some-project/that-doesnt-exist.json')
.expectBadge({ label: 'build', message: 'application not found' })
httpErrors: version ? { 400: 'malformed version' } : {},
```
In this case we are expecting a string literal instead of a pattern for `message`. This narrows down the expectation and gives us a more helpful error message if the test fails.
We also want to include a test for the 'private application not supported' case. One way to do this would be to find another example of a private project which is unlikely to change. For example:
First we'll add a test for a crate and a test for a version which will return 404 errors:
```js
t.create('Build status (private application)')
.get('/build/wercker/blueprint.json')
.expectBadge({ label: 'build', message: 'private application not supported' })
t.create('Crate not found')
.get('/not-a-crate/latest.json')
.expectBadge({ label: 'docs', message: 'not found' })
t.create('Version not found')
.get('/tokio/0.8.json')
.expectBadge({ label: 'docs', message: 'not found' })
```
We also want to include a test for a case where a malformed version was specified. For example:
```js
t.create('Malformed version')
.get('/tokio/not-a-version.json')
.expectBadge({ label: 'docs', message: 'malformed version' })
```
## (5) Mocking Responses
If we didn't have a stable example of a private project, another approach would be to mock the response. An alternative test for the 'private application' case might look like:
If we didn't have a stable example of crate version with a failing documentation build, another approach would be to mock the response. An alternative test for the 'Failing docs for version' case might look like:
```js
t.create('Build status (private application)')
.get('/build/wercker/go-wercker-api.json')
t.create('Failing docs for version')
.get('/tokio/1.32.1.json')
.intercept(nock =>
nock('https://app.wercker.com/api/v3/applications/')
.get('/wercker/go-wercker-api/builds?limit=1')
.reply(401),
nock('https://docs.rs/crate')
.get('/tokio/1.32.1/status.json')
.reply(200, { doc_status: false }),
)
.expectBadge({ label: 'build', message: 'private application not supported' })
.expectBadge({
label: 'docs@1.32.1',
message: 'failing',
color: 'red',
})
```
This will intercept the request and provide our own mock response.
@@ -204,49 +226,6 @@ and path.
[icedfrisby-nock]: https://github.com/paulmelnikow/icedfrisby-nock#usage
[nock]: https://github.com/node-nock/nock
Our test suite should also include service tests which receive a known value from the API. For example, in the `render()` method of our service, there is some logic which sets the badge color based on the build status:
```js
static render({ status, result }) {
if (status === 'finished') {
if (result === 'passed') {
return { message: 'passing', color: 'brightgreen' }
} else {
return { message: result, color: 'red' }
}
}
return { message: status }
}
```
We can also use nock to intercept API calls to return a known response body.
```js
t.create('Build passed')
.get('/build/wercker/go-wercker-api.json')
.intercept(nock =>
nock('https://app.wercker.com/api/v3/applications/')
.get('/wercker/go-wercker-api/builds?limit=1')
.reply(200, [{ status: 'finished', result: 'passed' }]),
)
.expectBadge({
label: 'build',
message: 'passing',
color: 'brightgreen',
})
t.create('Build failed')
.get('/build/wercker/go-wercker-api.json')
.intercept(nock =>
nock('https://app.wercker.com/api/v3/applications/')
.get('/wercker/go-wercker-api/builds?limit=1')
.reply(200, [{ status: 'finished', result: 'failed' }]),
)
.expectBadge({ label: 'build', message: 'failed', color: 'red' })
```
Note that in these tests, we have specified a `color` parameter in `expectBadge`. This is helpful in a case like this when we want to test custom color logic, but it is only necessary to explicitly test color values if our badge implements custom logic for setting the badge colors.
## Code coverage
By checking code coverage, we can make sure we've covered all our bases.
@@ -254,7 +233,7 @@ By checking code coverage, we can make sure we've covered all our bases.
We can generate a coverage report and open it:
```
npm run coverage:test:services -- -- --only=wercker
npm run coverage:test:services -- -- --only=docsrs
npm run coverage:report:open
```

View File

@@ -0,0 +1,33 @@
---
slug: simple-icons-12
title: Simple Icons 12
authors:
name: chris48s
title: Shields.io Core Team
url: https://github.com/chris48s
image_url: https://avatars.githubusercontent.com/u/6025893
tags: []
---
Logos on Shields.io are provided by SimpleIcons. We've recently upgraded to SimpleIcons 12. This release removes the following 10 icons:
- FITE
- Flattr
- Google Bard
- Integromat
- Niantic
- Nintendo Network
- Rome
- Shotcut
- Skynet
- Twitter
And renames the following 3:
- Airbrake.io to Airbrake
- Amazon AWS to Amazon Web Services
- RStudio to RStudio IDE
More details can be found in the [release notes](https://github.com/simple-icons/simple-icons/releases/tag/12.0.0).
Please remember that we are just consumers of SimpleIcons. Decisions about changes and removals are made by the [SimpleIcons](https://github.com/simple-icons/simple-icons) project.

1083
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.7.0",
"@sentry/node": "^8.11.0",
"@shields_io/camp": "^18.1.2",
"@xmldom/xmldom": "0.8.10",
"badge-maker": "file:badge-maker",
@@ -39,12 +39,12 @@
"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.3.0",
"graphql": "16.8.1",
"got": "^14.4.1",
"graphql": "16.8.2",
"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.0",
"parse-link-header": "^2.0.0",
"path-to-regexp": "^6.2.2",
"pg": "^8.11.5",
"pg": "^8.12.0",
"pretty-bytes": "^6.1.1",
"priorityqueuejs": "^2.0.0",
"prom-client": "^15.1.2",
"qs": "^6.12.1",
"query-string": "^9.0.0",
"semver": "~7.6.2",
"simple-icons": "12.0.0",
"smol-toml": "1.2.0",
"simple-icons": "12.3.0",
"smol-toml": "1.2.1",
"svg-path-commander": "^2.0.9",
"webextension-store-meta": "^1.2.3",
"xpath": "~0.0.34"
@@ -145,22 +145,23 @@
]
},
"devDependencies": {
"@docusaurus/core": "^3.3.2",
"@easyops-cn/docusaurus-search-local": "^0.41.0",
"@docusaurus/core": "^3.4.0",
"@docusaurus/preset-classic": "^3.4.0",
"@easyops-cn/docusaurus-search-local": "^0.44.2",
"@mdx-js/react": "^3.0.1",
"@typescript-eslint/parser": "^7.11.0",
"c8": "^9.1.0",
"@typescript-eslint/parser": "^7.13.1",
"c8": "^10.1.2",
"caller": "^1.1.0",
"chai": "^4.4.1",
"chai-as-promised": "^7.1.2",
"chai-as-promised": "^8.0.0",
"chai-datetime": "^1.8.0",
"chai-string": "^1.4.0",
"child-process-promise": "^2.2.1",
"clsx": "^2.1.1",
"concurrently": "^8.2.2",
"cypress": "^13.10.0",
"cypress": "^13.12.0",
"cypress-wait-for-stable-dom": "^0.1.0",
"danger": "^12.3.0",
"danger": "^12.3.3",
"deepmerge": "^4.3.1",
"docusaurus-preset-openapi": "0.7.5",
"eslint": "8.57.0",
@@ -168,16 +169,16 @@
"eslint-config-standard": "17.1.0",
"eslint-config-standard-jsx": "11.0.0",
"eslint-config-standard-react": "13.0.0",
"eslint-plugin-chai-friendly": "^0.8.0",
"eslint-plugin-chai-friendly": "^1.0.0",
"eslint-plugin-cypress": "^3.3.0",
"eslint-plugin-icedfrisby": "^0.1.0",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-jsdoc": "^48.2.7",
"eslint-plugin-jsdoc": "^48.2.12",
"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",
@@ -185,7 +186,7 @@
"icedfrisby-nock": "^2.1.0",
"is-svg": "^5.0.1",
"jsdoc": "^4.0.3",
"lint-staged": "^15.2.5",
"lint-staged": "^15.2.7",
"lodash.difference": "^4.5.0",
"minimist": "^1.2.8",
"mocha": "^10.4.0",
@@ -194,11 +195,11 @@
"mocha-yaml-loader": "^1.0.3",
"nock": "13.5.4",
"node-mocks-http": "^1.14.1",
"nodemon": "^3.1.2",
"nodemon": "^3.1.4",
"npm-run-all": "^4.1.5",
"open-cli": "^8.0.0",
"portfinder": "^1.0.32",
"prettier": "3.2.5",
"prettier": "3.3.2",
"prism-react-renderer": "^2.3.1",
"react": "^18.3.0",
"react-dom": "^18.3.1",
@@ -209,8 +210,8 @@
"sinon": "^18.0.0",
"sinon-chai": "^3.7.0",
"snap-shot-it": "^7.9.10",
"start-server-and-test": "2.0.3",
"tsd": "^0.31.0",
"start-server-and-test": "2.0.4",
"tsd": "^0.31.1",
"url": "^0.11.3"
},
"engines": {

View File

@@ -35,12 +35,12 @@ t.create('maintainability letter')
t.create('issues when outer user repos query returns multiple items')
.get('/issues/tensorflow/models.json')
.intercept(nock =>
nock('https://api.codeclimate.com', { allowUnmocked: true })
nock('https://api.codeclimate.com')
.get('/v1/repos?github_slug=tensorflow%2Fmodels')
.reply(200, {
data: [
{
id: 'xxxxxxxxxxxx', // Fake repo id, which is expected to be ignored in favour of the one that does contain snapshot data.
id: 'xxxxxxxxxxxx', // Expected to be ignored in favour of the one that does contain snapshot data.
relationships: {
latest_default_branch_snapshot: {
data: null,
@@ -51,7 +51,7 @@ t.create('issues when outer user repos query returns multiple items')
},
},
{
id: '57e2efacc718d40058000c9b', // Real repo id for tensorflow/models. The test retrieves live data using the real snapshot id below.
id: '57e2efacc718d40058000c9b',
relationships: {
latest_default_branch_snapshot: {
data: {
@@ -65,12 +65,31 @@ t.create('issues when outer user repos query returns multiple items')
},
},
],
})
.get(
'/v1/repos/57e2efacc718d40058000c9b/snapshots/65ae115f34117d0001055101',
)
.reply(200, {
data: {
attributes: {
ratings: [
{
letter: 'D',
measure: {
value: 24.73668395092537,
},
},
],
},
meta: {
issues_count: 11538,
},
},
}),
)
.networkOn() // Combined with allowUnmocked: true, this allows the inner snapshots query to go through.
.expectBadge({
label: 'issues',
message: Joi.number().integer().positive(),
message: '11538',
})
t.create('maintainability letter for non-existent repo')

View File

@@ -23,12 +23,12 @@ t.create('test coverage letter')
t.create('test coverage when outer user repos query returns multiple items')
.get('/coverage/codeclimate/codeclimate.json')
.intercept(nock =>
nock('https://api.codeclimate.com', { allowUnmocked: true })
nock('https://api.codeclimate.com')
.get('/v1/repos?github_slug=codeclimate%2Fcodeclimate')
.reply(200, {
data: [
{
id: 'xxxxxxxxxxxx', // Fake repo id, which is expected to be ignored in favour of the one that does contain snapshot data.
id: 'xxxxxxxxxxxx', // Expected to be ignored in favour of the one that does contain snapshot data.
relationships: {
latest_default_branch_snapshot: {
data: null,
@@ -39,7 +39,7 @@ t.create('test coverage when outer user repos query returns multiple items')
},
},
{
id: '558479d6e30ba034120008a9', // Real repo id for codeclimate/codeclimate. The test retrieves live data using the real test report id below.
id: '558479d6e30ba034120008a9',
relationships: {
latest_default_branch_snapshot: {
data: null,
@@ -53,12 +53,24 @@ t.create('test coverage when outer user repos query returns multiple items')
},
},
],
})
.get(
'/v1/repos/558479d6e30ba034120008a9/test_reports/65a1662cb0077b00013cb4de',
)
.reply(200, {
data: {
attributes: {
covered_percent: 24,
rating: {
letter: 'B',
},
},
},
}),
)
.networkOn() // Combined with allowUnmocked: true, this allows the inner test reports query to go through.
.expectBadge({
label: 'coverage',
message: isIntegerPercentage,
message: '24%',
})
t.create('test coverage percentage for non-existent repo')

View File

@@ -17,6 +17,7 @@ const archEnum = [
'mips64',
'mips64le',
'riscv64',
'loong64',
]
// Valid architecture values: https://golang.org/doc/install/source#environment (GOARCH)

View File

@@ -2,10 +2,12 @@ import { isSemver } from '../test-validators.js'
import { createServiceTester } from '../tester.js'
export const t = await createServiceTester()
t.create('docker version (valid, library)').get('/_/alpine.json').expectBadge({
label: 'version',
message: isSemver,
})
t.create('docker version (valid, library)')
.get('/_/memcached.json')
.expectBadge({
label: 'version',
message: isSemver,
})
t.create('docker version (valid, library with tag)')
.get('/_/alpine/latest.json')

View File

@@ -61,6 +61,7 @@ export default class DocsRs extends BaseJsonService {
return await this._requestJson({
schema,
url: `https://docs.rs/crate/${crate}/${version}/status.json`,
httpErrors: version ? { 400: 'malformed version' } : {},
})
}

View File

@@ -2,17 +2,32 @@ import Joi from 'joi'
import { createServiceTester } from '../tester.js'
export const t = await createServiceTester()
t.create('Passing docs')
.get('/tokio/0.3.0.json')
.expectBadge({ label: 'docs@0.3.0', message: 'passing' })
t.create('Docs with no version specified')
.get('/tokio.json')
.expectBadge({
label: 'docs',
message: Joi.allow('passing', 'failing'),
})
t.create('Failing docs')
.get('/tensorflow/0.16.1.json')
.expectBadge({ label: 'docs@0.16.1', message: 'failing' })
t.create('Passing docs for version').get('/tokio/1.37.0.json').expectBadge({
label: 'docs@1.37.0',
message: 'passing',
color: 'brightgreen',
})
t.create('Failing docs for version').get('/tokio/1.32.1.json').expectBadge({
label: 'docs@1.32.1',
message: 'failing',
color: 'red',
})
t.create('Multiple builds, latest passing')
.get('/bevy_tweening/0.3.1.json')
.expectBadge({ label: 'docs@0.3.1', message: 'passing' })
.expectBadge({
label: 'docs@0.3.1',
message: 'passing',
color: 'brightgreen',
})
t.create('Getting latest version works')
.get('/rand/latest.json')
@@ -26,5 +41,9 @@ t.create('Crate not found')
.expectBadge({ label: 'docs', message: 'not found' })
t.create('Version not found')
.get('/tokio/not-a-version.json')
.get('/tokio/0.8.json')
.expectBadge({ label: 'docs', message: 'not found' })
t.create('Malformed version')
.get('/tokio/not-a-version.json')
.expectBadge({ label: 'docs', message: 'malformed version' })

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

@@ -17,7 +17,7 @@ t.create(
nock =>
nock('https://api.github.com', { allowUnmocked: true })
.get('/repos/badges/shields/pulls/1110')
.reply(200, JSON.stringify({ head: { sha: 'abc123' } })), // Looks like a real ref, but isn't.
.reply(200, JSON.stringify({ head: { sha: 'abcde12356' } })), // Looks like a real ref, but isn't.
)
.networkOn()
.expectBadge({

View File

@@ -120,7 +120,7 @@ export default class JenkinsCoverage extends JenkinsBase {
}),
queryParam({
name: 'jobUrl',
example: 'https://jenkins.sqlalchemy.org/job/alembic_coverage',
example: 'https://jenkins.sqlalchemy.org/job/dogpile_coverage',
required: true,
}),
],

View File

@@ -27,7 +27,7 @@ t.create('cobertura: job not found')
t.create('cobertura: job found')
.get(
'/cobertura.json?jobUrl=https://jenkins.sqlalchemy.org/job/alembic_coverage',
'/cobertura.json?jobUrl=https://jenkins.sqlalchemy.org/job/dogpile_coverage',
)
.expectBadge({ label: 'coverage', message: isIntegerPercentage })

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

@@ -24,6 +24,27 @@ const modulesSchema = Joi.object({
),
}).required()
const modulesValidationSchema = Joi.array()
.items(
Joi.alternatives().try(
Joi.object({
name: Joi.string().valid('total').required(),
score: nonNegativeInteger,
}).required(),
Joi.object({}).required(),
),
)
.custom((value, helpers) => {
// Custom validation to check for exactly one type1 object
const totalCount = value.filter(item => item.name === 'total').length
if (totalCount !== 1) {
return helpers.message(
'Array must contain exactly one object of type "total"',
)
}
return value
})
class BasePuppetForgeUsersService extends BaseJsonService {
async fetch({ user }) {
return this._requestJson({
@@ -42,4 +63,17 @@ class BasePuppetForgeModulesService extends BaseJsonService {
}
}
export { BasePuppetForgeModulesService, BasePuppetForgeUsersService }
class BasePuppetForgeModulesValidationService extends BaseJsonService {
async fetch({ user, moduleName }) {
return this._requestJson({
schema: modulesValidationSchema,
url: `https://forgeapi.puppetlabs.com/private/validations/${user}-${moduleName}`,
})
}
}
export {
BasePuppetForgeModulesService,
BasePuppetForgeUsersService,
BasePuppetForgeModulesValidationService,
}

View File

@@ -0,0 +1,45 @@
import { coveragePercentage as coveragePercentageColor } from '../color-formatters.js'
import { pathParams } from '../index.js'
import { BasePuppetForgeModulesValidationService } from './puppetforge-base.js'
export default class PuppetforgeModuleQualityScoreService extends BasePuppetForgeModulesValidationService {
static category = 'rating'
static route = {
base: 'puppetforge/qualityscore',
pattern: ':user/:moduleName',
}
static openApi = {
'/puppetforge/qualityscore/{user}/{moduleName}': {
get: {
summary: 'Puppet Forge quality score',
parameters: pathParams(
{
name: 'user',
example: 'camptocamp',
},
{
name: 'moduleName',
example: 'openssl',
},
),
},
},
}
static defaultBadgeData = { label: 'quality score' }
static render({ score }) {
return {
message: `${score}%`,
color: coveragePercentageColor(score),
}
}
async handle({ user, moduleName }) {
const data = await this.fetch({ user, moduleName })
const qualityScore = data.find(el => el.name === 'total').score
return this.constructor.render({ score: qualityScore })
}
}

View File

@@ -0,0 +1,27 @@
import { isPercentage } from '../test-validators.js'
import { createServiceTester } from '../tester.js'
export const t = await createServiceTester()
t.create('module quality-score').get('/camptocamp/openssl.json').expectBadge({
label: 'quality score',
message: isPercentage,
})
t.create('module quality score (no ratings)')
.get('/camptocamp/openssl.json')
.intercept(nock =>
nock('https://forgeapi.puppetlabs.com/private/validations')
.get('/camptocamp-openssl')
.reply(200, []),
)
.expectBadge({
label: 'quality score',
message: 'invalid response data',
})
t.create('module quality score (not found)')
.get('/notarealuser/notarealpackage.json')
.expectBadge({
label: 'quality score',
message: 'not found',
})