mirror of
https://github.com/badges/shields.git
synced 2025-09-21 03:21:59 +03:00
* 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>
33 lines
1006 B
JavaScript
33 lines
1006 B
JavaScript
import Joi from 'joi'
|
|
import { anyInteger, nonNegativeInteger } from '../validators.js'
|
|
import { BaseJsonService } from '../index.js'
|
|
|
|
// API doc: https://libraries.io/api#project
|
|
const projectSchema = Joi.object({
|
|
platform: Joi.string().required(),
|
|
dependents_count: nonNegativeInteger,
|
|
dependent_repos_count: nonNegativeInteger,
|
|
rank: anyInteger,
|
|
}).required()
|
|
|
|
export default class LibrariesIoBase extends BaseJsonService {
|
|
constructor(context, config) {
|
|
super(context, config)
|
|
const { requestFetcher, librariesIoApiProvider } = context
|
|
this._requestFetcher = librariesIoApiProvider.fetch.bind(
|
|
librariesIoApiProvider,
|
|
requestFetcher,
|
|
)
|
|
}
|
|
|
|
async fetchProject({ platform, scope, packageName }) {
|
|
return this._requestJson({
|
|
schema: projectSchema,
|
|
url: `/${encodeURIComponent(platform)}/${
|
|
scope ? encodeURIComponent(`${scope}/`) : ''
|
|
}${encodeURIComponent(packageName)}`,
|
|
httpErrors: { 404: 'package not found' },
|
|
})
|
|
}
|
|
}
|