Commit Graph

387 Commits

Author SHA1 Message Date
Caleb Cartwright
956f2e0584 update simple-icons to v5 with by-name lookup backwards compatibility (#6591)
* deps: update simple-icons to v5 in BC manner

* fix: handling of overlapping titles

Co-authored-by: repo-ranger[bot] <39074581+repo-ranger[bot]@users.noreply.github.com>
2021-06-12 19:51:28 +00:00
Marcin Mielnicki
6822922ad2 getSimpleIcon handles 'get' icon (#5730) 2020-10-17 19:23:39 +02:00
Paul Melnikow
e1ac63d3be Finish removing server-secrets.js (#5664)
I’ve tested locally that setting `gh_token` still conditionally enables `ConditionalGithubAuthV3Service`.

Closes #3393
2020-10-07 17:29:03 -04:00
chris48s
504015c0ba migrate hapi/joi to joi (#5624)
* update joi + joi-extension-semver

* @hapi/joi --> joi

Co-authored-by: repo-ranger[bot] <39074581+repo-ranger[bot]@users.noreply.github.com>
2020-09-30 17:51:02 +00:00
Pierre-Yves B
471f3f4ad1 Use black font when background color is too light (#5467)
* Use black font when background color is too light

* Tweak dark color

* Extract magic brightness numbers to constants

* Fix snapshot tests

* Switch threshold to 0.69
2020-09-07 19:07:28 +02:00
chris48s
13d75e0607 upgrade to prettier 2 (#5051)
* arrowParens: avoid
* remove trailingComma setting
2020-05-05 21:07:43 +01:00
chris48s
3ba05cb184 📦 version 3 (#4756)
* Validate input to BadgeFactory.create() (#3875)

* validate input to create()

* remove deprecated properties (#3881)

* remove BadgeFactory class (#3884)

* Template literal templates (#4459)

- Remove use of the doT template library and move to generating SVG output using javascript template literals.
- Drop SVGO and mostly manually implement the optimisations.
- Add a bunch more tests

Co-authored-by: Paul Melnikow <github@paulmelnikow.com>

* drop raster support in package CLI (#4523)

* drop raster support in package CLI
* update docs

* rename gh-badges package to badge-maker

* rename gh-badges dir to badge-maker

* update relative imports and other refs to in parent dir

'gh-badges' --> 'badge-maker'

* update snyk service tests

This change is only tangentially related

We've used the shields repo as an example for these tests so
moving files around in our repo has a knock-on effect on them

* add missing type hints to dev style page

* write the changelog/migration guide for v3

* use extension in README CLI example

* update CLI help

whoops - missed this in #4523

* bump version

* update for self-hosting users

* README updates

* drop .format param from CLI, always output SVG

* Change text[] to label and message, Remove JSON output

- Change text[] to label and message
- Fix message only badge
- Remove JSON output format
- Update the docs

* update package-lock

* rename 'template' to 'style'

* handle invalid styles in coalesceBadge

* ensure makeBadge is passed a string for template in coalesceBadge()

issue #4925

* fix (logo/no label text/label color specified) case

issue #4926

* add example of (logo/no label text/label color specified) to style debug page

* update type defs

* padding fix for FTB style

Co-authored-by: Paul Melnikow <github@paulmelnikow.com>
2020-04-23 20:05:48 +01:00
François Hodierne
0d8a2d5ca0 Update to eslint 6.8.0 [appveyor githubissuedetail packagist] (#4489)
* update to eslint 6.8.0 and related packages

* Fixes for no-prototype-builtins

* Updates for explicit-function-return-type

* Add ignores for no-explicit-any

* update to eslint 6.8.0 and related packages

* Fixes for no-prototype-builtins

* Updates for explicit-function-return-type

* Add ignores for no-explicit-any

* package: activate eslint-config-standard

* apply updated eslint configuration

* lint: apply eslint feedback after rebase

* Update lockfile

* Update lockfile

* Restore missing deps

* Update lockfile

* Re-add eslint-plugin-node

* Add eslint-plugin-standard and eslint-plugin-react-hooks

* Clean lint

Co-authored-by: Paul Melnikow <github@paulmelnikow.com>
2020-02-29 11:06:36 -06:00
Marcin Mielnicki
88e2cac0f8 Exclude 'get' logo in load-simple-icons/fixes: logos: TypeError: Cannot read property '1' of null (#4488)
* Exclude 'get' key from simple icons

* Improved assertion readability

* A comment added in test
2020-01-05 21:30:57 +01:00
chris48s
8621fe42d7 Upgrade Joi (#3505)
* upgrade joi
* find & replace ALL THE THINGS
* update related deps
2019-06-02 21:59:55 +01:00
chris48s
98f380b254 improve logo escaping (#3511)
* escape logo in make-badge

* 2.2.1 release notes

* tighten up validation of logo param
2019-05-30 18:28:37 +01:00
Paul Melnikow
001ade3704 Move checkErrorResponse from lib/ to core/ [chrome] (#3408) 2019-05-02 18:07:18 -04:00
Paul Melnikow
b2e21da34d Remove legacy helper makeBadgeData (#3392)
Close #3369
2019-04-29 19:44:25 -04:00
Paul Melnikow
a0492c5283 Remove unused callback-based error helpers (#3371) 2019-04-29 13:35:57 -04:00
Paul Melnikow
3733de6232 Rewrite GitHub commit status (#3186)
* WIP

* Parse the error response

* Clarify

* Restore one test

* Add a schema
2019-03-10 18:43:37 -05:00
Paul Melnikow
e159d90516 Reorganize a couple of the legacy helpers [npm node jenkinsplugin dynamic] (#3163) 2019-03-05 20:43:33 -06:00
Paul Melnikow
a801450dd6 Move deprecation helpers to services/ (#3162)
This is currently unused, though it seems fine to keep it around.
2019-03-05 20:32:41 -06:00
Paul Melnikow
fafb22efee Move "good" badge helpers from lib/ to services/ (#3101)
This moves a few helpers from `lib/` to `services/`:

build-status.js
build-status.spec.js
color-formatters.js
color-formatters.spec.js
contributor-count.js
licenses.js
licenses.spec.js
php-version.js
php-version.spec.js
text-formatters.js
text-formatters.spec.js
version.js
version.spec.js

And one from `lib/` to `core/`:

unhandled-rejection.spec.js

The diff is long, but the changes are straightforward.

Ref #2832
2019-02-27 20:47:46 -05:00
Paul Melnikow
e3d115cf99 Rename maxAge to cacheSeconds (#3090)
Close #3069
2019-02-23 20:33:38 -05:00
Paul Melnikow
8c244c2e40 Fix color overriding for legacy services (#3091)
While I was doing #3090 I realized the work in #3012 did not handle legacy services.

I tested this manually with `/librariesio/release/hex/phoenix.svg?color=blue` and it works.
2019-02-23 19:07:31 -05:00
Paul Melnikow
6684f4b566 Remove unused version helper (#3086) 2019-02-23 15:20:34 -05:00
Paul Melnikow
4bd16f93e8 Sort imports and requires (#3056)
This will definitely save time, and ensure more uniformity.

It moves the `createServiceTester()` calls to a different place from where I'd like them, though I'm happy to have them checked by the linter.

Closes #2701
2019-02-21 22:14:40 -05:00
Danial
f550f0cc4d Update Travis logo, Reduce some duplication (#3047)
Switch Travis to use full-color logo approved at https://github.com/badges/shields/pull/1276#issuecomment-466164851
2019-02-21 20:29:23 -05:00
Caleb Cartwright
a4bd3f5fd6 Add SymfonyInsight stars badge, run [SymfonyInsight sensiolabs amo chrome-web-store redmine spigetratings vaadin-directory visualstudiomarketplacerating wordpress] (#2971)
* feat: added stars badge for symfony insight

* refactor: changed symfony star determination logic

* feat: updating symfony to handle old scan scenarios

* feat: updated symfony insight to handle older projects

* tests: removed another test for symfony insight per request
2019-02-20 17:15:31 -06:00
Paul Melnikow
0f22c0af25 Store the deprecation date inline (#3029) 2019-02-18 16:59:08 -05:00
Caleb Cartwright
8d94c25c8a Update build status list (#2965)
Fixes #2848 

Appveyor briefly has a status of `starting` before the job begins, so adding `starting` to the list of `otherStatuses` to prevent the Appveyor badges from showing `invalid response data` during that window
2019-02-09 15:43:08 -06:00
Philip Harrison
cf7b76d5a6 Update Dependabot logo (#2931)
* Update dependabot logo
* update tests
2019-02-06 21:33:40 +00:00
Paul Melnikow
7955f460f3 Move suggest code and rewrite tests (#2886)
The suggest code was an exception to our usual organization pattern. There was a service test, but it's not a service. The code would sometimes regress because it wasn't being tested all the time.

This makes them no longer run as service tests, which is good because they run as part of every build. Some of them are smaller-bracket tests which is good too, because it will make them easier to test, especially as this code grows.

I'd have liked to keep using frisby for the ones that make requests to the server, though I ran into some issues with sequencing of setup that I think will require upstream changes.
2019-01-30 17:48:54 -06:00
chris48s
daa06c2026 don't apply logoColor param to multi-coloured logos (#2889)
This stops us from doing this:

![](https://img.shields.io/badge/logo-npm-blue.svg?logo=npm&logoColor=green) - https://img.shields.io/badge/logo-npm-blue.svg?logo=npm&logoColor=green
but still allows us to do this
![](https://img.shields.io/badge/logo-discord-blue.svg?logo=discord&logoColor=green) - https://img.shields.io/badge/logo-discord-blue.svg?logo=discord&logoColor=green
2019-01-29 15:22:28 -06:00
chris48s
1822a3adfb more icon changes (#2872)
* delete scrutinizer logo
* optimise superuser logo
2019-01-27 18:27:27 +00:00
chris48s
bf5438f457 Delete some of our logos (part 1) (#2857)
Refs #2510

I'm going to delete or change some more logos in a further PR or two, but lets start off with the (hopefully) non-controversial ones. I think in all of these cases it is fairly clear-cut that we are not losing anything by removing our icon in favour of simple-icons now that we apply a sensible colour by default.
2019-01-25 12:51:41 -05:00
chris48s
7e473fe72c pre-compute the 3 most common icon styles on server init (#2856)
refs #2833 (comment)
2019-01-23 16:41:10 -05:00
chris48s
eaa64a8dab automatically show light or dark logos when using simple-icons (#2833)
closes #2431
refs #2510
2019-01-23 14:42:08 -05:00
Paul Melnikow
fc12b591db Reorganize BaseService-related modules (#2831)
Ref #2698
2019-01-22 23:52:13 -05:00
Paul Melnikow
aac2a4d5ad Move legacy request helpers (#2829)
In #2698 we decided to put legacy helper functions in `core/legacy`. I think that’s a fine idea, though if we’re going to have a bunch of badge helper functions in there, it seems like it is probably better to keep these two important but esoteric helper functions with the core code to which they are most coupled. So I added `legacy-` to the name, and put them in `core/base-service`.
2019-01-21 22:14:22 -05:00
Paul Melnikow
62810143ac Move coalesce and validate (#2828)
Ref #2698
2019-01-21 16:11:23 -05:00
Paul Melnikow
8dc8afeb55 Avoid func declarations using function keyword (#2813)
We had only a few function expressions declared with the function keyword; almost everything is using function declarations.

This came up after this discussion: https://github.com/badges/shields/pull/2803#discussion_r249011621 though is actually not related ot that example.

What’s being removed is a third option, which is assigning to a variable a function expression using the `function` keyword. There’s still room for the programmer to choose between arrow function expressions and function declarations.
2019-01-21 15:33:43 -05:00
Paul Melnikow
26d0495ee6 Add logo support for the endpoint badge and refactor logo functions (#2796) 2019-01-20 20:22:46 +00:00
Paul Melnikow
5ff7beb3bf Reorganize token pooling code (#2792)
Ref #2698
2019-01-18 06:18:31 -05:00
Paul Melnikow
4415a3e94e Reorganize badge URL helper functions (#2790)
Ref #2698
2019-01-17 13:44:46 -05:00
Paul Melnikow
18b98a30e3 Reorganize server and service test runner (#2781)
Ref #2698
2019-01-16 16:30:18 -05:00
Paul Melnikow
474b126be6 Fix color again, for legacy badges (#2782)
Ref: https://github.com/badges/shields/pull/2780#issuecomment-454873296
2019-01-16 13:37:48 -05:00
Paul Melnikow
4bf55a7826 Fix numeric colorB (#2780)
Numeric colors weren't properly being handled by `makeBadge` after #2742.

Since this function really does not need to be accepting colors as strings, rather than make the function more lenient to work with Scoutcamp, I coerced the types of the colors on the way in.

Two tests cover the functionality in the modern service. I don't feel strongly that the legacy version needs coverage at this point, though I've added one for the moment on the github languages badge where this manifested.

Fix #2778
2019-01-16 11:55:50 -05:00
Thomas Démoulins
678359bdd6 Fix orange statuses, run tests for [AppveyorCi AzureDevOps Bitbucket CircleCi Gitlab Readthedocs Shippable Wercker] (#2776)
* Fix orange statuses

* Add test for partially succeeded build

* Add service test for partially succeeded builds

* Add service test for partially succeeded builds
2019-01-15 18:56:42 -06:00
Paul Melnikow
4597d77015 Refactor badge color functions (#2742)
- Replace the idea of color schemes with the idea of named colors (since none of our colorschemes have used `colorA`)
- Pass through the normalized color to `_shields_test` to harmonize with BaseService and simplify testing
    - Update service tests
- Move responsibility for color generation into the npm package
- Remove several color helper functions and their tests
- Update gh-badge public API to accept `color` and `labelColor`

This is a precursor to refactoring some of the logo code for #2473.
2019-01-15 16:43:33 -05:00
Paul Melnikow
cab689706f Dynamic cache length overriding (#2755)
For the Endpoint badge: #2473.

`request-handler.js` is such a bear. I’m looking forward to being able to rewrite it when the service refactor is done.
2019-01-15 15:44:39 -05:00
Pierre-Yves B
55ce947a35 Extended usage of build-status.js tomore services (#2763)
* Extended usage of build-status.js

* Removed remaining status arguments
2019-01-15 20:27:18 +00:00
chris48s
697ff80dad limit the size of response we will accept (#2726)
limit the size of response we will accept
2019-01-11 21:50:49 +00:00
Paul Melnikow
b3606724fd Wildcard to run all service tests [*] (#2739)
Close #2685.
2019-01-11 16:11:46 -05:00
Paul Melnikow
c4efdc8e66 Rewrite and test Github auth logic, separating standard and search quota (#1205)
The end of an era.
2019-01-10 21:30:23 -05:00