This merges the `node-8` branch. The heavy lift was by @Daniel15 with refactoring from me and a patch by @RedSparr0w.
* New API for registering services (#963)
* Disable Node 6 tests on node-8 branch (#1423)
* BaseService: Factor out methods _regex and _namedParamsForMatch (#1425)
- Adjust test grouping
- Rename data -> queryParams, text -> message
* BaseService tests: Use Chai (#1450)
* BaseService: make serviceData and badgeData explicit and declarative (#1451)
* fix isValidStyle test (#1544)
* Run tests in Node 9, not Node 6 (#1543)
These tests should fail if something is accidentally changed that affects the SVG or JSON files. In the case of deliberate changes, we can update the snapshots.
* remove newlines from datauri
* update test, remove decode
* support multiline datauris
* replace whitespace before checking isDataUri
removed multiline support from regex
* prependPrefix set default as empty string
* update
* add service tests for NuGet v2 services
* fixup - test the correct endpoint
* remove superfluous try/catch blocks
* test the colors too
* use invalid json fixture
* Integrated Vaadin service to server.js & load age from color-formatters lib
* Added 8 tests for Vaadin services
* Added Vaadin badge to main page under Misc
* Used checkErrorResponse() and fix 404 test return value
* Removed maturity from URL field option
* Remove duplicate `age` module import
* Removed comment
* Changed several URI fields and fixed according tests
* Added a shield for calculating npm bundle sizes
* Fix linting errors
* Fixed badges for bundlephobia
* Remove un-required keywords
* Simplified handler based on feedback
* Use isFileSize for validation
* Convert camel-cased error codes to space separated ones
* Updated error format
* Fixed error formatting
* Renamed gzip to minzip
* Fixes lint error
* Remove test that times out
* refactor tests to make it more readable
* meaningless change
* use trim
* Fixed remaining CodeClimate badges
* Added explicit percentage keyword and dropped top level URL
* Merged the two badge handlers into one
* Removed trailing space
* Switched to "dash" URL style
* Reinstated top-level URL
* Swicthed to use letter as optional keyword
* Updated badge examples
* Cleaned up
* Changed badge label to technical debt
* Switched tests to more mainstream projects as previous ones were deleted
* Rearranged badge URLs and default formats
* Updated examples
* Show logos on social badges
* Revert "Showcase logos in social badges on the front page"
This reverts commit 61fa22b7e4.
* Update footer badges to all be social style
as per reverted commit 61fa22b7e4
To fix service test that fails in CI (due to no github auth) https://github.com/badges/shields/issues/1359#issuecomment-354184074
- DRY getPhpReleases()
- Pass named options to regularUpdate
- Add json option
- php-version: Move helpers before functions, and move exports to end
- Avoid mutating the inputs
- Declare all the input and output keys
- Avoid recomputing escapeXml on the same values
- Capitalize social badge labels before measuring
Ref: #1379
This takes a naive approach to font-width computation, the most compute-intensive part of rendering badges.
1. Add the widths of the individual characters.
- These widths are measured on startup using PDFKit.
2. For each character pair, add a kerning adjustment
- The difference between the width of each character pair, and the sum of the characters' separate widths.
- These are computed for each character pair on startup using PDFKit.
3. For a string with characters outside the printable ASCII character set, fall back to PDFKit.
This branch averaged 0.041 ms in `makeBadge`, compared to 0.144 ms on master, a speedup of 73%. That was on a test of 10,000 consecutive requests (using the `benchmark-performance.sh` script, now checked in).
The speedup applies to badges containing exclusively printable ASCII characters. It wouldn't be as dramatic on non-ASCII text. Though, we could add some frequently used non-ASCII characters to the cached set.
I have a branch going to automatically generate stats on which services have tests, and make a line chart over time. I'm having a lot of fun with that so I'll keep at it.
Meanwhile, here is my subjective list of critical services, for #1358.