27 Commits

Author SHA1 Message Date
chris48s
5cdef88bcc Add renderDateBadge helper; affects [aur BitbucketLastCommit chrome date eclipse factorio galaxytoolshed GiteaLastCommit GistLastCommit GithubCreatedAt GithubHacktoberfest GithubIssueDetail GithubLastCommit GithubReleaseDate GitlabLastCommit maven npm openvsx snapcraft SourceforgeLastCommit steam vaadin visualstudio wordpress] (#10682)
* add and consistently use parseDate and renderDateBadge helpers

also move

- age
- formatDate
- formatRelativeDate

to date.js

* fix bug in wordpress last update badge

* validate in formatDate() and age()

it is going to be unlikely we'll invoke either of these
directly now, but lets calidate here too

* remove unusued imports

* reverse colours for galaxy toolshed
2024-11-17 13:15:28 +00:00
chris48s
e8157100b8 migrate examples to openApi part 11: enums; affects [codefactor conda depfu homebrew jsdelivr reddit sourceforge testspace vaadin github] (#9437)
* WIP enums

* WIP moar enums

* add a helper function for extracting enum from route pattern

* add enum schemas to services

* review and improve service names

* convert some more services with enums

* review and improve service names

* fix issue/pull request detail
2023-08-30 16:14:18 +00:00
dependabot[bot]
b9d96755ec chore(deps-dev): bump prettier from 2.8.8 to 3.0.0 (#9357)
* chore(deps-dev): bump prettier from 2.8.8 to 3.0.0

Bumps [prettier](https://github.com/prettier/prettier) from 2.8.8 to 3.0.0.
- [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/2.8.8...3.0.0)

---
updated-dependencies:
- dependency-name: prettier
  dependency-type: direct:development
  update-type: version-update:semver-major
...

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

* reformat all the things (prettier 3)

* update tests to await calls to prettier.format()

---------

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>
2023-07-10 09:27:51 +00:00
chris48s
14892e3943 Implement a pattern for dealing with upstream APIs which are slow on the first hit; affects [endpoint] (#9233)
* allow serviceData to override cacheSeconds with a longer value

* prevent [endpoint] json cacheSeconds property exceeding service default

* allow ShieldsRuntimeError to specify a cacheSeconds property

By default error responses use the cacheLength of
the service class throwing the error.

This allows error to tell the handling layer the maxAge
that should be set on the error badge response.

* add customExceptions param

This

1. allows us to specify custom properties to pass to the exception
   constructor if we throw any of the standard got errors
   e.g: `ETIMEDOUT`, `ECONNRESET`, etc
2. uses a custom `cacheSeconds` property (if set on the exception)
   to set the response maxAge

* customExceptions --> systemErrors

* errorMessages --> httpErrors
2023-06-13 21:08:43 +01:00
Alexander Wert
5b0777918a [GitHub] Added milestone property to GitHub issue details service (#7864)
* Added milestone property to GitHub issue details service

* Fixed case when no milestone is available

* fixing unit test

* fixed service test for milestone property

Co-authored-by: repo-ranger[bot] <39074581+repo-ranger[bot]@users.noreply.github.com>
2022-05-21 00:53:27 +00:00
Caleb Cartwright
24355a0773 change closed GitHub issue color to purple (#7374)
Co-authored-by: repo-ranger[bot] <39074581+repo-ranger[bot]@users.noreply.github.com>
2021-12-18 20:43:02 +00:00
Pierre-Yves B
23c0406bed Migrate from CommonJS to ESM (#6651) 2021-07-09 12:53:55 +01: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
Caleb Cartwright
ec5b976c0d convert some service classes to static fields, run [GitHubForks GitHubGoMod GitHubIssueDetail GitHubIssues GitHubLabels GitHubLanguageCount GitHubLastCommit] (#5590)
* refactor(githubforks): convert to static fields

* refactor(githubgomod): convert to static fields

* refactor(githubissuedetail): convert to static fields

* refactor(githubissues): convert to static fields

* refactor(githublabels): convert to static fields

* refactor(githublanguagecount): convert to static fields

* refactor(githublastcommit): convert to static fields

Co-authored-by: Paul Melnikow <github@paulmelnikow.com>
2020-09-22 18:18:54 -05:00
chris48s
13d75e0607 upgrade to prettier 2 (#5051)
* arrowParens: avoid
* remove trailingComma setting
2020-05-05 21:07:43 +01:00
dependabot-preview[bot]
478d14300c Build(deps-dev): bump eslint-plugin-import from 2.20.1 to 2.20.2 (#4859)
* Build(deps-dev): bump eslint-plugin-import from 2.20.1 to 2.20.2

Bumps [eslint-plugin-import](https://github.com/benmosher/eslint-plugin-import) from 2.20.1 to 2.20.2.
- [Release notes](https://github.com/benmosher/eslint-plugin-import/releases)
- [Changelog](https://github.com/benmosher/eslint-plugin-import/blob/master/CHANGELOG.md)
- [Commits](https://github.com/benmosher/eslint-plugin-import/compare/v2.20.1...v2.20.2)

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

* Fixes

* refactor: combine imports

* refactor: combine imports

* refactor: combine imports

* refactor: update import ordering

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
Co-authored-by: repo-ranger[bot] <39074581+repo-ranger[bot]@users.noreply.github.com>
Co-authored-by: Paul Melnikow <email@paulmelnikow.com>
Co-authored-by: Caleb Cartwright <calebcartwright@users.noreply.github.com>
Co-authored-by: Caleb Cartwright <caleb.cartwright@outlook.com>
2020-04-16 18:39:13 -05: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
chris48s
75ee413178 Add BaseGraphqlService, support [github] V4 API (#3763)
* add base class for Graphql APIs
* add GithubAuthV4Service + updates to GH token pool
* update github forks to use GithubAuthV4Service
* rename GithubAuthService to GithubAuthV3Service
2019-07-29 21:42:03 +01:00
dependabot-preview[bot]
294aa1e1df Build(deps-dev): bump eslint-plugin-import from 2.17.3 to 2.18.0; autofixes (#3671)
* Build(deps-dev): bump eslint-plugin-import from 2.17.3 to 2.18.0

Bumps [eslint-plugin-import](https://github.com/benmosher/eslint-plugin-import) from 2.17.3 to 2.18.0.
- [Release notes](https://github.com/benmosher/eslint-plugin-import/releases)
- [Changelog](https://github.com/benmosher/eslint-plugin-import/blob/master/CHANGELOG.md)
- [Commits](https://github.com/benmosher/eslint-plugin-import/compare/v2.17.3...v2.18.0)

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

* Autofixes
2019-07-08 12:13:46 -04: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
65dba94fa8 Stop calling variables "which"; affects [chocolatey codeclimate conda crates debug gem github mozillaobservatory nuget powershellgallery pub resharper vaadindirectory] (#3495)
* which --> variant

* which --> alias

* which --> format

* improve param names in codeclimate

* improve param names in github-issue-detail

* update github-issue-detail unit tests
2019-05-28 23:00:12 +01:00
Tesla_Ice_Zhang
e12e625141 Add pull request merge/open/closed badge (#3295) 2019-04-14 09:57:26 -05:00
Caleb Cartwright
7f24e93671 refactor [GithubIssueDetail] (#3259)
* refactor(GithubIssueDetail): ported to new service model

* refactor(GithubIssueDetail): updates based on PR discussions

* refactor(GithubIssueDetail): minor updates and additional tests

* refactor(GithubIssueDetail): minor updates to render functions per PR disc.
2019-04-03 11:59:49 -05: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
24bc7bcfc3 Combine some badge examples using drop-downs, tweak some titles (#3037)
This updates several badges to take advantage of the change from #2882.
2019-02-18 23:04:25 -05:00
Pierre-Yves B
bc96f0e25f Example keywords validation (#2956)
This pull request closes #2551: making sure that the keywords don't already appear in the example's title.

I also added validation that checks that they are at least two characters long, as this is enforced by the homepage when type your search.
2019-02-13 13:14:12 -04:00
chris48s
fba846986a fix logo imports in [github twitter liberapay] (#2817)
this was moved in #2796 but we missed updating some of the imports
2019-01-20 23:19:12 -05:00
Paul Melnikow
8a10279d95 Add static preview to some [GitHub] services (#2766) 2019-01-15 21:43:35 -05: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
b36a9040f3 Add warning banners to legacy services (#2546) 2018-12-18 20:52:17 +00:00
Paul Melnikow
fe05d00747 Move github examples into services/github (#2309) 2018-11-15 15:57:56 -05:00
Paul Melnikow
bedba47d77 Move legacy services from server.js into services/ (#1958)
This builds on the work of #1931 by moving the legacy services into `services/`.
2018-08-27 13:29:54 -04:00