Commit Graph

2128 Commits

Author SHA1 Message Date
Paul Melnikow
3bb392dfae Remove some duplicated URL generation code (#2240)
I went down a rabbit hole while trying to untangle the bug in the dockbit and bitrise examples https://github.com/badges/shields/pull/2234#pullrequestreview-169997546.

The URL generation code is spaghetti-like, with functions, many of which I wrote, with opaque names, doing similar but not identical things, and making slightly incompatible assumptions about the way query strings are handled.

I got a bit lost and need to take a step back.

Meanwhile, this is a small piece of work I did that’s worth keeping. It doesn’t scratch the surface of the tangle, but it does remove a bit of duplication.

It also makes a minor stylistic ES6 change in the handling of default arguments.

Ref: #2027
2018-11-05 16:55:49 -05:00
Paul Melnikow
e983f7bf3b Rewrite vso, rename to [AzureDevops], validate SVG [readthedocs] (#2252)
1. Add validation to BaseSvgScrapingService and update readthedocs accordingly.
2. Rewrite vso and add more tests. Rename it internally to azure-devops. URLs are still `/vso` for now. Should we make a way to let a service register multiple URL patterns?
3. Handle shared code using a functional pattern instead of inheritance. This comes from a discussion https://github.com/badges/shields/pull/2031#issuecomment-417893819. I like the functional approach because it's more direct, nimble, and easy to reason about; plus it allows services to grow from a family of one to two more easily.
2018-11-05 16:52:53 -05:00
Paul Melnikow
600c369823 Remove some uses of to-be-deprecated url.format and url.parse APIs (#2265)
See #2225
2018-11-05 16:48:04 -05:00
Marcin Mielnicki
ba94610840 package-lock.json aded for files in Now config file (#2264) 2018-11-05 21:07:32 +01:00
Marcin Mielnicki
bc4bd79e90 Metrics with Prometheus (#2069)
* Basic process metrics

* Enable Prometheus by an environment variable

* Code formatting

* Documentation for Prometheus metrics

* Link from README to documentation of Prometheus

* Link from README to documentation of Prometheus

* Link from README to documentation of Prometheus

* Separate module for metrics + tests

* Metrics limited by IP

* Metrics are forbidded for all requets by default

* Code refactoring

* allowedIps passed as a string to PrometheusMetrics

* Handle missing config

* METRICS_PROMETHEUS_ALLOWED_IPS added to documentation

* Log info about enabled metrics

* Unused code removed

* package-lock.json updated

* prom-client updated to 11.1.2

* Code refactoring

* Do not read IP address from X-Forwarder-For header
2018-11-04 18:54:43 +01:00
Thaddée Tyl
1460855d6b Upgrade to camp 17.2.2 (#2260)
This fixes remaining vulnerabilities raised by `npm audit`.

Follow-up to https://github.com/badges/shields/pull/2258.

Related issues from dependencies:

- camp upgrade: https://github.com/espadrine/sc/issues/64
- socket.io vulnerability: https://github.com/get/parsejson/issues/4
2018-11-04 12:00:28 +00:00
Paul Melnikow
d55e1c15a6 Enforce using async-await [f-droid] (#2241)
Close #2028
2018-11-04 00:33:47 -04:00
Paul Melnikow
72768d32d9 Fix some npm audit warnings (bump debug) (#2258)
The only remaining vulnerabilites are in scoutcamp: espadrine/sc#64.
2018-11-04 00:23:37 -04:00
Paul Melnikow
83ac6ff1b3 Enforce use of template literals (#2242)
This is consistent with what we're pretty much already doing, and saves us from making the request during code review.

These were all autofixed and most of them seem easier to read. Some in the legacy services should be rewritten in more legible forms during refactor (ie using intermediate variables, or using request’s qs option). There are some in helper functions and elsewhere that should get rewritten separately. I don't want to change them in this PR because the changes will get lost in this diff, though we could identify them here and fix them before or just after.
2018-11-02 17:11:44 -04:00
dependabot[bot]
4a298cbcb0 Bump husky from 1.1.2 to 1.1.3 (#2254)
Bumps [husky](https://github.com/typicode/husky) from 1.1.2 to 1.1.3.
- [Release notes](https://github.com/typicode/husky/releases)
- [Changelog](https://github.com/typicode/husky/blob/master/CHANGELOG.md)
- [Commits](https://github.com/typicode/husky/compare/v1.1.2...v1.1.3)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2018-11-02 20:39:38 +01:00
Paul Melnikow
8feb75d97d Move more badge examples into services/ (#2247)
Continuing the work from #2234, this creates additional, empty LegacyServices to hold the badge examples for conda and cocoapods. It's an approach we could take to finish emptying out all-badge-examples while the refactoring continues.

On the website badge, even the first URL path component is variable. I didn't think it could be moved, but it can!
2018-11-01 19:39:28 -04:00
Paul Melnikow
cdb4cb36a4 Improve static example validation message (#2246) 2018-11-01 19:36:25 -04:00
dependabot[bot]
52d642cf91 Bump joi from 14.0.2 to 14.0.3 (#2251)
Bumps [joi](https://github.com/hapijs/joi) from 14.0.2 to 14.0.3.
- [Release notes](https://github.com/hapijs/joi/releases)
- [Changelog](https://github.com/hapijs/joi/blob/master/CHANGELOG.md)
- [Commits](https://github.com/hapijs/joi/compare/v14.0.2...v14.0.3)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2018-11-01 20:25:18 +00:00
dependabot[bot]
a5894c5350 Bump sinon from 7.1.0 to 7.1.1 (#2248)
Bumps [sinon](https://github.com/sinonjs/sinon) from 7.1.0 to 7.1.1.
- [Release notes](https://github.com/sinonjs/sinon/releases)
- [Changelog](https://github.com/sinonjs/sinon/blob/master/docs/changelog.md)
- [Commits](https://github.com/sinonjs/sinon/compare/v7.1.0...v7.1.1)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2018-11-01 20:18:21 +00:00
dependabot[bot]
f6b6b66fc2 Bump simple-icons from 1.9.9 to 1.9.10 (#2249)
Bumps [simple-icons](https://github.com/simple-icons/simple-icons) from 1.9.9 to 1.9.10.
- [Release notes](https://github.com/simple-icons/simple-icons/releases)
- [Commits](https://github.com/simple-icons/simple-icons/commits)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2018-11-01 20:15:18 +00:00
Paul Melnikow
275805e90c Add BaseSvgScrapingService and rewrite [ReadTheDocs]; also affects [codacy vso] (#2229)
Based on discussion in #2031, this adds an abstract service for SVG badges. I started with Readthedocs and the other services can be done as a follow-on.

I called it **BaseSvgScrapingService** rather than **BaseSvgService** to clarify that it's for badges from svg source data – not svg badges, which is all the badges.

Since I don't expect the svg parsing function to be used anywhere else once the services are refactored, I moved it into the class. I added a default value for `valueMatcher`, which works on Shields-style badges and seems to be used more than once.

The tests are based on XmlBaseService. I added one for valueMatcher, and also moved the SVG parsing badge here. Testing on codacy + vso should ensure the old `fetchFromSvg` is still working.
2018-11-01 15:09:00 -04:00
piekar294
730dc67cdf Migrate babel 6.x to babel 7.1 (#2222)
* Upgrade babel 6.x to babel 7.0
* Next 6.1.1 + additional babel packages needed for Babel 7.0
* Add @babel/register
* use @babel/preset-env in babel.presets to enable babel.env configuration
2018-11-01 15:03:50 -04:00
Paul Melnikow
07b282fa1f Enforce property shorthand (#2243)
I had to track down the right lint rule for this. We have no-useless-rename for destructuring and import/export. The one for object literals is object-shorthand.
2018-11-01 13:46:23 -04:00
Paul Melnikow
b7ecbd0a0d Move build badge examples into services/ (#2234)
all-badge-examples is a common cause of merge conflicts. It’s difficult to adjust the badge categorization in that file – or to understand the diff – because it requires moving a block from one point to another. It’s much easier to edit a badge’s category in one place.

This starts the process of breaking up what’s left of that file, following up on the work from #1931. New-style services can only be in one category, which means legacy service examples have to be split along category lines. I split out separate legacy service classes where I could do so easily, leaving behind the ones which require more work, for one reason or another.
2018-10-31 17:32:35 -04:00
Paul Melnikow
973eeb0ea7 Make bintray test more reliable (#2239)
See https://circleci.com/gh/badges/shields/19875
2018-10-31 17:28:17 -04:00
Paul Melnikow
07c5f47a73 Rework [suggest] code using async/await (#2029) 2018-10-31 17:19:14 -04:00
Pierre-Yves B
cc843946d0 Readme examples (#2233) 2018-10-31 13:47:58 +00:00
Paul Melnikow
94611fb0e4 Rewrite server deploy script (#1793)
To run this requires renaming `private/secret.json` to `private/secret-production.json` in the working tree used for deployment.

Goals:

- Ensure production secrets are not used in development
- Avoid modifying the current working tree
- Avoid branch switching: make sure the current ref gets deployed
    - If something other than `master` is deployed, leave `HEAD` alone; don't reset to `master`
- Ensure the build runs before server deploy (#1941)

This makes use of Git working trees, which is a relatively new but stable feature in Git. I was initially reluctant to use git worktree, mostly because I don't like adding new tooling that isn't necessary. The other alternative I experimented with was copying or re-cloning to an entirely separate working copy. This was messier and more brittle than using `git worktree`.
2018-10-30 17:08:52 -04:00
dependabot[bot]
d22fa6671e Bump snap-shot-it from 6.1.10 to 6.2.2 (#2227)
Bumps [snap-shot-it](https://github.com/bahmutov/snap-shot-it) from 6.1.10 to 6.2.2.
- [Release notes](https://github.com/bahmutov/snap-shot-it/releases)
- [Commits](https://github.com/bahmutov/snap-shot-it/compare/v6.1.10...v6.2.2)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2018-10-30 20:31:02 +00:00
dependabot[bot]
f9384d769b Bump react from 16.5.2 to 16.6.0 (#2213)
* Bump react from 16.5.2 to 16.6.0
* Bump react-dom from 16.5.2 to 16.6.0
2018-10-30 20:23:30 +00:00
chris48s
6fc8744bab Give the NPM package some love (#2200)
* define a public interface for NPM package
* move check-node-version to dependencies
* add missing file to package
* update docs
* bump version
* add gh-badges option to issue template
* abstract text measuring from users
* add a DocBlock for BadgeFactory.create()
2.0.0-beta1
2018-10-30 18:34:04 +00:00
piekar294
d7a52f3228 Make shippable preview bagde static (#2230) 2018-10-30 18:17:28 +00:00
dependabot[bot]
0a67631f2e Bump joi from 14.0.1 to 14.0.2 (#2235)
Bumps [joi](https://github.com/hapijs/joi) from 14.0.1 to 14.0.2.
- [Release notes](https://github.com/hapijs/joi/releases)
- [Changelog](https://github.com/hapijs/joi/blob/master/CHANGELOG.md)
- [Commits](https://github.com/hapijs/joi/compare/v14.0.1...v14.0.2)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2018-10-30 18:04:39 +00:00
dependabot[bot]
505940e194 Bump eslint from 5.7.0 to 5.8.0 (#2226)
Bumps [eslint](https://github.com/eslint/eslint) from 5.7.0 to 5.8.0.
- [Release notes](https://github.com/eslint/eslint/releases)
- [Changelog](https://github.com/eslint/eslint/blob/master/CHANGELOG.md)
- [Commits](https://github.com/eslint/eslint/compare/v5.7.0...v5.8.0)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2018-10-29 22:22:11 -04:00
Danial
2ee98f92ce bump simple-icons version (#2231)
* bump simple-icons version

* require specific version
2018-10-29 21:58:17 -04:00
Tagan Hoyle
b6c851a377 Refactor [Requires]IO (#2220) 2018-10-28 16:19:39 +00:00
Paul Melnikow
e66d92f835 Add some error messages for the developer when .service.js is malformed (#1894)
Add some error messages for the developer when .service.js is malformed

When loading `.service.js` files which don’t contain services, such as when the export is forgotten, print helpful error messages. This will only occur during development; the unit tests will catch these problems well before code reaches the server.
2018-10-28 15:58:38 +00:00
chris48s
87524976c9 upgrade to Joi 14; affects [elm-package jetbrains npmversion pypi vaadin-directory dynamic-xml] (#2221)
* upgrade to Joi 14
    Joi 14 throws an exception on regexes which use the `g` flag
    see https://github.com/hapijs/joi/issues/1615
    semver-regex uses the `g` flag
    https://github.com/sindresorhus/semver-regex/blob/master/index.js
    so in order to upgrade Joi, I've swapped out semver-regex
    We'll use joi-extension-semver for semver validation now

* use isVPlusDottedVersionNClauses in jetbrains tests
    some of these projects use version numbers like
    v1.7 or
    v3.0.0.141
2018-10-28 15:56:19 +00:00
Paul Melnikow
6e51178e73 Make more consistent use of async/await (#2219)
In #2028 I suggested that we update as much of the code as possible to make consistent use of async await. This snags a bunch of the utility code and attempts to do that.
2018-10-28 11:34:47 -04:00
Tagan Hoyle
60592b8547 Refactor [Wordpress] Service (#2152) 2018-10-27 11:59:43 +01:00
Thomas Démoulins
979a34b831 #2082 Rename VSTS into Azure DevOps + update its documentation (#2206) 2018-10-27 09:54:31 +01:00
dependabot[bot]
c13da3d530 Bump sinon from 7.0.0 to 7.1.0 (#2217)
Bumps [sinon](https://github.com/sinonjs/sinon) from 7.0.0 to 7.1.0.
- [Release notes](https://github.com/sinonjs/sinon/releases)
- [Changelog](https://github.com/sinonjs/sinon/blob/master/docs/changelog.md)
- [Commits](https://github.com/sinonjs/sinon/commits)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2018-10-27 09:48:14 +01:00
dependabot[bot]
edde74095a Bump nyc from 13.0.1 to 13.1.0 (#2185)
Bumps [nyc](https://github.com/istanbuljs/nyc) from 13.0.1 to 13.1.0.
- [Release notes](https://github.com/istanbuljs/nyc/releases)
- [Changelog](https://github.com/istanbuljs/nyc/blob/master/CHANGELOG.md)
- [Commits](https://github.com/istanbuljs/nyc/compare/v13.0.1...v13.1.0)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2018-10-27 09:43:23 +01:00
dependabot[bot]
59fba5d173 Bump simple-icons from 1.9.7 to 1.9.9 (#2216)
Bumps [simple-icons](https://github.com/simple-icons/simple-icons) from 1.9.7 to 1.9.9.
- [Release notes](https://github.com/simple-icons/simple-icons/releases)
- [Commits](https://github.com/simple-icons/simple-icons/commits)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2018-10-27 09:32:59 +01:00
Tagan Hoyle
6e8c71b01b Refactor [Swagger] Service (#2215) 2018-10-27 09:30:26 +01:00
chris48s
b866089c64 allow badge maxAge to be set by category; affects [discord] (#2205)
* allow badge maxAge to be set by category
* override default cache length for [discord]
* update maxAge docs
2018-10-26 20:08:02 +01:00
Pierre-Yves B
99ec8fa239 [eclipse-marketplace] License badge (#2212) 2018-10-25 20:53:34 +01:00
chris48s
744ef16009 refactor [depfu] service (#2204) 2018-10-23 18:24:14 +01:00
Pierre-Yves B
efb40fe4c0 Static Code Climate examples (#2201) 2018-10-23 18:12:29 +01:00
chris48s
8ee2701836 refactor [hexpm] service (#2203) 2018-10-23 18:06:57 +01:00
chris48s
aeceb283d8 switch [powershellgallery] to use temp url (#2189) 2018-10-23 18:03:50 +01:00
Anatoli Babenia
9df1da137c Document suggestion API endpoint (#2202) 2018-10-21 14:41:12 +01:00
Lentil Sun
88f10f8079 Fix: colorB override not working for Github Stars (#2171) 2018-10-21 14:33:12 +01:00
piekar294
6c09bc0998 add tests for [cookbook] service (#2197) 2018-10-21 14:21:09 +01:00
Przemo Nowaczyk
95f1b50194 test "static" gitter service behaviour (#2199) 2018-10-20 21:32:40 +02:00