Commit Graph

49 Commits

Author SHA1 Message Date
Jacob Tomlinson
d56b6961da Add [dynamic-yaml] badge (#1623)
* Add dynamic yaml badge

* Forgot package lock

* Switch tests to yaml data source

* Add yaml to the dynamic badge maker options

* Reorder to match documentation examples

* Reordered dynamic types to be alphabetical

* Removed regex as pinend commit makes it unnecessary and fixed url

* Removed unused import

* Add more YAML MIME types

* Removed duplicate tests which don't differ between data types
2018-04-08 21:47:28 +02:00
Paul Melnikow
416d433fa0 [appveyor] Error handling in BaseService (#1590)
Make a clear distinction between programmer errors ("internal errors") and runtime errors, and allow configuring the server to let the programmer errors bubble up in development and unit testing. This saves a huge amount of time because it generates ordinary stack traces when things go wrong. And, if these errors occur in production, we'll catch them, and display **shields | internal error** which is the equivalent of a 500 error.
2018-04-01 22:04:22 -05:00
greenkeeper[bot]
724abd06dc Update svgo to the latest version 🚀 (#1473)
* fix(package): update svgo to version 1.0.5
* Update package-lock
* Update invocation for SVGO 1.x
* Remove helper
2018-04-01 21:57:20 -05:00
Paul Melnikow
f9b0aed8c9 package-lock fixes for glob (#1633)
Missing from #1619
2018-04-01 21:31:43 -05:00
greenkeeper[bot]
7e239f78c0 chore(package): update semver-regex to version 2.0.0 (#1596) 2018-03-27 17:13:15 -07:00
Marcin Mielnicki
fe4ac0bf1c Log errors to Sentry (#1422) 2018-03-24 20:30:51 +01:00
greenkeeper[bot]
2adb0e7d52 Update request to the latest version 🚀 (#1566)
* fix(package): update request to version 2.84.0

* fix(package): update request to version 2.85.0

Closes #1566

* update package-lock
2018-03-14 22:57:24 -04:00
greenkeeper[bot]
3a5563d27f Update query-string to the latest version 🚀 (#1572)
* fix(package): update query-string to version 6.0.0

* update package-lock
2018-03-14 22:57:05 -04:00
Paul Melnikow
ae848f38f4 Add snapshot tests for SVG and JSON (#1557)
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.
2018-03-11 09:07:03 -07:00
greenkeeper[bot]
dd90d2aced Update sinon-chai to the latest version 🚀 (#1547)
* chore(package): update sinon-chai to version 3.0.0

* Update package-lock
2018-03-08 09:24:38 -08:00
greenkeeper[bot]
2d5a088d6f Update next to the latest version 🚀 (#1490)
* chore(package): update next to version 5.0.0

* Update package-lock

* Get build + tests passing
2018-03-08 09:18:52 -08:00
Danial
be09cee1f2 User defined XML source badge [dynamic-xml dynamic-json] (#1494)
* add dynamic xml badge support

* add tests

* dynamic badge add tests for query param

* remove try catch

* use `checkErrorResponse()`

* update tests

* [dynamic json] add test for multiple items

* Rebase, [dynamic xml] Add support for multiple items

* 404 response -> resource not found

* multiple results test less greedy regex

still alot of room for improvement to this test

* update dynamic badge gen

* add dynamic xml gen tests

* update tests id & path

* datalist -> select

* uri -> url

kept support for uri, incase of any already existing badges.

* split dynamic gen uri

* update query placeholder
2018-03-06 22:43:02 +01:00
greenkeeper[bot]
22ff288eac Update eslint, eslint-config-standard, and friends to the latest versions 🚀 (#1512) 2018-03-03 20:45:12 -05:00
greenkeeper[bot]
ab5514651f Update eslint-plugin-node to the latest version 🚀 (#1489) 2018-03-03 20:36:46 -05:00
greenkeeper[bot]
4a3f1eda9a Update fetch-ponyfill to the latest version 🚀 (#1488) 2018-03-03 20:25:18 -05:00
greenkeeper[bot]
af04068ffa chore(package): update node-fetch to version 2.0.0 (#1486) 2018-03-03 19:55:13 -05:00
greenkeeper[bot]
4e5669d2eb Update prettier to the latest version 🚀 (#1528) 2018-03-03 19:44:03 -05:00
greenkeeper[bot]
ef038b8049 Update mocha to the latest version 🚀 (#1459)
* chore(package): update mocha to version 5.0.0

* Update package-lock
2018-02-02 14:58:14 -08:00
greenkeeper[bot]
4ffdd85177 Update semver to the latest version 🚀 (#1457)
* fix(package): update semver to version 5.5.0

* Update package-lock
2018-02-02 14:54:26 -08:00
greenkeeper[bot]
1314258913 Update is-svg to the latest version 🚀 (#1483)
* chore(package): update is-svg to version 3.0.0

* Update package-lock
2018-02-02 14:44:29 -08:00
Paul Melnikow
e6de92c6ba Upgrade to next.js patched for CVE-2018-6184 (#1485)
This clears the GitHub warning for the vulnerability that shows up for maintainers. Note the vulnerability does not affect our deployment, which is static, using `next export`.

https://github.com/zeit/next.js/releases/tag/4.2.3
https://nvd.nist.gov/vuln/detail/CVE-2018-6184
2018-02-02 14:40:59 -08:00
greenkeeper[bot]
b422e880c1 Update prettier to the latest version 🚀 (#1434) 2018-01-15 14:14:08 -05:00
Thaddee Tyl
0da212b7de Upgrade to camp 17.2.1 2018-01-09 01:25:10 +01:00
Paul Melnikow
7c1a3fef69 Adopt Chai for assertions (#1419) 2018-01-08 14:18:07 -07:00
greenkeeper[bot]
2013968990 Update danger to the latest version 🚀 (#1414) 2018-01-05 22:09:25 -07:00
Paul Melnikow
cc9a6db853 Speed up font-width computation in most cases (#1390)
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.
2017-12-26 23:57:46 -05:00
Marcin Mielnicki
cc84240b61 Prettier updated to 1.9.2 in package-lock (#1375) 2017-12-19 13:26:44 -05:00
Paul Melnikow
b35cb71ed6 Upgrade IcedFrisby (#1360)
IcedFrisby/IcedFrisby#71 will allow us to set a per-test `timeout()` and per-test `retry()`, which should allow us to keep flaky tests green most of the time.

A slough of service tests are failing locally, though they are also failing in master and seem unrelated to these changes. (#1359)

IcedFrisby is maturing toward a 2.0 API. There's been one breaking change to the way dependencies are installed, and probably more changes to come in the API itself. Shields uses such a small part of that API that 2.0, when it's released, may not even affect us.
2017-12-09 12:03:57 -05:00
Paul Melnikow
d97f07c263 Install Danger (#1352)
… so we can stop saying "you forgot to…" in code review. 😀

This idea has come up a number of times. If we can write code to detect a contributor guideline, this tool will message the contributor automatically in a pull request. This lets people fix their own problems, relieves maintainers and reviewers from nagging, and keeps anyone from having to constantly ask for more tests.

For futher reading:

- [How to use Danger well](http://danger.systems/js/usage/culture.html)
- [Examples of the kind of thing it can do](http://danger.systems/js/)
- [Dangerfile reference](http://danger.systems/js/reference.html)
2017-12-08 10:38:41 -05:00
Paul Melnikow
5527d9d642 Fix validateDOMNesting warning (#1342)
Using fix from mapbox/react-click-to-select#15.

From #1273
2017-12-06 13:04:03 -05:00
Marcin Mielnicki
0570a9e920 License badge colour corresponding to license type (#1190) 2017-12-05 16:43:29 -05:00
greenkeeper[bot]
58437ec72e Update dependencies to enable Greenkeeper 🌴 (#1328) 2017-12-05 11:49:12 -05:00
Paul Melnikow
8014aa351a Upgrade jsonpath (#1327) 2017-12-05 11:23:58 -05:00
Paul Melnikow
1eedd458b8 Fix and refactor front-end URL generation (#1322)
- Fix issue in Firefox 57 when run from static build
- Fix color parameter in dynamic badge maker
- Correctly apply maxAge in usage badges
- Follow the WHATWG lead and begin to standardize on URL, not URI (https://url.spec.whatwg.org/#goals)
2017-12-04 10:08:54 -05:00
Paul Melnikow
33690c5555 Fix missing whitespace in usage + footer
Use Fragment support added in React 16.2:

https://reactjs.org/blog/2017/11/28/react-v16.2.0-fragment-support.html
2017-12-03 15:12:22 -05:00
Paul Melnikow
2be271c22b Frontend: Allow BASE_URL to be unset (#1306)
- Do not use bogus `'undefined'` as base URI
2017-12-01 16:34:31 -05:00
Paul Melnikow
127b46aef8 Github auth admin endpoint and logging (#1267)
- Periodically log github auth information
    - Tokens are hashed which reduces the security risk inherent in the logs
        - A consistent hash is used so tokens can be correlated across the three data structures and across the three servers
- Add an admin endpoint for github auth information
    - Tokens are returned as-is to enable troubleshooting (e.g. comparing our reqRemaining to github’s)
2017-11-30 13:21:27 -05:00
Paul Melnikow
f403c2b5d3 Configure frontend tests (#1293)
While working on #1288 I configured frontend tests. I'm going in a different direction with that, though it seems worth keeping the test configuration. I added tests for one of the helper methods.
2017-11-29 18:19:05 -05:00
Paul Melnikow
c5e31b5de1 Fix frontend deploy and Heroku staging (#1288)
- Heroku reads the Node version from package.json. We're about to upgrade to Node 8 so this change to `engines` is only pre-emptive. It won't have any effect on the production servers.
- The production deploy scripts were missing the frontend files. This fixes that.
- This modifies the build setup to allow `BASE_URL=/`, which makes all requests relative to the page itself. That simplifies deploying the "debugging" frontend to the production servers, and makes it easy to host the frontend on Heroku.
2017-11-29 17:59:01 -05:00
Paul Melnikow
f3965ae9a5 Upgrade moment (#1294)
Fix moment/moment#4163.
2017-11-29 15:47:17 -05:00
Paul Melnikow
9d1efae47f Upgrade check-node-version and print error in Node 9 (#1291)
Refs:

- https://github.com/parshap/check-node-version/issues/18
- https://github.com/badges/shields/issues/1290
- https://github.com/espadrine/sc/issues/65
2017-11-29 13:11:25 -05:00
Paul Melnikow
4b5bf03fea Rewrite frontend in React (#1273)
I rewrote the frontend in React using a module bundler. It's matched feature-for-feature with the current frontend, with only slight changes in the styling. I did not fuss about making the styling identical; the badge popup looks particularly different.

This makes the front end much easier to develop. I'm really looking forward to implementing #701, to which this paves the way.

This makes light use of Next.js, which provides webpack config and dev/build tooling. We’ll probably replace it with create-react-app or our own webpack setup because unfortunately it comes with a lot of runtime overhead (the build is 400k).

Let’s open new issues for bugs and features, and track other follow-ups here: https://github.com/badges/shields/projects/1
2017-11-28 11:34:17 -05:00
Paul Melnikow
a0cd93080e Upgrade sazerac
Fix https://github.com/mikec/sazerac/pull/12
2017-11-27 17:47:54 -05:00
Paul Melnikow
bca6d15728 Upgrade camp
The version in Shields goes back to last August. I reviewed the commits and didn't see any obvious incompatibilities. Hopefully @espadrine can weigh in!
2017-11-17 18:26:19 -06:00
Paul Melnikow
7ca2e97155 Use sazerac for our data-driven tests (#1228)
Sazerac is a library for data-driven tests, where a series of tests asserts that the return value of a function matches the expected value. It provides nice syntax for tightening this up.

https://hackernoon.com/sazerac-data-driven-testing-for-javascript-e3408ac29d8c

This converts our tests to use it, and replaces some similar home-grown code.

I fixed one bug I encountered along the way: mikec/sazerac#12.
2017-11-01 20:15:19 -04:00
Paul Melnikow
a2f5cbb03a Push frontend to production servers at /index.html (#1222)
* Push frontend to production servers at /index.html

Local production builds will use local server instead of img.shields.io, to support local testing

* Restore https://img.shields.io to example URIs
2017-11-01 20:48:01 +01:00
Paul Melnikow
bde4d925f2 Retire try.html and create new dev + prod builds (#1194)
- Followup from #1163
- Retire try.html
- Separate build config for dev and production
    - Move config for badge examples into the JS build
- Move the prod transform into npm scripts
    - In the future this could be handled using a bundler plugin
- make website builds production build as before
- Run the production build in CI to make sure it’s working
- Build the frontend on Heroku
2017-10-28 14:02:45 -04:00
Paul Melnikow
446d4ce21e Correct cache behavior for custom query parameters (#1186)
I developed this for #820 to provide the correct cache behavior when a service wants to use custom parameters from the query string.

For safety, only the declared parameters (and the global parameters) are provided to the service. Consequently, failure to declare a parameter results in the parameter not working at all (undesirable, but easy to debug) rather than indeterminate behavior that depends on the cache state (undesirable, but hard to debug).
2017-10-24 23:00:23 -04:00
Paul Melnikow
7153490ef9 Use the npm lock file (#1182) 2017-10-24 22:41:34 -04:00