* add jsdoc for crates fetch func
* add BaseCratesUserService for user stats api route
part of solution for #10614
* Add CratesUserDownloads service and tester
This commit adds the CratesUserDownloads service and tester files. The CratesUserDownloads service shows the user total downloads at Crates.io.
as requested by #10614
* render userid in code block
* add non-exsistent user CratesUserDownloads test
userid for API usage is int32, therefor to minimize chance of user taking the id used the max value for int32 is used.
* fixed typo
* add some basic tests for size badge
* add crate size to crates fetch
* add crate size service
* change test to reflect base-10 counting instead
* fix downloads tests to work with new crate_size scheme addition
* move handling of unknown size to handle
* prototype fix msrv using yanked versions
* make it prettier
* deduplicate schema definition and add version info helper function
* use newest version only if it wasnt yanked
* fix variable name typo
* remove unused import
* try add new test
* satisfy linter
* don't import "describe()"
* fixup
---------
Co-authored-by: chris48s <git@chris-shaw.dev>
* update crates service test
* migrate some services from examples to openApi
* migrate crates from examples to openApi, improve titles
* explain what hd,hw,hm,hy actually mean
* improve descriptions
By default the `/crates/:crate_name` API endpoint returns the categories and keywords related to the crates. Unfortunately this causes two additional database queries on the crates.io backend.
This commit change the request URL to use `?include=` to only include the additional metadata that is needed for the requested badges.
* refactor: add render helper for downloads badges
* refactor: use new helper in some download badge classes
* doc renderer function
Co-authored-by: repo-ranger[bot] <39074581+repo-ranger[bot]@users.noreply.github.com>
* fix: runtime type error in crates version service
* chore: switch CratesVersion tester to use createServiceTester helper
* chore: removed commented out line
* which --> variant
* which --> alias
* which --> format
* improve param names in codeclimate
* improve param names in github-issue-detail
* update github-issue-detail unit tests
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
Fixes#2876 with @paulmelnikow's suggestion
Moved imports of `ServiceTester` and `createServiceTester` to a separate file so that dev dependencies are not imported by service classes.
Continue to implement #2698:
- Add `core/base-service/index.js` (but hold off on moving the things it imports)
- Add shortcuts in `services/index.js` for Base*Service, errors, and deprecatedService. This file will be streamlined later to avoid cluttering it with rarely used bits.
- Apply consistent ordering of imports and use of `module.exports` in testers.
- Remove some renaming of imports.
- Remove obsolete tests here and there.
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.