diff --git a/lib/unhandled-rejection.spec.js b/core/unhandled-rejection.spec.js similarity index 100% rename from lib/unhandled-rejection.spec.js rename to core/unhandled-rejection.spec.js diff --git a/doc/TUTORIAL.md b/doc/TUTORIAL.md index 64694f1017cf5..25491f53a238c 100644 --- a/doc/TUTORIAL.md +++ b/doc/TUTORIAL.md @@ -1,12 +1,10 @@ -Tutorial on how to add a badge for a service -============================================ +# Tutorial on how to add a badge for a service This tutorial should help you add a service to shields.io in form of a badge. You will need to learn to use JavaScript, Git and GitHub. Please [improve the tutorial](https://github.com/badges/shields/edit/master/doc/TUTORIAL.md) while you read it. -(1) Reading ------------ +## (1) Reading You should read [CONTRIBUTING.md](../CONTRIBUTING.md) @@ -14,8 +12,7 @@ You can also read previous [merged pull-requests with the 'service-badge' label](https://github.com/badges/shields/pulls?utf8=%E2%9C%93&q=is%3Apr+label%3Aservice-badge+is%3Amerged) to see how other people implemented their badges. -(2) Setup ---------- +## (2) Setup ### Pre-requisites @@ -48,25 +45,24 @@ You may also want to install This is an optional dependency needed for generating badges in raster format, but you can get a dev copy running without it. -(3) Open an Issue ------------------ +## (3) Open an Issue Before you want to implement your service, you may want to [open an issue](https://github.com/badges/shields/issues/new?template=2_Badge_request.md) and describe what you have in mind: + - What is the badge for? - Which API do you want to use? You may additionally proceed to say what you want to work on. This information allows other humans to help and build on your work. -(4) Implementing ----------------- +## (4) Implementing ### (4.1) Structure and Layout Service badge code is stored in the [/services](https://github.com/badges/shields/tree/master/services/) directory. Each service has a directory for its files: -* In files ending with `.service.js`, you can find the code which handles +- In files ending with `.service.js`, you can find the code which handles incoming requests and generates the badges. Sometimes, code for a service can be re-used. This might be the case when you add a badge for an API which is already used @@ -74,20 +70,21 @@ Each service has a directory for its files: Imagine a service that lives at https://img.shields.io/example/some-param-here.svg. - * For services with a single badge, the badge code will generally be stored in + - For services with a single badge, the badge code will generally be stored in `/services/example/example.service.js`. If you add a badge for a new API, create a new directory. Example: [wercker](https://github.com/badges/shields/tree/master/services/wercker) - * For service families with multiple badges we usually store the code for each + - For service families with multiple badges we usually store the code for each badge in its own file like this: - * `/services/example/example-downloads.service.js` - * `/services/example/example-version.service.js` etc. + + - `/services/example/example-downloads.service.js` + - `/services/example/example-version.service.js` etc. Example: [ruby gems](https://github.com/badges/shields/tree/master/services/gem) -* In files ending with `.tester.js`, you can find the code which uses +- In files ending with `.tester.js`, you can find the code which uses the shields server to test if the badges are generated correctly. There is a [chapter on Tests][write tests]. @@ -96,32 +93,35 @@ Each service has a directory for its files: All service badge classes inherit from [BaseService] or another class which extends it. Other classes implement useful behavior on top of [BaseService]. -* [BaseJsonService](https://github.com/badges/shields/blob/master/services/base-json.js) +- [BaseJsonService](https://github.com/badges/shields/blob/master/services/base-json.js) implements methods for performing requests to a JSON API and schema validation. -* [BaseXmlService](https://github.com/badges/shields/blob/master/services/base-xml.js) +- [BaseXmlService](https://github.com/badges/shields/blob/master/services/base-xml.js) implements methods for performing requests to an XML API and schema validation. -* If you are contributing to a *service family*, you may define a common super +- If you are contributing to a _service family_, you may define a common super class for the badges or one may already exist. -[BaseService]: https://github.com/badges/shields/blob/master/services/base.js +[baseservice]: https://github.com/badges/shields/blob/master/services/base.js As a first step we will look at the code for an example which generates a badge without contacting an API. ```js -'use strict' // (1) +'use strict' // (1) -const { BaseService } = require('..') // (2) +const { BaseService } = require('..') // (2) -module.exports = class Example extends BaseService { // (3) +module.exports = class Example extends BaseService { + // (3) - static get route() { // (4) + static get route() { + // (4) return { base: 'example', pattern: ':text', } } - async handle({ text }) { // (5) + async handle({ text }) { + // (5) return { label: 'example', message: text, @@ -137,15 +137,15 @@ Description of the code: 2. Our service badge class will extend `BaseService` so we need to require it. Variables are declared with `const` and `let` in preference to `var`. 3. Our module must export a class which extends `BaseService`. 4. `route()` declares the URL path at which the service operates. It also maps components of the URL path to handler parameters. - * `base` defines the first part of the URL that doesn't change, e.g. `/example/`. - * `pattern` defines the variable part of the route, everything that comes after `/example/`. It can include any - number of named parameters. These are converted into - regular expressions by [`path-to-regexp`][path-to-regexp]. + - `base` defines the first part of the URL that doesn't change, e.g. `/example/`. + - `pattern` defines the variable part of the route, everything that comes after `/example/`. It can include any + number of named parameters. These are converted into + regular expressions by [`path-to-regexp`][path-to-regexp]. 5. Because a service instance won't be created until it's time to handle a request, the route and other metadata must be obtained by examining the classes themselves. [That's why they're marked `static`.][static] 6. All badges must implement the `async handle()` function that receives parameters to render the badge. Parameters of `handle()` will match the name defined in `route()` Because we're capturing a single variable called `text` our function signature is `async handle({ text })`. `async` is needed to let JavaScript do other things while we are waiting for result from external API. Although in this simple case, we don't make any external calls. Our `handle()` function should return an object with 3 properties: - * `label`: the text on the left side of the badge - * `message`: the text on the right side of the badge - here we are passing through the parameter we captured in the route regex - * `color`: the background color of the right side of the badge + - `label`: the text on the left side of the badge + - `message`: the text on the right side of the badge - here we are passing through the parameter we captured in the route regex + - `color`: the background color of the right side of the badge The process of turning this object into an image is handled automatically by the `BaseService` class. @@ -168,56 +168,63 @@ The example above was completely static. In order to make a useful service badge This example is based on the [Ruby Gems version](https://github.com/badges/shields/blob/master/services/gem/gem-version.service.js) badge: ```js -'use strict' // (1) +'use strict' // (1) -const { renderVersionBadge } = require('../../lib/version') // (2) -const { BaseJsonService } = require('..') // (3) +const { renderVersionBadge } = require('..//version') // (2) +const { BaseJsonService } = require('..') // (3) -const Joi = require('joi') // (4) -const schema = Joi.object({ // (4) - version: Joi.string().required(), // (4) -}).required() // (4) +const Joi = require('joi') // (4) +const schema = Joi.object({ + // (4) + version: Joi.string().required(), // (4) +}).required() // (4) -module.exports = class GemVersion extends BaseJsonService { // (5) +module.exports = class GemVersion extends BaseJsonService { + // (5) - static get route() { // (6) + static get route() { + // (6) return { base: 'gem/v', pattern: ':gem', } } - static get defaultBadgeData() { // (7) + static get defaultBadgeData() { + // (7) return { label: 'gem' } } - async handle({ gem }) { // (8) + async handle({ gem }) { + // (8) const { version } = await this.fetch({ gem }) return this.constructor.render({ version }) } - async fetch({ gem }) { // (9) + async fetch({ gem }) { + // (9) return this._requestJson({ schema, url: `https://rubygems.org/api/v1/gems/${gem}.json`, }) } - static render({ version }) { // (10) + static render({ version }) { + // (10) return renderVersionBadge({ version }) } - } ``` Description of the code: + 1. As with the first example, we declare strict mode at the start of each file. -2. In this case we are making a version badge, which is a common pattern. Instead of directly returning an object in this badge we will use a helper function to format our data consistently. There are a variety of helper functions to help with common tasks in `/lib`. Some useful generic helpers can be found in: - * [build-status.js](https://github.com/badges/shields/blob/master/lib/build-status.js) - * [color-formatters.js](https://github.com/badges/shields/blob/master/lib/color-formatters.js) - * [licenses.js](https://github.com/badges/shields/blob/master/lib/licenses.js) - * [text-formatters.js](https://github.com/badges/shields/blob/master/lib/text-formatters.js) - * [version.js](https://github.com/badges/shields/blob/master/lib/version.js) +2. In this case we are making a version badge, which is a common pattern. Instead of directly returning an object in this badge we will use a helper function to format our data consistently. There are a variety of helper functions to help with common tasks in `/services`. Some useful generic helpers can be found in: + - [build-status.js](https://github.com/badges/shields/blob/master/services/build-status.js) + - [color-formatters.js](https://github.com/badges/shields/blob/master/services/color-formatters.js) + - [licenses.js](https://github.com/badges/shields/blob/master/services/licenses.js) + - [text-formatters.js](https://github.com/badges/shields/blob/master/services/text-formatters.js) + - [version.js](https://github.com/badges/shields/blob/master/services/version.js) 3. Our badge will query a JSON API so we will extend `BaseJsonService` instead of `BaseService`. This contains some helpers to reduce the need for boilerplate when calling a JSON API. 4. We perform input validation by defining a schema which we expect the JSON we receive to conform to. This is done using [Joi](https://github.com/hapijs/joi). Defining a schema means we can ensure the JSON we receive meets our expectations and throw an error if we receive unexpected input without having to explicitly code validation checks. The schema also acts as a filter on the JSON object. Any properties we're going to reference need to be validated, otherwise they will be filtered out. In this case our schema declares that we expect to receive an object which must have a property called 'status', which is a string. 5. Our module exports a class which extends `BaseJsonService` @@ -225,21 +232,21 @@ Description of the code: 7. We can use `defaultBadgeData()` to set a default `color`, `logo` and/or `label`. If `handle()` doesn't return any of these keys, we'll use the default. Instead of explicitly setting the label text when we return a badge object, we'll use `defaultBadgeData()` here to define it declaratively. 8. Our badge must implement the `async handle()` function. Because our URL pattern captures a variable called `gem`, our function signature is `async handle({ gem })`. We usually separate the process of generating a badge into 2 stages or concerns: fetch and render. The `fetch()` function is responsible for calling an API endpoint to get data. The `render()` function formats the data for display. In a case where there is a lot of calculation or intermediate steps, this pattern may be thought of as fetch, transform, render and it might be necessary to define some helper functions to assist with the 'transform' step. 9. The `async fetch()` method is responsible for calling an API endpoint to get data. Extending `BaseJsonService` gives us the helper function `_requestJson()`. Note here that we pass the schema we defined in step 4 as an argument. `_requestJson()` will deal with validating the response against the schema and throwing an error if necessary. - * `_requestJson()` automatically adds an Accept header, checks the status code, parses the response as JSON, and returns the parsed response. - * `_requestJson()` uses [request](https://github.com/request/request) to perform the HTTP request. Options can be passed to request, including method, query string, and headers. If headers are provided they will override the ones automatically set by `_requestJson()`. There is no need to specify json, as the JSON parsing is handled by `_requestJson()`. See the `request` docs for [supported options](https://github.com/request/request#requestoptions-callback). - * Error messages corresponding to each status code can be returned by passing a dictionary of status codes -> messages in `errorMessages`. - * A more complex call to `_requestJson()` might look like this: - ```js - return this._requestJson({ - schema: mySchema, - url, - options: { qs: { branch: 'master' } }, - errorMessages: { - 401: 'private application not supported', - 404: 'application not found', - }, - }) - ``` + - `_requestJson()` automatically adds an Accept header, checks the status code, parses the response as JSON, and returns the parsed response. + - `_requestJson()` uses [request](https://github.com/request/request) to perform the HTTP request. Options can be passed to request, including method, query string, and headers. If headers are provided they will override the ones automatically set by `_requestJson()`. There is no need to specify json, as the JSON parsing is handled by `_requestJson()`. See the `request` docs for [supported options](https://github.com/request/request#requestoptions-callback). + - Error messages corresponding to each status code can be returned by passing a dictionary of status codes -> messages in `errorMessages`. + - A more complex call to `_requestJson()` might look like this: + ```js + return this._requestJson({ + schema: mySchema, + url, + options: { qs: { branch: 'master' } }, + errorMessages: { + 401: 'private application not supported', + 404: 'application not found', + }, + }) + ``` 10. The `static render()` method is responsible for formatting the data for display. `render()` is a pure function so we can make it a `static` method. By convention we declare functions which don't reference `this` as `static`. We could explicitly return an object here, as we did in the previous example. In this case, we will hand the version string off to `renderVersionBadge()` which will format it consistently and set an appropriate color. Because `renderVersionBadge()` doesn't return a `label` key, the default label we defined in `defaultBadgeData()` will be used when we generate the badge. This code allows us to call this URL to generate this badge: ![](https://img.shields.io/gem/v/formatador.svg) @@ -248,10 +255,10 @@ It is also worth considering the code we _haven't_ written here. Note that our e Specifically `BaseJsonService` will handle the following errors for us: -* API does not respond -* API responds with a non-`200 OK` status code -* API returns a response which can't be parsed as JSON -* API returns a response which doesn't validate against our schema +- API does not respond +- API responds with a non-`200 OK` status code +- API returns a response which can't be parsed as JSON +- API returns a response which doesn't validate against our schema Sometimes it may be necessary to manually throw an exception to deal with a non-standard error condition. If so, there are several standard exceptions that can be used. These exceptions are defined in @@ -268,19 +275,20 @@ throw new NotFound({ prettyMessage: 'package not found' }) Once we have implemented our badge, we can add it to the index so that users can discover it. We will do this by adding a couple of additional methods to our class. - ```js module.exports = class GemVersion extends BaseJsonService { - // ... - static get category() { // (1) + static get category() { + // (1) return 'version' } - static get examples() { // (2) + static get examples() { + // (2) return [ - { // (3) + { + // (3) title: 'Gem', namedParams: { gem: 'formatador' }, staticPreview: this.render({ version: '2.1.0' }), @@ -288,25 +296,24 @@ module.exports = class GemVersion extends BaseJsonService { }, ] } - } ``` 1. The `category()` property defines which heading in the index our example will appear under. 2. The examples property defines an array of examples. In this case the array will contain a single object, but in some cases it is helpful to provide multiple usage examples. 3. Our example object should contain the following properties: - * `title`: Descriptive text that will be shown next to the badge - * `namedParams`: Provide a valid example of params we can substitute into - the pattern. In this case we need a valid ruby gem, so we've picked [formatador](https://rubygems.org/gems/formatador). - * `staticPreview`: On the index page we want to show an example badge, but for performance reasons we want that example to be generated without making an API call. `staticPreview` should be populated by calling our `render()` method with some valid data. - * `keywords`: If we want to provide additional keywords other than the title, we can add them here. This helps users to search for relevant badges. + - `title`: Descriptive text that will be shown next to the badge + - `namedParams`: Provide a valid example of params we can substitute into + the pattern. In this case we need a valid ruby gem, so we've picked [formatador](https://rubygems.org/gems/formatador). + - `staticPreview`: On the index page we want to show an example badge, but for performance reasons we want that example to be generated without making an API call. `staticPreview` should be populated by calling our `render()` method with some valid data. + - `keywords`: If we want to provide additional keywords other than the title, we can add them here. This helps users to search for relevant badges. Save, run `npm start`, and you can see it [locally](http://127.0.0.1:3000/). -If you update `examples`, you don't have to restart the server. Run `npm run -defs` in another terminal window and the frontend will update. +If you update `examples`, you don't have to restart the server. Run `npm run defs` in another terminal window and the frontend will update. ### (4.5) Write Tests + [write tests]: #45-write-tests When creating a badge for a new service or changing a badge's behavior, tests @@ -334,12 +341,13 @@ token or credentials are for and how to obtain them. ## (5) Create a Pull Request Once you have implemented a new badge: -* Before submitting your changes, please review the [coding guidelines](https://github.com/badges/shields/blob/master/CONTRIBUTING.md#coding-guidelines). -* [Create a pull-request](https://help.github.com/articles/creating-a-pull-request/) to propose your changes. -* CI will check the tests pass and that your code conforms to our coding standards. -* We also use [Danger](https://danger.systems/) to check for some common problems. The first comment on your pull request will be posted by a bot. If there are any errors or warnings raised, please review them. -* One of the -[maintainers](https://github.com/badges/shields/blob/master/README.md#project-leaders) -will review your contribution. -* We'll work with you to progress your contribution suggesting improvements if necessary. Although there are some occasions where a contribution is not appropriate, if your contribution conforms to our [guidelines](https://github.com/badges/shields/blob/master/CONTRIBUTING.md#badge-guidelines) we'll aim to work towards merging it. The majority of pull requests adding a service badge are merged. -* If your contribution is merged, the final comment on the pull request will be an automated post which you can monitor to tell when your contribution has been deployed to production. + +- Before submitting your changes, please review the [coding guidelines](https://github.com/badges/shields/blob/master/CONTRIBUTING.md#coding-guidelines). +- [Create a pull-request](https://help.github.com/articles/creating-a-pull-request/) to propose your changes. +- CI will check the tests pass and that your code conforms to our coding standards. +- We also use [Danger](https://danger.systems/) to check for some common problems. The first comment on your pull request will be posted by a bot. If there are any errors or warnings raised, please review them. +- One of the + [maintainers](https://github.com/badges/shields/blob/master/README.md#project-leaders) + will review your contribution. +- We'll work with you to progress your contribution suggesting improvements if necessary. Although there are some occasions where a contribution is not appropriate, if your contribution conforms to our [guidelines](https://github.com/badges/shields/blob/master/CONTRIBUTING.md#badge-guidelines) we'll aim to work towards merging it. The majority of pull requests adding a service badge are merged. +- If your contribution is merged, the final comment on the pull request will be an automated post which you can monitor to tell when your contribution has been deployed to production. diff --git a/services/amo/amo-downloads.service.js b/services/amo/amo-downloads.service.js index 356ec2a24ea6c..9a2864cb1a36d 100644 --- a/services/amo/amo-downloads.service.js +++ b/services/amo/amo-downloads.service.js @@ -1,7 +1,7 @@ 'use strict' -const { metric } = require('../../lib/text-formatters') -const { downloadCount } = require('../../lib/color-formatters') +const { metric } = require('../text-formatters') +const { downloadCount } = require('../color-formatters') const { redirector } = require('..') const { BaseAmoService, keywords } = require('./amo-base') diff --git a/services/amo/amo-rating.service.js b/services/amo/amo-rating.service.js index 27623e2794792..4a81e2820aa3b 100644 --- a/services/amo/amo-rating.service.js +++ b/services/amo/amo-rating.service.js @@ -1,7 +1,7 @@ 'use strict' -const { starRating } = require('../../lib/text-formatters') -const { floorCount: floorCountColor } = require('../../lib/color-formatters') +const { starRating } = require('../text-formatters') +const { floorCount: floorCountColor } = require('../color-formatters') const { BaseAmoService, keywords } = require('./amo-base') module.exports = class AmoRating extends BaseAmoService { diff --git a/services/amo/amo-users.service.js b/services/amo/amo-users.service.js index 8b32ab3c3dad3..09dfad14a1383 100644 --- a/services/amo/amo-users.service.js +++ b/services/amo/amo-users.service.js @@ -1,6 +1,6 @@ 'use strict' -const { metric } = require('../../lib/text-formatters') +const { metric } = require('../text-formatters') const { BaseAmoService, keywords } = require('./amo-base') module.exports = class AmoUsers extends BaseAmoService { diff --git a/services/amo/amo-version.service.js b/services/amo/amo-version.service.js index db34d635e9df4..6691273523f13 100644 --- a/services/amo/amo-version.service.js +++ b/services/amo/amo-version.service.js @@ -1,6 +1,6 @@ 'use strict' -const { renderVersionBadge } = require('../../lib/version') +const { renderVersionBadge } = require('../version') const { BaseAmoService, keywords } = require('./amo-base') module.exports = class AmoVersion extends BaseAmoService { diff --git a/services/ansible/ansible-quality.service.js b/services/ansible/ansible-quality.service.js index 16eed6a4f8e96..64eadf429abb8 100644 --- a/services/ansible/ansible-quality.service.js +++ b/services/ansible/ansible-quality.service.js @@ -1,7 +1,7 @@ 'use strict' const Joi = require('joi') -const { floorCount } = require('../../lib/color-formatters') +const { floorCount } = require('../color-formatters') const { BaseJsonService, InvalidResponse } = require('..') const ansibleContentSchema = Joi.object({ diff --git a/services/ansible/ansible-role.service.js b/services/ansible/ansible-role.service.js index e987da5574764..00d29ae3e1bf2 100644 --- a/services/ansible/ansible-role.service.js +++ b/services/ansible/ansible-role.service.js @@ -1,8 +1,8 @@ 'use strict' const Joi = require('joi') -const { downloadCount } = require('../../lib/color-formatters') -const { metric } = require('../../lib/text-formatters') +const { downloadCount } = require('../color-formatters') +const { metric } = require('../text-formatters') const { BaseJsonService } = require('..') const { nonNegativeInteger } = require('../validators') diff --git a/services/apm/apm.service.js b/services/apm/apm.service.js index 9844927f34e53..91061ff6576da 100644 --- a/services/apm/apm.service.js +++ b/services/apm/apm.service.js @@ -1,9 +1,9 @@ 'use strict' const Joi = require('joi') -const { renderLicenseBadge } = require('../../lib/licenses') -const { renderVersionBadge } = require('../../lib/version') -const { metric } = require('../../lib/text-formatters') +const { renderLicenseBadge } = require('../licenses') +const { renderVersionBadge } = require('../version') +const { metric } = require('../text-formatters') const { BaseJsonService, InvalidResponse } = require('..') const { nonNegativeInteger } = require('../validators') diff --git a/services/appveyor/appveyor-base.js b/services/appveyor/appveyor-base.js index e8b1902434a06..6dea851976c32 100644 --- a/services/appveyor/appveyor-base.js +++ b/services/appveyor/appveyor-base.js @@ -3,7 +3,7 @@ const Joi = require('joi') const { BaseJsonService } = require('..') const { nonNegativeInteger } = require('../validators') -const { isBuildStatus } = require('../../lib/build-status') +const { isBuildStatus } = require('../build-status') const schema = Joi.object({ build: Joi.object({ diff --git a/services/appveyor/appveyor-ci.service.js b/services/appveyor/appveyor-ci.service.js index e8548afdcb14f..1e3dc87b08bdd 100644 --- a/services/appveyor/appveyor-ci.service.js +++ b/services/appveyor/appveyor-ci.service.js @@ -1,6 +1,6 @@ 'use strict' -const { renderBuildStatusBadge } = require('../../lib/build-status') +const { renderBuildStatusBadge } = require('../build-status') const AppVeyorBase = require('./appveyor-base') module.exports = class AppVeyorCi extends AppVeyorBase { diff --git a/services/appveyor/appveyor-ci.tester.js b/services/appveyor/appveyor-ci.tester.js index 8128f84af8bd6..ae7eaea86faf4 100644 --- a/services/appveyor/appveyor-ci.tester.js +++ b/services/appveyor/appveyor-ci.tester.js @@ -1,7 +1,7 @@ 'use strict' const Joi = require('joi') -const { isBuildStatus } = require('../../lib/build-status') +const { isBuildStatus } = require('../build-status') const t = (module.exports = require('../tester').createServiceTester()) t.create('CI status') diff --git a/services/appveyor/appveyor-tests.service.js b/services/appveyor/appveyor-tests.service.js index 2b7f5fe740ed2..0f7a1fdcbff34 100644 --- a/services/appveyor/appveyor-tests.service.js +++ b/services/appveyor/appveyor-tests.service.js @@ -1,7 +1,7 @@ 'use strict' const Joi = require('joi') -const { renderTestResultBadge } = require('../../lib/text-formatters') +const { renderTestResultBadge } = require('../text-formatters') const AppVeyorBase = require('./appveyor-base') const documentation = ` diff --git a/services/aur/aur.service.js b/services/aur/aur.service.js index 1b1e4d304ab09..4e6ebd7fab30b 100644 --- a/services/aur/aur.service.js +++ b/services/aur/aur.service.js @@ -1,8 +1,8 @@ 'use strict' const Joi = require('joi') -const { floorCount: floorCountColor } = require('../../lib/color-formatters') -const { addv, metric } = require('../../lib/text-formatters') +const { floorCount: floorCountColor } = require('../color-formatters') +const { addv, metric } = require('../text-formatters') const { BaseJsonService, NotFound } = require('..') const { nonNegativeInteger } = require('../validators') diff --git a/services/azure-devops/azure-devops-build.service.js b/services/azure-devops/azure-devops-build.service.js index e713638af5e5b..411657cfcc7a4 100644 --- a/services/azure-devops/azure-devops-build.service.js +++ b/services/azure-devops/azure-devops-build.service.js @@ -1,6 +1,6 @@ 'use strict' -const { renderBuildStatusBadge } = require('../../lib/build-status') +const { renderBuildStatusBadge } = require('../build-status') const { BaseSvgScrapingService, NotFound } = require('..') const { keywords, fetch } = require('./azure-devops-helpers') diff --git a/services/azure-devops/azure-devops-build.tester.js b/services/azure-devops/azure-devops-build.tester.js index 8e487895fe490..ff5378a98c234 100644 --- a/services/azure-devops/azure-devops-build.tester.js +++ b/services/azure-devops/azure-devops-build.tester.js @@ -1,7 +1,7 @@ 'use strict' const Joi = require('joi') -const { isBuildStatus } = require('../../lib/build-status') +const { isBuildStatus } = require('../build-status') const t = (module.exports = require('../tester').createServiceTester()) // https://dev.azure.com/totodem/Shields.io is a public Azure DevOps project diff --git a/services/azure-devops/azure-devops-coverage.service.js b/services/azure-devops/azure-devops-coverage.service.js index 04a53f930c26a..838a52889b8c1 100644 --- a/services/azure-devops/azure-devops-coverage.service.js +++ b/services/azure-devops/azure-devops-coverage.service.js @@ -3,7 +3,7 @@ const Joi = require('joi') const { coveragePercentage: coveragePercentageColor, -} = require('../../lib/color-formatters') +} = require('../color-formatters') const AzureDevOpsBase = require('./azure-devops-base') const { keywords, getHeaders } = require('./azure-devops-helpers') diff --git a/services/azure-devops/azure-devops-helpers.js b/services/azure-devops/azure-devops-helpers.js index 15b80926ce2e0..645e80a692ed9 100644 --- a/services/azure-devops/azure-devops-helpers.js +++ b/services/azure-devops/azure-devops-helpers.js @@ -2,7 +2,7 @@ const Joi = require('joi') const serverSecrets = require('../../lib/server-secrets') -const { isBuildStatus } = require('../../lib/build-status') +const { isBuildStatus } = require('../build-status') const keywords = ['vso', 'vsts', 'azure-devops'] diff --git a/services/azure-devops/azure-devops-release.service.js b/services/azure-devops/azure-devops-release.service.js index 88f7449e9b461..0bbc6ab41f694 100644 --- a/services/azure-devops/azure-devops-release.service.js +++ b/services/azure-devops/azure-devops-release.service.js @@ -1,6 +1,6 @@ 'use strict' -const { renderBuildStatusBadge } = require('../../lib/build-status') +const { renderBuildStatusBadge } = require('../build-status') const { BaseSvgScrapingService } = require('..') const { keywords, fetch } = require('./azure-devops-helpers') diff --git a/services/azure-devops/azure-devops-release.tester.js b/services/azure-devops/azure-devops-release.tester.js index fe7b0acf6d0bb..03817052d07e3 100644 --- a/services/azure-devops/azure-devops-release.tester.js +++ b/services/azure-devops/azure-devops-release.tester.js @@ -1,7 +1,7 @@ 'use strict' const Joi = require('joi') -const { isBuildStatus } = require('../../lib/build-status') +const { isBuildStatus } = require('../build-status') const t = (module.exports = require('../tester').createServiceTester()) // https://dev.azure.com/totodem/Shields.io is a public Azure DevOps project diff --git a/services/azure-devops/azure-devops-tests.service.js b/services/azure-devops/azure-devops-tests.service.js index daf5f9e24a539..8663da3d12a46 100644 --- a/services/azure-devops/azure-devops-tests.service.js +++ b/services/azure-devops/azure-devops-tests.service.js @@ -1,7 +1,7 @@ 'use strict' const Joi = require('joi') -const { renderTestResultBadge } = require('../../lib/text-formatters') +const { renderTestResultBadge } = require('../text-formatters') const AzureDevOpsBase = require('./azure-devops-base') const { getHeaders } = require('./azure-devops-helpers') diff --git a/services/bintray/bintray.service.js b/services/bintray/bintray.service.js index e04709868de9a..e3f31577ef705 100644 --- a/services/bintray/bintray.service.js +++ b/services/bintray/bintray.service.js @@ -1,7 +1,7 @@ 'use strict' const Joi = require('joi') -const { renderVersionBadge } = require('../../lib/version') +const { renderVersionBadge } = require('../version') const serverSecrets = require('../../lib/server-secrets') const { BaseJsonService } = require('..') diff --git a/services/bitbucket/bitbucket-issues.service.js b/services/bitbucket/bitbucket-issues.service.js index 38bbca29416a5..2819a375e0e2d 100644 --- a/services/bitbucket/bitbucket-issues.service.js +++ b/services/bitbucket/bitbucket-issues.service.js @@ -1,7 +1,7 @@ 'use strict' const Joi = require('joi') -const { metric } = require('../../lib/text-formatters') +const { metric } = require('../text-formatters') const { BaseJsonService } = require('..') const { nonNegativeInteger } = require('../validators') diff --git a/services/bitbucket/bitbucket-pipelines.service.js b/services/bitbucket/bitbucket-pipelines.service.js index f5c19eca69d5c..fba9ae4f7df63 100644 --- a/services/bitbucket/bitbucket-pipelines.service.js +++ b/services/bitbucket/bitbucket-pipelines.service.js @@ -1,7 +1,7 @@ 'use strict' const Joi = require('joi') -const { renderBuildStatusBadge } = require('../../lib/build-status') +const { renderBuildStatusBadge } = require('../build-status') const { BaseJsonService } = require('..') const bitbucketPipelinesSchema = Joi.object({ diff --git a/services/bitbucket/bitbucket-pull-request.service.js b/services/bitbucket/bitbucket-pull-request.service.js index f7561ca85a74f..f0b897ce2497b 100644 --- a/services/bitbucket/bitbucket-pull-request.service.js +++ b/services/bitbucket/bitbucket-pull-request.service.js @@ -2,7 +2,7 @@ const Joi = require('joi') const serverSecrets = require('../../lib/server-secrets') -const { metric } = require('../../lib/text-formatters') +const { metric } = require('../text-formatters') const { nonNegativeInteger, optionalUrl } = require('../validators') const { BaseJsonService } = require('..') diff --git a/services/bitbucket/bitbucket.tester.js b/services/bitbucket/bitbucket.tester.js index 83eae86e2b545..0ce8e7f31e9e1 100644 --- a/services/bitbucket/bitbucket.tester.js +++ b/services/bitbucket/bitbucket.tester.js @@ -3,7 +3,7 @@ const Joi = require('joi') const { ServiceTester } = require('../tester') const { isMetric, isMetricOpenIssues } = require('../test-validators') -const { isBuildStatus } = require('../../lib/build-status') +const { isBuildStatus } = require('../build-status') const { mockBitbucketCreds, mockBitbucketServerCreds, diff --git a/services/bountysource/bountysource.service.js b/services/bountysource/bountysource.service.js index 5f8538dabd68f..9a759b1a2f009 100644 --- a/services/bountysource/bountysource.service.js +++ b/services/bountysource/bountysource.service.js @@ -3,7 +3,7 @@ const { BaseJsonService } = require('..') const Joi = require('joi') const { nonNegativeInteger } = require('../validators') -const { metric } = require('../../lib/text-formatters') +const { metric } = require('../text-formatters') const schema = Joi.object({ activity_total: nonNegativeInteger }) diff --git a/services/bower/bower-license.service.js b/services/bower/bower-license.service.js index 3ce517833a73b..e82e388704144 100644 --- a/services/bower/bower-license.service.js +++ b/services/bower/bower-license.service.js @@ -1,6 +1,6 @@ 'use strict' -const { renderLicenseBadge } = require('../../lib/licenses') +const { renderLicenseBadge } = require('../licenses') const BaseBowerService = require('./bower-base') module.exports = class BowerLicense extends BaseBowerService { diff --git a/services/bower/bower-version.service.js b/services/bower/bower-version.service.js index 8b88a8c9f0dcb..42018f621a16a 100644 --- a/services/bower/bower-version.service.js +++ b/services/bower/bower-version.service.js @@ -1,7 +1,7 @@ 'use strict' const BaseBowerService = require('./bower-base') -const { renderVersionBadge } = require('../../lib/version') +const { renderVersionBadge } = require('../version') const { InvalidResponse } = require('..') module.exports = class BowerVersion extends BaseBowerService { diff --git a/services/bstats/bstats-players.service.js b/services/bstats/bstats-players.service.js index 84b3ddd37e438..13efcdae73e45 100644 --- a/services/bstats/bstats-players.service.js +++ b/services/bstats/bstats-players.service.js @@ -1,7 +1,7 @@ 'use strict' const Joi = require('joi') -const { metric } = require('../../lib/text-formatters') +const { metric } = require('../text-formatters') const { BaseJsonService } = require('..') const schema = Joi.array() diff --git a/services/bstats/bstats-servers.service.js b/services/bstats/bstats-servers.service.js index 6a5b71e928c7e..f93e899768ef1 100644 --- a/services/bstats/bstats-servers.service.js +++ b/services/bstats/bstats-servers.service.js @@ -1,7 +1,7 @@ 'use strict' const Joi = require('joi') -const { metric } = require('../../lib/text-formatters') +const { metric } = require('../text-formatters') const { BaseJsonService } = require('..') const schema = Joi.array() diff --git a/lib/build-status.js b/services/build-status.js similarity index 100% rename from lib/build-status.js rename to services/build-status.js diff --git a/lib/build-status.spec.js b/services/build-status.spec.js similarity index 100% rename from lib/build-status.spec.js rename to services/build-status.spec.js diff --git a/services/buildkite/buildkite.tester.js b/services/buildkite/buildkite.tester.js index 95c7a3a392849..de2f5069fb674 100644 --- a/services/buildkite/buildkite.tester.js +++ b/services/buildkite/buildkite.tester.js @@ -1,7 +1,7 @@ 'use strict' const Joi = require('joi') -const { isBuildStatus } = require('../../lib/build-status') +const { isBuildStatus } = require('../build-status') const { invalidJSON } = require('../response-fixtures') const { ServiceTester } = require('../tester') diff --git a/services/cdnjs/cdnjs.service.js b/services/cdnjs/cdnjs.service.js index c0754892de94a..ffe4c838845d1 100644 --- a/services/cdnjs/cdnjs.service.js +++ b/services/cdnjs/cdnjs.service.js @@ -1,7 +1,7 @@ 'use strict' const Joi = require('joi') -const { renderVersionBadge } = require('../../lib/version') +const { renderVersionBadge } = require('../version') const { BaseJsonService, NotFound } = require('..') const cdnjsSchema = Joi.object({ diff --git a/services/chrome-web-store/chrome-web-store.service.js b/services/chrome-web-store/chrome-web-store.service.js index f7ec547c989c9..e8ca3a0d56cab 100644 --- a/services/chrome-web-store/chrome-web-store.service.js +++ b/services/chrome-web-store/chrome-web-store.service.js @@ -5,16 +5,13 @@ const { makeBadgeData: getBadgeData, makeLabel: getLabel, } = require('../../lib/badge-data') -const { metric, starRating } = require('../../lib/text-formatters') +const { metric, starRating } = require('../text-formatters') const { downloadCount: downloadCountColor, floorCount: floorCountColor, version: versionColor, -} = require('../../lib/color-formatters') -const { - addv: versionText, - currencyFromCode, -} = require('../../lib/text-formatters') +} = require('../color-formatters') +const { addv: versionText, currencyFromCode } = require('../text-formatters') const commonExample = { title: 'Chrome Web Store', diff --git a/services/cii-best-practices/cii-best-practices.service.js b/services/cii-best-practices/cii-best-practices.service.js index 27a35e12737f5..2cfe9d58bc6ae 100644 --- a/services/cii-best-practices/cii-best-practices.service.js +++ b/services/cii-best-practices/cii-best-practices.service.js @@ -4,7 +4,7 @@ const Joi = require('joi') const { colorScale, coveragePercentage: coveragePercentageColor, -} = require('../../lib/color-formatters') +} = require('../color-formatters') const { BaseJsonService } = require('..') const ciiBestPracticesSchema = Joi.object({ diff --git a/services/circleci/circleci.service.js b/services/circleci/circleci.service.js index 5bb6c6a876584..7ca7a39a9fdef 100644 --- a/services/circleci/circleci.service.js +++ b/services/circleci/circleci.service.js @@ -1,10 +1,7 @@ 'use strict' const Joi = require('joi') -const { - isBuildStatus, - renderBuildStatusBadge, -} = require('../../lib/build-status') +const { isBuildStatus, renderBuildStatusBadge } = require('../build-status') const { BaseJsonService } = require('..') const circleSchema = Joi.array() diff --git a/services/circleci/circleci.tester.js b/services/circleci/circleci.tester.js index c27a34f5a539f..745cfe9632908 100644 --- a/services/circleci/circleci.tester.js +++ b/services/circleci/circleci.tester.js @@ -1,7 +1,7 @@ 'use strict' const Joi = require('joi') -const { isBuildStatus } = require('../../lib/build-status') +const { isBuildStatus } = require('../build-status') const { ServiceTester } = require('../tester') const t = (module.exports = new ServiceTester({ diff --git a/services/clojars/clojars-downloads.service.js b/services/clojars/clojars-downloads.service.js index f1282773f224e..41cd8bc3df391 100644 --- a/services/clojars/clojars-downloads.service.js +++ b/services/clojars/clojars-downloads.service.js @@ -1,8 +1,8 @@ 'use strict' const Joi = require('joi') -const { metric } = require('../../lib/text-formatters') -const { downloadCount: downloadsColor } = require('../../lib/color-formatters') +const { metric } = require('../text-formatters') +const { downloadCount: downloadsColor } = require('../color-formatters') const { nonNegativeInteger } = require('../validators') const { BaseJsonService } = require('..') diff --git a/services/clojars/clojars-version.service.js b/services/clojars/clojars-version.service.js index deae4dbd0cb34..85e519acd0faa 100644 --- a/services/clojars/clojars-version.service.js +++ b/services/clojars/clojars-version.service.js @@ -1,7 +1,7 @@ 'use strict' const Joi = require('joi') -const { version: versionColor } = require('../../lib/color-formatters') +const { version: versionColor } = require('../color-formatters') const { BaseJsonService, NotFound } = require('..') const clojarsSchema = Joi.object({ diff --git a/services/cocoapods/cocoapods-docs.service.js b/services/cocoapods/cocoapods-docs.service.js index 6110b651bd41c..30b21258639cb 100644 --- a/services/cocoapods/cocoapods-docs.service.js +++ b/services/cocoapods/cocoapods-docs.service.js @@ -2,7 +2,7 @@ const { coveragePercentage: coveragePercentageColor, -} = require('../../lib/color-formatters') +} = require('../color-formatters') const Joi = require('joi') const { BaseJsonService } = require('..') diff --git a/services/cocoapods/cocoapods-version.service.js b/services/cocoapods/cocoapods-version.service.js index 8ecf96f96eb34..1b2e516c2ae2f 100644 --- a/services/cocoapods/cocoapods-version.service.js +++ b/services/cocoapods/cocoapods-version.service.js @@ -1,6 +1,6 @@ 'use strict' -const { renderVersionBadge } = require('../../lib/version') +const { renderVersionBadge } = require('../version') const BaseCocoaPodsService = require('./cocoapods-base') module.exports = class CocoapodsVersion extends BaseCocoaPodsService { diff --git a/services/codacy/codacy-coverage.service.js b/services/codacy/codacy-coverage.service.js index adc9a4718b4dd..4c21ff96f4cd8 100644 --- a/services/codacy/codacy-coverage.service.js +++ b/services/codacy/codacy-coverage.service.js @@ -3,7 +3,7 @@ const Joi = require('joi') const { coveragePercentage: coveragePercentageColor, -} = require('../../lib/color-formatters') +} = require('../color-formatters') const { BaseSvgScrapingService } = require('..') const { NotFound } = require('..') diff --git a/services/codeclimate/codeclimate.service.js b/services/codeclimate/codeclimate.service.js index d1f0c0e7b18af..28184d85e972b 100644 --- a/services/codeclimate/codeclimate.service.js +++ b/services/codeclimate/codeclimate.service.js @@ -6,7 +6,7 @@ const { coveragePercentage: coveragePercentageColor, letterScore: letterScoreColor, colorScale, -} = require('../../lib/color-formatters') +} = require('../color-formatters') class CodeclimateCoverage extends LegacyService { static get route() { diff --git a/services/codecov/codecov.service.js b/services/codecov/codecov.service.js index 6c5e19ffb87fd..a2df0e7c1a52b 100644 --- a/services/codecov/codecov.service.js +++ b/services/codecov/codecov.service.js @@ -5,7 +5,7 @@ const LegacyService = require('../legacy-service') const { makeBadgeData: getBadgeData } = require('../../lib/badge-data') const { coveragePercentage: coveragePercentageColor, -} = require('../../lib/color-formatters') +} = require('../color-formatters') // This legacy service should be rewritten to use e.g. BaseJsonService. // diff --git a/services/codeship/codeship.tester.js b/services/codeship/codeship.tester.js index ea2009cb28c5c..cd61b6457aed8 100644 --- a/services/codeship/codeship.tester.js +++ b/services/codeship/codeship.tester.js @@ -1,7 +1,7 @@ 'use strict' const Joi = require('joi') -const { isBuildStatus } = require('../../lib/build-status') +const { isBuildStatus } = require('../build-status') const { ServiceTester } = require('../tester') const t = (module.exports = new ServiceTester({ diff --git a/lib/color-formatters.js b/services/color-formatters.js similarity index 100% rename from lib/color-formatters.js rename to services/color-formatters.js diff --git a/lib/color-formatters.spec.js b/services/color-formatters.spec.js similarity index 100% rename from lib/color-formatters.spec.js rename to services/color-formatters.spec.js diff --git a/services/conda/conda-downloads.service.js b/services/conda/conda-downloads.service.js index ab381d8d7a5f0..9b02e866f7ade 100644 --- a/services/conda/conda-downloads.service.js +++ b/services/conda/conda-downloads.service.js @@ -1,7 +1,7 @@ 'use strict' -const { metric } = require('../../lib/text-formatters') -const { downloadCount } = require('../../lib/color-formatters') +const { metric } = require('../text-formatters') +const { downloadCount } = require('../color-formatters') const BaseCondaService = require('./conda-base') module.exports = class CondaDownloads extends BaseCondaService { diff --git a/services/conda/conda-version.service.js b/services/conda/conda-version.service.js index 69e4ae1edd16d..b4ab09cd314a0 100644 --- a/services/conda/conda-version.service.js +++ b/services/conda/conda-version.service.js @@ -1,7 +1,7 @@ 'use strict' -const { addv: versionText } = require('../../lib/text-formatters') -const { version: versionColor } = require('../../lib/color-formatters') +const { addv: versionText } = require('../text-formatters') +const { version: versionColor } = require('../color-formatters') const BaseCondaService = require('./conda-base') module.exports = class CondaDownloads extends BaseCondaService { diff --git a/services/continuousphp/continuousphp.tester.js b/services/continuousphp/continuousphp.tester.js index 59516d6efc76a..60b211f6e0272 100644 --- a/services/continuousphp/continuousphp.tester.js +++ b/services/continuousphp/continuousphp.tester.js @@ -1,7 +1,7 @@ 'use strict' const Joi = require('joi') -const { isBuildStatus } = require('../../lib/build-status') +const { isBuildStatus } = require('../build-status') const t = (module.exports = require('../tester').createServiceTester()) t.create('build status on default branch') diff --git a/lib/contributor-count.js b/services/contributor-count.js similarity index 100% rename from lib/contributor-count.js rename to services/contributor-count.js diff --git a/services/cookbook/cookbook.service.js b/services/cookbook/cookbook.service.js index fe9828fa062bb..249d8f4a922ba 100644 --- a/services/cookbook/cookbook.service.js +++ b/services/cookbook/cookbook.service.js @@ -2,7 +2,7 @@ const Joi = require('joi') const { BaseJsonService } = require('..') -const { renderVersionBadge } = require('../../lib/version') +const { renderVersionBadge } = require('../version') const schema = Joi.object({ version: Joi.string().required() }).required() diff --git a/services/coveralls/coveralls.service.js b/services/coveralls/coveralls.service.js index 8f21f44f525d3..0abef1ae48c21 100644 --- a/services/coveralls/coveralls.service.js +++ b/services/coveralls/coveralls.service.js @@ -4,7 +4,7 @@ const LegacyService = require('../legacy-service') const { makeBadgeData: getBadgeData } = require('../../lib/badge-data') const { coveragePercentage: coveragePercentageColor, -} = require('../../lib/color-formatters') +} = require('../color-formatters') // This legacy service should be rewritten to use e.g. BaseJsonService. // diff --git a/services/cpan/cpan-version.service.js b/services/cpan/cpan-version.service.js index f6800b1ef26e7..57a60bda4ce16 100644 --- a/services/cpan/cpan-version.service.js +++ b/services/cpan/cpan-version.service.js @@ -1,6 +1,6 @@ 'use strict' -const { renderVersionBadge } = require('../../lib/version') +const { renderVersionBadge } = require('../version') const BaseCpanService = require('./cpan') module.exports = class CpanVersion extends BaseCpanService { diff --git a/services/cran/cran.service.js b/services/cran/cran.service.js index 3a9638b73131a..305dc00a01c2e 100644 --- a/services/cran/cran.service.js +++ b/services/cran/cran.service.js @@ -2,7 +2,7 @@ const Joi = require('joi') const { BaseJsonService } = require('..') -const { renderVersionBadge } = require('../../lib/version') +const { renderVersionBadge } = require('../version') const schema = Joi.object({ License: Joi.string().required(), diff --git a/services/crates/crates-downloads.service.js b/services/crates/crates-downloads.service.js index 0c0f812cefef1..11cfbbf3721fc 100644 --- a/services/crates/crates-downloads.service.js +++ b/services/crates/crates-downloads.service.js @@ -1,9 +1,7 @@ 'use strict' -const { - downloadCount: downloadCountColor, -} = require('../../lib/color-formatters') -const { metric } = require('../../lib/text-formatters') +const { downloadCount: downloadCountColor } = require('../color-formatters') +const { metric } = require('../text-formatters') const { BaseCratesService, keywords } = require('./crates-base') module.exports = class CratesDownloads extends BaseCratesService { diff --git a/services/crates/crates-version.service.js b/services/crates/crates-version.service.js index a526d6fa41ffd..43119c1614755 100644 --- a/services/crates/crates-version.service.js +++ b/services/crates/crates-version.service.js @@ -1,6 +1,6 @@ 'use strict' -const { renderVersionBadge } = require('../../lib/version') +const { renderVersionBadge } = require('../version') const { BaseCratesService, keywords } = require('./crates-base') module.exports = class CratesVersion extends BaseCratesService { diff --git a/services/ctan/ctan.service.js b/services/ctan/ctan.service.js index 0c1deab770839..d647b064f1e25 100644 --- a/services/ctan/ctan.service.js +++ b/services/ctan/ctan.service.js @@ -1,8 +1,8 @@ 'use strict' const Joi = require('joi') -const { renderLicenseBadge } = require('../../lib/licenses') -const { renderVersionBadge } = require('../../lib/version') +const { renderLicenseBadge } = require('../licenses') +const { renderVersionBadge } = require('../version') const { BaseJsonService } = require('..') const schema = Joi.object({ diff --git a/services/date/date.service.js b/services/date/date.service.js index f3727a8e6ad5f..1f0a3f0839712 100644 --- a/services/date/date.service.js +++ b/services/date/date.service.js @@ -1,6 +1,6 @@ 'use strict' -const { formatRelativeDate } = require('../../lib/text-formatters') +const { formatRelativeDate } = require('../text-formatters') const { BaseService } = require('..') const documentation = ` diff --git a/services/discourse/discourse.service.js b/services/discourse/discourse.service.js index 623e64faff324..421a67ea42e50 100644 --- a/services/discourse/discourse.service.js +++ b/services/discourse/discourse.service.js @@ -2,7 +2,7 @@ const Joi = require('joi') const { BaseJsonService } = require('..') -const { metric } = require('../../lib/text-formatters') +const { metric } = require('../text-formatters') const { nonNegativeInteger } = require('../validators') const schema = Joi.object({ diff --git a/services/docker/docker-build.tester.js b/services/docker/docker-build.tester.js index c2515fe247cad..591cea5c4564a 100644 --- a/services/docker/docker-build.tester.js +++ b/services/docker/docker-build.tester.js @@ -1,7 +1,7 @@ 'use strict' const Joi = require('joi') -const { isBuildStatus } = require('../../lib/build-status') +const { isBuildStatus } = require('../build-status') const t = (module.exports = require('../tester').createServiceTester()) const { dockerBlue } = require('./docker-helpers') diff --git a/services/docker/docker-pulls.service.js b/services/docker/docker-pulls.service.js index 96deddfb8afef..e01b7c4c45626 100644 --- a/services/docker/docker-pulls.service.js +++ b/services/docker/docker-pulls.service.js @@ -1,7 +1,7 @@ 'use strict' const Joi = require('joi') -const { metric } = require('../../lib/text-formatters') +const { metric } = require('../text-formatters') const { BaseJsonService } = require('..') const { nonNegativeInteger } = require('../validators') const { diff --git a/services/docker/docker-stars.service.js b/services/docker/docker-stars.service.js index f17b4016327ff..72bad7c408c11 100644 --- a/services/docker/docker-stars.service.js +++ b/services/docker/docker-stars.service.js @@ -1,6 +1,6 @@ 'use strict' -const { metric } = require('../../lib/text-formatters') +const { metric } = require('../text-formatters') const { BaseService } = require('..') const { nonNegativeInteger } = require('../validators') const { diff --git a/services/dub/dub-download.service.js b/services/dub/dub-download.service.js index 70a6eec3a0b00..f843db2f0830b 100644 --- a/services/dub/dub-download.service.js +++ b/services/dub/dub-download.service.js @@ -1,8 +1,8 @@ 'use strict' const Joi = require('joi') -const { metric } = require('../../lib/text-formatters') -const { downloadCount } = require('../../lib/color-formatters') +const { metric } = require('../text-formatters') +const { downloadCount } = require('../color-formatters') const { BaseJsonService } = require('..') const { nonNegativeInteger } = require('../validators') diff --git a/services/dub/dub-license.service.js b/services/dub/dub-license.service.js index ca064350ae980..9d58a2e647d73 100644 --- a/services/dub/dub-license.service.js +++ b/services/dub/dub-license.service.js @@ -1,7 +1,7 @@ 'use strict' const Joi = require('joi') -const { renderLicenseBadge } = require('../../lib/licenses') +const { renderLicenseBadge } = require('../licenses') const { BaseJsonService } = require('..') const schema = Joi.object({ diff --git a/services/dub/dub-version.service.js b/services/dub/dub-version.service.js index c8acc910dd1d8..bdfad6e92e8c9 100644 --- a/services/dub/dub-version.service.js +++ b/services/dub/dub-version.service.js @@ -2,7 +2,7 @@ const Joi = require('joi') const { BaseJsonService } = require('..') -const { renderVersionBadge } = require('../../lib/version') +const { renderVersionBadge } = require('../version') const schema = Joi.string().required() diff --git a/services/eclipse-marketplace/eclipse-marketplace-downloads.service.js b/services/eclipse-marketplace/eclipse-marketplace-downloads.service.js index 3c123c1844752..6c60690a86103 100644 --- a/services/eclipse-marketplace/eclipse-marketplace-downloads.service.js +++ b/services/eclipse-marketplace/eclipse-marketplace-downloads.service.js @@ -1,10 +1,8 @@ 'use strict' const Joi = require('joi') -const { metric } = require('../../lib/text-formatters') -const { - downloadCount: downloadCountColor, -} = require('../../lib/color-formatters') +const { metric } = require('../text-formatters') +const { downloadCount: downloadCountColor } = require('../color-formatters') const { nonNegativeInteger } = require('../validators') const EclipseMarketplaceBase = require('./eclipse-marketplace-base') diff --git a/services/eclipse-marketplace/eclipse-marketplace-update.service.js b/services/eclipse-marketplace/eclipse-marketplace-update.service.js index 41ea27e2a669c..d4b148d6cb518 100644 --- a/services/eclipse-marketplace/eclipse-marketplace-update.service.js +++ b/services/eclipse-marketplace/eclipse-marketplace-update.service.js @@ -1,8 +1,8 @@ 'use strict' const Joi = require('joi') -const { formatDate } = require('../../lib/text-formatters') -const { age: ageColor } = require('../../lib/color-formatters') +const { formatDate } = require('../text-formatters') +const { age: ageColor } = require('../color-formatters') const { nonNegativeInteger } = require('../validators') const EclipseMarketplaceBase = require('./eclipse-marketplace-base') diff --git a/services/eclipse-marketplace/eclipse-marketplace-version.service.js b/services/eclipse-marketplace/eclipse-marketplace-version.service.js index d9b5dda00b486..2211dcfd9da5c 100644 --- a/services/eclipse-marketplace/eclipse-marketplace-version.service.js +++ b/services/eclipse-marketplace/eclipse-marketplace-version.service.js @@ -1,7 +1,7 @@ 'use strict' const Joi = require('joi') -const { renderVersionBadge } = require('../../lib/version') +const { renderVersionBadge } = require('../version') const EclipseMarketplaceBase = require('./eclipse-marketplace-base') const versionResponseSchema = Joi.object({ diff --git a/services/elm-package/elm-package.service.js b/services/elm-package/elm-package.service.js index 994b697bad645..6b4a180e67c00 100644 --- a/services/elm-package/elm-package.service.js +++ b/services/elm-package/elm-package.service.js @@ -1,7 +1,7 @@ 'use strict' const Joi = require('joi') -const { renderVersionBadge } = require('../../lib/version') +const { renderVersionBadge } = require('../version') const { BaseJsonService } = require('..') const { semver } = require('../validators') diff --git a/services/f-droid/f-droid.service.js b/services/f-droid/f-droid.service.js index 3f2b6279c06a2..503bd2b951709 100644 --- a/services/f-droid/f-droid.service.js +++ b/services/f-droid/f-droid.service.js @@ -1,8 +1,8 @@ 'use strict' const Joi = require('joi') -const { addv } = require('../../lib/text-formatters') -const { version: versionColor } = require('../../lib/color-formatters') +const { addv } = require('../text-formatters') +const { version: versionColor } = require('../color-formatters') const { BaseYamlService, InvalidResponse } = require('..') const schema = Joi.object({ diff --git a/services/gem/gem-downloads.service.js b/services/gem/gem-downloads.service.js index 88b7fabf7058f..95454c81dd273 100644 --- a/services/gem/gem-downloads.service.js +++ b/services/gem/gem-downloads.service.js @@ -2,9 +2,9 @@ const semver = require('semver') const Joi = require('joi') -const { downloadCount } = require('../../lib/color-formatters') -const { metric } = require('../../lib/text-formatters') -const { latest: latestVersion } = require('../../lib/version') +const { downloadCount } = require('../color-formatters') +const { metric } = require('../text-formatters') +const { latest: latestVersion } = require('../version') const { BaseJsonService, InvalidParameter, InvalidResponse } = require('..') const { nonNegativeInteger } = require('../validators') diff --git a/services/gem/gem-owner.service.js b/services/gem/gem-owner.service.js index 95a8fbbc09686..02cb4d869f4b0 100644 --- a/services/gem/gem-owner.service.js +++ b/services/gem/gem-owner.service.js @@ -2,7 +2,7 @@ const Joi = require('joi') const { BaseJsonService } = require('..') -const { floorCount: floorCountColor } = require('../../lib/color-formatters') +const { floorCount: floorCountColor } = require('../color-formatters') const ownerSchema = Joi.array().required() diff --git a/services/gem/gem-rank.service.js b/services/gem/gem-rank.service.js index 2e2e704fee5cc..55bdf2f4639ec 100644 --- a/services/gem/gem-rank.service.js +++ b/services/gem/gem-rank.service.js @@ -1,8 +1,8 @@ 'use strict' const Joi = require('joi') -const { floorCount } = require('../../lib/color-formatters') -const { ordinalNumber } = require('../../lib/text-formatters') +const { floorCount } = require('../color-formatters') +const { ordinalNumber } = require('../text-formatters') const { BaseJsonService, InvalidResponse } = require('..') const keywords = ['ruby'] diff --git a/services/gem/gem-version.service.js b/services/gem/gem-version.service.js index bb384629cd121..a6247174e0098 100644 --- a/services/gem/gem-version.service.js +++ b/services/gem/gem-version.service.js @@ -1,7 +1,7 @@ 'use strict' const Joi = require('joi') -const { renderVersionBadge } = require('../../lib/version') +const { renderVersionBadge } = require('../version') const { BaseJsonService } = require('..') const schema = Joi.object({ diff --git a/services/github/github-commit-activity.service.js b/services/github/github-commit-activity.service.js index a7940c0129561..2cde67f500b71 100644 --- a/services/github/github-commit-activity.service.js +++ b/services/github/github-commit-activity.service.js @@ -3,7 +3,7 @@ const LegacyService = require('../legacy-service') const { makeBadgeData: getBadgeData } = require('../../lib/badge-data') const { makeLogo: getLogo } = require('../../lib/logos') -const { metric } = require('../../lib/text-formatters') +const { metric } = require('../text-formatters') const { documentation, checkErrorResponse: githubCheckErrorResponse, diff --git a/services/github/github-contributors.service.js b/services/github/github-contributors.service.js index f2b376214fcc0..6e532f5378dc9 100644 --- a/services/github/github-contributors.service.js +++ b/services/github/github-contributors.service.js @@ -2,7 +2,7 @@ const Joi = require('joi') const parseLinkHeader = require('parse-link-header') -const { renderContributorBadge } = require('../../lib/contributor-count') +const { renderContributorBadge } = require('../contributor-count') const { GithubAuthService } = require('./github-auth-service') const { documentation, errorMessagesFor } = require('./github-helpers') diff --git a/services/github/github-downloads.service.js b/services/github/github-downloads.service.js index 2709d927bb836..4f3323b65865d 100644 --- a/services/github/github-downloads.service.js +++ b/services/github/github-downloads.service.js @@ -3,7 +3,7 @@ const LegacyService = require('../legacy-service') const { makeBadgeData: getBadgeData } = require('../../lib/badge-data') const { makeLogo: getLogo } = require('../../lib/logos') -const { metric } = require('../../lib/text-formatters') +const { metric } = require('../text-formatters') const { documentation, checkErrorResponse: githubCheckErrorResponse, diff --git a/services/github/github-helpers.js b/services/github/github-helpers.js index 95d7f1b98834e..6e31be25d0edc 100644 --- a/services/github/github-helpers.js +++ b/services/github/github-helpers.js @@ -1,7 +1,7 @@ 'use strict' const serverSecrets = require('../../lib/server-secrets') -const { colorScale } = require('../../lib/color-formatters') +const { colorScale } = require('../color-formatters') const { checkErrorResponse: standardCheckErrorResponse, } = require('../../lib/error-helper') diff --git a/services/github/github-issue-detail.service.js b/services/github/github-issue-detail.service.js index c1ca7fe7f0ee2..c4debed4f5e14 100644 --- a/services/github/github-issue-detail.service.js +++ b/services/github/github-issue-detail.service.js @@ -6,8 +6,8 @@ const { makeBadgeData: getBadgeData, } = require('../../lib/badge-data') const { makeLogo: getLogo } = require('../../lib/logos') -const { formatDate } = require('../../lib/text-formatters') -const { age: ageColor } = require('../../lib/color-formatters') +const { formatDate } = require('../text-formatters') +const { age: ageColor } = require('../color-formatters') const { documentation, stateColor: githubStateColor, diff --git a/services/github/github-issues.service.js b/services/github/github-issues.service.js index 4b9ba499203c6..85340a3138531 100644 --- a/services/github/github-issues.service.js +++ b/services/github/github-issues.service.js @@ -3,7 +3,7 @@ const LegacyService = require('../legacy-service') const { makeBadgeData: getBadgeData } = require('../../lib/badge-data') const { makeLogo: getLogo } = require('../../lib/logos') -const { metric } = require('../../lib/text-formatters') +const { metric } = require('../text-formatters') const { documentation, checkErrorResponse: githubCheckErrorResponse, diff --git a/services/github/github-last-commit.service.js b/services/github/github-last-commit.service.js index a72dd102c6ae9..8eb5c350c464b 100644 --- a/services/github/github-last-commit.service.js +++ b/services/github/github-last-commit.service.js @@ -3,8 +3,8 @@ const LegacyService = require('../legacy-service') const { makeBadgeData: getBadgeData } = require('../../lib/badge-data') const { makeLogo: getLogo } = require('../../lib/logos') -const { formatDate } = require('../../lib/text-formatters') -const { age: ageColor } = require('../../lib/color-formatters') +const { formatDate } = require('../text-formatters') +const { age: ageColor } = require('../color-formatters') const { documentation, checkErrorResponse: githubCheckErrorResponse, diff --git a/services/github/github-license.service.js b/services/github/github-license.service.js index 6f35df555eb2b..479187742b160 100644 --- a/services/github/github-license.service.js +++ b/services/github/github-license.service.js @@ -1,7 +1,7 @@ 'use strict' const Joi = require('joi') -const { renderLicenseBadge } = require('../../lib/licenses') +const { renderLicenseBadge } = require('../licenses') const { GithubAuthService } = require('./github-auth-service') const { documentation, errorMessagesFor } = require('./github-helpers') diff --git a/services/github/github-license.tester.js b/services/github/github-license.tester.js index c482ce80f05af..b3cf40d59a653 100644 --- a/services/github/github-license.tester.js +++ b/services/github/github-license.tester.js @@ -1,6 +1,6 @@ 'use strict' -const { licenseToColor } = require('../../lib/licenses') +const { licenseToColor } = require('../licenses') const t = (module.exports = require('../tester').createServiceTester()) const publicDomainLicenseColor = licenseToColor('CC0-1.0') diff --git a/services/github/github-manifest.service.js b/services/github/github-manifest.service.js index c5aecb9413fa4..3aaac1c90d744 100644 --- a/services/github/github-manifest.service.js +++ b/services/github/github-manifest.service.js @@ -1,7 +1,7 @@ 'use strict' const Joi = require('joi') -const { renderVersionBadge } = require('../../lib/version') +const { renderVersionBadge } = require('../version') const { individualValueSchema, transformAndValidate, diff --git a/services/github/github-package-json.service.js b/services/github/github-package-json.service.js index 9abf7d25b69c6..aa239786133ac 100644 --- a/services/github/github-package-json.service.js +++ b/services/github/github-package-json.service.js @@ -1,7 +1,7 @@ 'use strict' const Joi = require('joi') -const { renderVersionBadge } = require('../../lib/version') +const { renderVersionBadge } = require('../version') const { transformAndValidate, renderDynamicBadge, diff --git a/services/github/github-release-date.service.js b/services/github/github-release-date.service.js index 9a43b6f09dbe2..5ebae883ac1bc 100644 --- a/services/github/github-release-date.service.js +++ b/services/github/github-release-date.service.js @@ -4,8 +4,8 @@ const moment = require('moment') const LegacyService = require('../legacy-service') const { makeBadgeData: getBadgeData } = require('../../lib/badge-data') const { makeLogo: getLogo } = require('../../lib/logos') -const { formatDate } = require('../../lib/text-formatters') -const { age } = require('../../lib/color-formatters') +const { formatDate } = require('../text-formatters') +const { age } = require('../color-formatters') const { documentation } = require('./github-helpers') // This legacy service should be rewritten to use e.g. BaseJsonService. diff --git a/services/github/github-release.service.js b/services/github/github-release.service.js index 8f6b177cc11cc..2c8c509d9e503 100644 --- a/services/github/github-release.service.js +++ b/services/github/github-release.service.js @@ -3,7 +3,7 @@ const LegacyService = require('../legacy-service') const { makeBadgeData: getBadgeData } = require('../../lib/badge-data') const { makeLogo: getLogo } = require('../../lib/logos') -const { addv: versionText } = require('../../lib/text-formatters') +const { addv: versionText } = require('../text-formatters') const { documentation, checkErrorResponse: githubCheckErrorResponse, diff --git a/services/github/github-search.service.js b/services/github/github-search.service.js index fa5fd0319d209..918d9ca614dd6 100644 --- a/services/github/github-search.service.js +++ b/services/github/github-search.service.js @@ -2,7 +2,7 @@ const LegacyService = require('../legacy-service') const { makeBadgeData: getBadgeData } = require('../../lib/badge-data') -const { metric } = require('../../lib/text-formatters') +const { metric } = require('../text-formatters') const { documentation, checkErrorResponse: githubCheckErrorResponse, diff --git a/services/github/github-stars.service.js b/services/github/github-stars.service.js index e3ec3088614ee..d65d230340ba3 100644 --- a/services/github/github-stars.service.js +++ b/services/github/github-stars.service.js @@ -3,7 +3,7 @@ const LegacyService = require('../legacy-service') const { makeBadgeData: getBadgeData } = require('../../lib/badge-data') const { makeLogo: getLogo } = require('../../lib/logos') -const { metric } = require('../../lib/text-formatters') +const { metric } = require('../text-formatters') const { documentation, checkErrorResponse: githubCheckErrorResponse, diff --git a/services/github/github-tag.service.js b/services/github/github-tag.service.js index 4401933387c7f..3cb1d80a7484e 100644 --- a/services/github/github-tag.service.js +++ b/services/github/github-tag.service.js @@ -3,9 +3,9 @@ const LegacyService = require('../legacy-service') const { makeBadgeData: getBadgeData } = require('../../lib/badge-data') const { makeLogo: getLogo } = require('../../lib/logos') -const { addv: versionText } = require('../../lib/text-formatters') -const { version: versionColor } = require('../../lib/color-formatters') -const { latest: latestVersion } = require('../../lib/version') +const { addv: versionText } = require('../text-formatters') +const { version: versionColor } = require('../color-formatters') +const { latest: latestVersion } = require('../version') const { documentation, checkErrorResponse: githubCheckErrorResponse, diff --git a/services/gitlab/gitlab-pipeline-status.service.js b/services/gitlab/gitlab-pipeline-status.service.js index 91dedb22c0311..f9e12aacce342 100644 --- a/services/gitlab/gitlab-pipeline-status.service.js +++ b/services/gitlab/gitlab-pipeline-status.service.js @@ -1,10 +1,7 @@ 'use strict' const Joi = require('joi') -const { - isBuildStatus, - renderBuildStatusBadge, -} = require('../../lib/build-status') +const { isBuildStatus, renderBuildStatusBadge } = require('../build-status') const { BaseSvgScrapingService, NotFound } = require('..') const { optionalUrl } = require('../validators') diff --git a/services/gitlab/gitlab-pipeline-status.tester.js b/services/gitlab/gitlab-pipeline-status.tester.js index a0cdb600f46d5..9f93440095d54 100644 --- a/services/gitlab/gitlab-pipeline-status.tester.js +++ b/services/gitlab/gitlab-pipeline-status.tester.js @@ -1,7 +1,7 @@ 'use strict' const Joi = require('joi') -const { isBuildStatus } = require('../../lib/build-status') +const { isBuildStatus } = require('../build-status') const t = (module.exports = require('../tester').createServiceTester()) t.create('Pipeline status') diff --git a/services/hackage/hackage-version.service.js b/services/hackage/hackage-version.service.js index ed3e85cbaad92..738b5397b9c13 100644 --- a/services/hackage/hackage-version.service.js +++ b/services/hackage/hackage-version.service.js @@ -1,7 +1,7 @@ 'use strict' const { BaseService, InvalidResponse } = require('..') -const { renderVersionBadge } = require('../../lib/version') +const { renderVersionBadge } = require('../version') module.exports = class HackageVersion extends BaseService { static get category() { diff --git a/services/hexpm/hexpm.service.js b/services/hexpm/hexpm.service.js index 80c94618aa452..0cc399085e6ec 100644 --- a/services/hexpm/hexpm.service.js +++ b/services/hexpm/hexpm.service.js @@ -1,11 +1,8 @@ 'use strict' const Joi = require('joi') -const { metric, addv, maybePluralize } = require('../../lib/text-formatters') -const { - downloadCount, - version: versionColor, -} = require('../../lib/color-formatters') +const { metric, addv, maybePluralize } = require('../text-formatters') +const { downloadCount, version: versionColor } = require('../color-formatters') const { BaseJsonService } = require('..') const hexSchema = Joi.object({ diff --git a/services/homebrew/homebrew.service.js b/services/homebrew/homebrew.service.js index 5c500fbd98912..71f4b07a07521 100644 --- a/services/homebrew/homebrew.service.js +++ b/services/homebrew/homebrew.service.js @@ -1,7 +1,7 @@ 'use strict' const Joi = require('joi') -const { renderVersionBadge } = require('../../lib/version') +const { renderVersionBadge } = require('../version') const { BaseJsonService } = require('..') const schema = Joi.object({ diff --git a/services/itunes/itunes.service.js b/services/itunes/itunes.service.js index 4ab5ff24e21f1..fb84c61e84d75 100644 --- a/services/itunes/itunes.service.js +++ b/services/itunes/itunes.service.js @@ -1,7 +1,7 @@ 'use strict' const Joi = require('joi') -const { renderVersionBadge } = require('../../lib/version') +const { renderVersionBadge } = require('../version') const { BaseJsonService, NotFound } = require('..') const { nonNegativeInteger } = require('../validators') diff --git a/services/jenkins/jenkins-coverage.service.js b/services/jenkins/jenkins-coverage.service.js index 02970666b8c66..8b174e81242b3 100644 --- a/services/jenkins/jenkins-coverage.service.js +++ b/services/jenkins/jenkins-coverage.service.js @@ -5,7 +5,7 @@ const { BaseJsonService } = require('..') const serverSecrets = require('../../lib/server-secrets') const { coveragePercentage: coveragePercentageColor, -} = require('../../lib/color-formatters') +} = require('../color-formatters') const jacocoCoverageSchema = Joi.object({ instructionCoverage: Joi.object({ diff --git a/services/jenkins/jenkins-plugin-installs.service.js b/services/jenkins/jenkins-plugin-installs.service.js index 459b876a7ce06..a86433d54ae80 100644 --- a/services/jenkins/jenkins-plugin-installs.service.js +++ b/services/jenkins/jenkins-plugin-installs.service.js @@ -1,10 +1,8 @@ 'use strict' const Joi = require('joi') -const { - downloadCount: downloadCountColor, -} = require('../../lib/color-formatters') -const { metric } = require('../../lib/text-formatters') +const { downloadCount: downloadCountColor } = require('../color-formatters') +const { metric } = require('../text-formatters') const { BaseJsonService, NotFound } = require('..') const { nonNegativeInteger } = require('../validators') diff --git a/services/jenkins/jenkins-plugin-version.service.js b/services/jenkins/jenkins-plugin-version.service.js index faf0bf7c3c13b..facea3e515f53 100644 --- a/services/jenkins/jenkins-plugin-version.service.js +++ b/services/jenkins/jenkins-plugin-version.service.js @@ -3,8 +3,8 @@ const LegacyService = require('../legacy-service') const { makeBadgeData: getBadgeData } = require('../../lib/badge-data') const { regularUpdate } = require('../../lib/regular-update') -const { addv: versionText } = require('../../lib/text-formatters') -const { version: versionColor } = require('../../lib/color-formatters') +const { addv: versionText } = require('../text-formatters') +const { version: versionColor } = require('../color-formatters') // This legacy service should be rewritten to use e.g. BaseJsonService. // diff --git a/services/jetbrains/jetbrains-downloads.service.js b/services/jetbrains/jetbrains-downloads.service.js index 7d3cd58b89a2c..74d1302d156b9 100644 --- a/services/jetbrains/jetbrains-downloads.service.js +++ b/services/jetbrains/jetbrains-downloads.service.js @@ -1,10 +1,8 @@ 'use strict' const Joi = require('joi') -const { metric } = require('../../lib/text-formatters') -const { - downloadCount: downloadCountColor, -} = require('../../lib/color-formatters') +const { metric } = require('../text-formatters') +const { downloadCount: downloadCountColor } = require('../color-formatters') const { nonNegativeInteger } = require('../validators') const JetbrainsBase = require('./jetbrains-base') diff --git a/services/jetbrains/jetbrains-version.service.js b/services/jetbrains/jetbrains-version.service.js index 6c695a9bb0cb1..5a00f3d2cc0df 100644 --- a/services/jetbrains/jetbrains-version.service.js +++ b/services/jetbrains/jetbrains-version.service.js @@ -1,7 +1,7 @@ 'use strict' const Joi = require('joi') -const { renderVersionBadge } = require('../../lib/version') +const { renderVersionBadge } = require('../version') const JetbrainsBase = require('./jetbrains-base') const schema = Joi.object({ diff --git a/services/jitpack/jitpack.service.js b/services/jitpack/jitpack.service.js index e8fc449b1afd6..33429d958285f 100644 --- a/services/jitpack/jitpack.service.js +++ b/services/jitpack/jitpack.service.js @@ -2,7 +2,7 @@ const Joi = require('joi') const { BaseJsonService } = require('..') -const { renderVersionBadge } = require('../../lib/version') +const { renderVersionBadge } = require('../version') const schema = Joi.object({ version: Joi.string().required(), diff --git a/services/jsdelivr/jsdelivr-base.js b/services/jsdelivr/jsdelivr-base.js index fc3002abeae80..949dbc32ac78d 100644 --- a/services/jsdelivr/jsdelivr-base.js +++ b/services/jsdelivr/jsdelivr-base.js @@ -1,8 +1,8 @@ 'use strict' const Joi = require('joi') -const { downloadCount } = require('../../lib/color-formatters') -const { metric } = require('../../lib/text-formatters') +const { downloadCount } = require('../color-formatters') +const { metric } = require('../text-formatters') const { BaseJsonService } = require('..') const schema = Joi.object({ diff --git a/services/lgtm/lgtm-alerts.service.js b/services/lgtm/lgtm-alerts.service.js index 60460b1d320ea..cad99dcc21df5 100644 --- a/services/lgtm/lgtm-alerts.service.js +++ b/services/lgtm/lgtm-alerts.service.js @@ -1,6 +1,6 @@ 'use strict' -const { metric } = require('../../lib/text-formatters') +const { metric } = require('../text-formatters') const LgtmBaseService = require('./lgtm-base') module.exports = class LgtmAlerts extends LgtmBaseService { diff --git a/services/liberapay/liberapay-base.js b/services/liberapay/liberapay-base.js index 97fbdf18fcbb5..f4978f5cb4d55 100644 --- a/services/liberapay/liberapay-base.js +++ b/services/liberapay/liberapay-base.js @@ -1,9 +1,9 @@ 'use strict' const Joi = require('joi') -const { metric } = require('../../lib/text-formatters') +const { metric } = require('../text-formatters') const { BaseJsonService } = require('..') -const { colorScale } = require('../../lib/color-formatters') +const { colorScale } = require('../color-formatters') const { nonNegativeInteger } = require('../validators') const schema = Joi.object({ diff --git a/services/liberapay/liberapay-goal.service.js b/services/liberapay/liberapay-goal.service.js index 23f0ab4f8a87c..a2a77061bbe18 100644 --- a/services/liberapay/liberapay-goal.service.js +++ b/services/liberapay/liberapay-goal.service.js @@ -2,7 +2,7 @@ const { InvalidResponse } = require('..') const { LiberapayBase } = require('./liberapay-base') -const { colorScale } = require('../../lib/color-formatters') +const { colorScale } = require('../color-formatters') module.exports = class LiberapayGoal extends LiberapayBase { static get route() { diff --git a/services/liberapay/liberapay-patrons.service.js b/services/liberapay/liberapay-patrons.service.js index 72455543a3692..1f8e7fc60d6f3 100644 --- a/services/liberapay/liberapay-patrons.service.js +++ b/services/liberapay/liberapay-patrons.service.js @@ -1,7 +1,7 @@ 'use strict' -const { metric } = require('../../lib/text-formatters') -const { colorScale } = require('../../lib/color-formatters') +const { metric } = require('../text-formatters') +const { colorScale } = require('../color-formatters') const { LiberapayBase } = require('./liberapay-base') module.exports = class LiberapayPatrons extends LiberapayBase { diff --git a/services/librariesio/librariesio-dependent-repos.service.js b/services/librariesio/librariesio-dependent-repos.service.js index 0184b51a410d4..82537fec709de 100644 --- a/services/librariesio/librariesio-dependent-repos.service.js +++ b/services/librariesio/librariesio-dependent-repos.service.js @@ -1,6 +1,6 @@ 'use strict' -const { metric } = require('../../lib/text-formatters') +const { metric } = require('../text-formatters') const LibrariesIoBase = require('./librariesio-base') // https://libraries.io/api#project-dependent-repositories diff --git a/services/librariesio/librariesio-dependents.service.js b/services/librariesio/librariesio-dependents.service.js index 6dbf4cc4a05c5..49805f84d6284 100644 --- a/services/librariesio/librariesio-dependents.service.js +++ b/services/librariesio/librariesio-dependents.service.js @@ -1,6 +1,6 @@ 'use strict' -const { metric } = require('../../lib/text-formatters') +const { metric } = require('../text-formatters') const LibrariesIoBase = require('./librariesio-base') // https://libraries.io/api#project-dependents diff --git a/services/librariesio/librariesio-sourcerank.service.js b/services/librariesio/librariesio-sourcerank.service.js index 006d30048ca83..46009baf794f5 100644 --- a/services/librariesio/librariesio-sourcerank.service.js +++ b/services/librariesio/librariesio-sourcerank.service.js @@ -1,6 +1,6 @@ 'use strict' -const { colorScale } = require('../../lib/color-formatters') +const { colorScale } = require('../color-formatters') const LibrariesIoBase = require('./librariesio-base') const sourceRankColor = colorScale([10, 15, 20, 25, 30]) diff --git a/lib/licenses.js b/services/licenses.js similarity index 100% rename from lib/licenses.js rename to services/licenses.js diff --git a/lib/licenses.spec.js b/services/licenses.spec.js similarity index 100% rename from lib/licenses.spec.js rename to services/licenses.spec.js diff --git a/services/luarocks/luarocks-version-helpers.js b/services/luarocks/luarocks-version-helpers.js index 8ebc42d0e31b1..66c0e0fc194fa 100644 --- a/services/luarocks/luarocks-version-helpers.js +++ b/services/luarocks/luarocks-version-helpers.js @@ -5,7 +5,7 @@ */ 'use strict' -const { omitv } = require('../../lib/text-formatters') +const { omitv } = require('../text-formatters') // Compare two arrays containing split and transformed to // positive/negative numbers parts of version strings, diff --git a/services/luarocks/luarocks.service.js b/services/luarocks/luarocks.service.js index abd97b810f142..6da0d91b0889f 100644 --- a/services/luarocks/luarocks.service.js +++ b/services/luarocks/luarocks.service.js @@ -2,7 +2,7 @@ const Joi = require('joi') const { BaseJsonService, NotFound } = require('..') -const { addv } = require('../../lib/text-formatters') +const { addv } = require('../text-formatters') const { latestVersion } = require('./luarocks-version-helpers') const schema = Joi.object({ diff --git a/services/maven-central/maven-central.service.js b/services/maven-central/maven-central.service.js index 652bcac99acf9..8007083a7c24c 100644 --- a/services/maven-central/maven-central.service.js +++ b/services/maven-central/maven-central.service.js @@ -3,8 +3,8 @@ const xml2js = require('xml2js') const LegacyService = require('../legacy-service') const { makeBadgeData: getBadgeData } = require('../../lib/badge-data') -const { addv: versionText } = require('../../lib/text-formatters') -const { version: versionColor } = require('../../lib/color-formatters') +const { addv: versionText } = require('../text-formatters') +const { version: versionColor } = require('../color-formatters') // This legacy service should be rewritten to use e.g. BaseJsonService. // diff --git a/services/maven-metadata/maven-metadata.service.js b/services/maven-metadata/maven-metadata.service.js index 13b1267a8c6d5..1136257adaee5 100644 --- a/services/maven-metadata/maven-metadata.service.js +++ b/services/maven-metadata/maven-metadata.service.js @@ -2,7 +2,7 @@ const Joi = require('joi') const { BaseXmlService } = require('..') -const { renderVersionBadge } = require('../../lib/version') +const { renderVersionBadge } = require('../version') const schema = Joi.object({ metadata: Joi.object({ diff --git a/services/nexus/nexus.service.js b/services/nexus/nexus.service.js index 367c19f46ae3f..955899899bde8 100644 --- a/services/nexus/nexus.service.js +++ b/services/nexus/nexus.service.js @@ -1,8 +1,8 @@ 'use strict' const Joi = require('joi') -const { version: versionColor } = require('../../lib/color-formatters') -const { addv } = require('../../lib/text-formatters') +const { version: versionColor } = require('../color-formatters') +const { addv } = require('../text-formatters') const serverSecrets = require('../../lib/server-secrets') const { BaseJsonService, InvalidResponse, NotFound } = require('..') const { diff --git a/services/nodeping/nodeping-uptime.service.js b/services/nodeping/nodeping-uptime.service.js index 3b1c8ff5108c8..215cb6ed59b68 100644 --- a/services/nodeping/nodeping-uptime.service.js +++ b/services/nodeping/nodeping-uptime.service.js @@ -2,7 +2,7 @@ const { BaseJsonService } = require('..') const Joi = require('joi') -const { colorScale } = require('../../lib/color-formatters') +const { colorScale } = require('../color-formatters') const colorFormatter = colorScale([99, 99.5, 100]) const rowSchema = Joi.object().keys({ diff --git a/services/npm/npm-collaborators.service.js b/services/npm/npm-collaborators.service.js index ce341a60f36bc..36f0c98c1132d 100644 --- a/services/npm/npm-collaborators.service.js +++ b/services/npm/npm-collaborators.service.js @@ -1,6 +1,6 @@ 'use strict' -const { renderContributorBadge } = require('../../lib/contributor-count') +const { renderContributorBadge } = require('../contributor-count') const NpmBase = require('./npm-base') const keywords = ['node'] diff --git a/services/npm/npm-downloads.service.js b/services/npm/npm-downloads.service.js index ef9b525b2f746..4e82db4e4e1fa 100644 --- a/services/npm/npm-downloads.service.js +++ b/services/npm/npm-downloads.service.js @@ -1,7 +1,7 @@ 'use strict' const Joi = require('joi') -const { metric } = require('../../lib/text-formatters') +const { metric } = require('../text-formatters') const { BaseJsonService } = require('..') const { nonNegativeInteger } = require('../validators') diff --git a/services/npm/npm-license.service.js b/services/npm/npm-license.service.js index 9e403b58cc120..b22250f25287e 100644 --- a/services/npm/npm-license.service.js +++ b/services/npm/npm-license.service.js @@ -1,6 +1,6 @@ 'use strict' -const { renderLicenseBadge } = require('../../lib/licenses') +const { renderLicenseBadge } = require('../licenses') const { toArray } = require('../../lib/badge-data') const NpmBase = require('./npm-base') diff --git a/services/npm/npm-version.service.js b/services/npm/npm-version.service.js index a2211826eb605..f5e45214dbee2 100644 --- a/services/npm/npm-version.service.js +++ b/services/npm/npm-version.service.js @@ -1,7 +1,7 @@ 'use strict' const Joi = require('joi') -const { renderVersionBadge } = require('../../lib/version') +const { renderVersionBadge } = require('../version') const { NotFound } = require('..') const NpmBase = require('./npm-base') diff --git a/services/nuget/nuget-helpers.js b/services/nuget/nuget-helpers.js index 8fefd7291c31a..849cac3ef6957 100644 --- a/services/nuget/nuget-helpers.js +++ b/services/nuget/nuget-helpers.js @@ -1,9 +1,7 @@ 'use strict' -const { metric, addv } = require('../../lib/text-formatters') -const { - downloadCount: downloadCountColor, -} = require('../../lib/color-formatters') +const { metric, addv } = require('../text-formatters') +const { downloadCount: downloadCountColor } = require('../color-formatters') function renderVersionBadge({ version, feed }) { let color diff --git a/services/packagecontrol/packagecontrol.service.js b/services/packagecontrol/packagecontrol.service.js index 335c7e5b86c64..9eb9fccd66fca 100644 --- a/services/packagecontrol/packagecontrol.service.js +++ b/services/packagecontrol/packagecontrol.service.js @@ -1,8 +1,8 @@ 'use strict' const Joi = require('joi') -const { metric } = require('../../lib/text-formatters') -const { downloadCount } = require('../../lib/color-formatters') +const { metric } = require('../text-formatters') +const { downloadCount } = require('../color-formatters') const { BaseJsonService } = require('..') const { nonNegativeInteger } = require('../validators') diff --git a/services/packagist/packagist-downloads.service.js b/services/packagist/packagist-downloads.service.js index 6c61a763e50b0..6f774362c8a82 100644 --- a/services/packagist/packagist-downloads.service.js +++ b/services/packagist/packagist-downloads.service.js @@ -2,10 +2,8 @@ const LegacyService = require('../legacy-service') const { makeBadgeData: getBadgeData } = require('../../lib/badge-data') -const { metric } = require('../../lib/text-formatters') -const { - downloadCount: downloadCountColor, -} = require('../../lib/color-formatters') +const { metric } = require('../text-formatters') +const { downloadCount: downloadCountColor } = require('../color-formatters') // This legacy service should be rewritten to use e.g. BaseJsonService. // diff --git a/services/packagist/packagist-version.service.js b/services/packagist/packagist-version.service.js index ea760cd971ed1..4e13b8169e566 100644 --- a/services/packagist/packagist-version.service.js +++ b/services/packagist/packagist-version.service.js @@ -2,13 +2,13 @@ const LegacyService = require('../legacy-service') const { makeBadgeData: getBadgeData } = require('../../lib/badge-data') -const { addv: versionText } = require('../../lib/text-formatters') -const { version: versionColor } = require('../../lib/color-formatters') +const { addv: versionText } = require('../text-formatters') +const { version: versionColor } = require('../color-formatters') const { compare: phpVersionCompare, latest: phpLatestVersion, isStable: phpStableVersion, -} = require('../../lib/php-version') +} = require('../php-version') const keywords = ['PHP'] diff --git a/services/php-eye/php-eye-hhvm.service.js b/services/php-eye/php-eye-hhvm.service.js index 7e3ae2f384f32..4aface7b30d50 100644 --- a/services/php-eye/php-eye-hhvm.service.js +++ b/services/php-eye/php-eye-hhvm.service.js @@ -3,7 +3,7 @@ const LegacyService = require('../legacy-service') const { makeBadgeData: getBadgeData } = require('../../lib/badge-data') const { checkErrorResponse } = require('../../lib/error-helper') -const { omitv } = require('../../lib/text-formatters') +const { omitv } = require('../text-formatters') const keywords = ['php', 'runtime'] diff --git a/services/php-eye/php-eye-php-version.service.js b/services/php-eye/php-eye-php-version.service.js index 7b3ac2cee058b..ed6a1b1cc518e 100644 --- a/services/php-eye/php-eye-php-version.service.js +++ b/services/php-eye/php-eye-php-version.service.js @@ -2,11 +2,11 @@ const LegacyService = require('../legacy-service') const { makeBadgeData: getBadgeData } = require('../../lib/badge-data') +const log = require('../../core/server/log') const { versionReduction: phpVersionReduction, getPhpReleases, -} = require('../../lib/php-version') -const log = require('../../core/server/log') +} = require('../php-version') // This legacy service should be rewritten to use e.g. BaseJsonService. // diff --git a/lib/php-version.js b/services/php-version.js similarity index 99% rename from lib/php-version.js rename to services/php-version.js index abb8ae73a598a..f8b4d4ecf2b07 100644 --- a/lib/php-version.js +++ b/services/php-version.js @@ -7,9 +7,9 @@ const { promisify } = require('util') const request = require('request') +const { regularUpdate } = require('../lib/regular-update') const { listCompare } = require('./version') const { omitv } = require('./text-formatters') -const { regularUpdate } = require('./regular-update') // Return a negative value if v1 < v2, // zero if v1 = v2, a positive value otherwise. diff --git a/lib/php-version.spec.js b/services/php-version.spec.js similarity index 100% rename from lib/php-version.spec.js rename to services/php-version.spec.js diff --git a/services/pub/pub.service.js b/services/pub/pub.service.js index 4404aa4fd710d..b343b89865a14 100644 --- a/services/pub/pub.service.js +++ b/services/pub/pub.service.js @@ -2,8 +2,8 @@ const Joi = require('joi') const { BaseJsonService } = require('..') -const { renderVersionBadge } = require('../../lib/version') -const { latest: latestVersion } = require('../../lib/version') +const { renderVersionBadge } = require('../version') +const { latest: latestVersion } = require('../version') const schema = Joi.object({ versions: Joi.array() diff --git a/services/puppetforge/puppetforge-modules.service.js b/services/puppetforge/puppetforge-modules.service.js index a159d97f36777..c93e030dabe58 100644 --- a/services/puppetforge/puppetforge-modules.service.js +++ b/services/puppetforge/puppetforge-modules.service.js @@ -5,12 +5,12 @@ const { makeBadgeData: getBadgeData, makeLabel: getLabel, } = require('../../lib/badge-data') -const { metric, addv: versionText } = require('../../lib/text-formatters') +const { metric, addv: versionText } = require('../text-formatters') const { version: versionColor, coveragePercentage: coveragePercentageColor, downloadCount: downloadCountColor, -} = require('../../lib/color-formatters') +} = require('../color-formatters') class PuppetforgeModuleVersion extends LegacyService { static get category() { diff --git a/services/puppetforge/puppetforge-users.service.js b/services/puppetforge/puppetforge-users.service.js index 9cd6314d31f68..d83231b9d7031 100644 --- a/services/puppetforge/puppetforge-users.service.js +++ b/services/puppetforge/puppetforge-users.service.js @@ -5,8 +5,8 @@ const { makeBadgeData: getBadgeData, makeLabel: getLabel, } = require('../../lib/badge-data') -const { metric } = require('../../lib/text-formatters') -const { floorCount: floorCountColor } = require('../../lib/color-formatters') +const { metric } = require('../text-formatters') +const { floorCount: floorCountColor } = require('../color-formatters') class PuppetforgeUserReleases extends LegacyService { static get category() { diff --git a/services/pypi/pypi-downloads.service.js b/services/pypi/pypi-downloads.service.js index 1ff9f69fd6f34..6cd768d69dbbe 100644 --- a/services/pypi/pypi-downloads.service.js +++ b/services/pypi/pypi-downloads.service.js @@ -1,8 +1,8 @@ 'use strict' const Joi = require('joi') -const { downloadCount } = require('../../lib/color-formatters') -const { metric } = require('../../lib/text-formatters') +const { downloadCount } = require('../color-formatters') +const { metric } = require('../text-formatters') const { BaseJsonService } = require('..') const { nonNegativeInteger } = require('../validators') diff --git a/services/pypi/pypi-license.service.js b/services/pypi/pypi-license.service.js index a9217c9dccc24..cf65aa403ca44 100644 --- a/services/pypi/pypi-license.service.js +++ b/services/pypi/pypi-license.service.js @@ -1,6 +1,6 @@ 'use strict' -const { renderLicenseBadge } = require('../../lib/licenses') +const { renderLicenseBadge } = require('../licenses') const PypiBase = require('./pypi-base') const { getLicenses } = require('./pypi-helpers') diff --git a/services/pypi/pypi-version.service.js b/services/pypi/pypi-version.service.js index 39cc3d7f8c8bd..cee37daafc2e5 100644 --- a/services/pypi/pypi-version.service.js +++ b/services/pypi/pypi-version.service.js @@ -1,6 +1,6 @@ 'use strict' -const { renderVersionBadge } = require('../../lib/version') +const { renderVersionBadge } = require('../version') const PypiBase = require('./pypi-base') module.exports = class PypiVersion extends PypiBase { diff --git a/services/readthedocs/readthedocs.service.js b/services/readthedocs/readthedocs.service.js index 1108b09a43c8b..a9537f108f230 100644 --- a/services/readthedocs/readthedocs.service.js +++ b/services/readthedocs/readthedocs.service.js @@ -1,10 +1,7 @@ 'use strict' const Joi = require('joi') -const { - isBuildStatus, - renderBuildStatusBadge, -} = require('../../lib/build-status') +const { isBuildStatus, renderBuildStatusBadge } = require('../build-status') const { BaseSvgScrapingService, NotFound } = require('..') const keywords = ['documentation'] diff --git a/services/readthedocs/readthedocs.tester.js b/services/readthedocs/readthedocs.tester.js index 4ee19c06fb401..2258f34e9d88d 100644 --- a/services/readthedocs/readthedocs.tester.js +++ b/services/readthedocs/readthedocs.tester.js @@ -1,7 +1,7 @@ 'use strict' const Joi = require('joi') -const { isBuildStatus } = require('../../lib/build-status') +const { isBuildStatus } = require('../build-status') const t = (module.exports = require('../tester').createServiceTester()) t.create('build status') diff --git a/services/redmine/redmine.service.js b/services/redmine/redmine.service.js index 840edddad2810..9f7b0974c307e 100644 --- a/services/redmine/redmine.service.js +++ b/services/redmine/redmine.service.js @@ -1,7 +1,7 @@ 'use strict' -const { starRating } = require('../../lib/text-formatters') -const { floorCount: floorCountColor } = require('../../lib/color-formatters') +const { starRating } = require('../text-formatters') +const { floorCount: floorCountColor } = require('../color-formatters') const Joi = require('joi') const { BaseXmlService } = require('..') diff --git a/services/scrutinizer/scrutinizer.service.js b/services/scrutinizer/scrutinizer.service.js index 7007d4725eea7..9b433d737c9e4 100644 --- a/services/scrutinizer/scrutinizer.service.js +++ b/services/scrutinizer/scrutinizer.service.js @@ -5,7 +5,7 @@ const { makeBadgeData: getBadgeData } = require('../../lib/badge-data') const { checkErrorResponse } = require('../../lib/error-helper') const { coveragePercentage: coveragePercentageColor, -} = require('../../lib/color-formatters') +} = require('../color-formatters') class ScrutinizerBuild extends LegacyService { static get category() { diff --git a/services/scrutinizer/scrutinizer.tester.js b/services/scrutinizer/scrutinizer.tester.js index e81bf0e2a7a28..38205c098c665 100644 --- a/services/scrutinizer/scrutinizer.tester.js +++ b/services/scrutinizer/scrutinizer.tester.js @@ -1,7 +1,7 @@ 'use strict' const Joi = require('joi') -const { isBuildStatus } = require('../../lib/build-status') +const { isBuildStatus } = require('../build-status') const { ServiceTester } = require('../tester') const { isIntegerPercentage } = require('../test-validators') diff --git a/services/shippable/shippable.service.js b/services/shippable/shippable.service.js index 3296022f092fa..228b75ce8953b 100644 --- a/services/shippable/shippable.service.js +++ b/services/shippable/shippable.service.js @@ -1,7 +1,7 @@ 'use strict' const Joi = require('joi') -const { renderBuildStatusBadge } = require('../../lib/build-status') +const { renderBuildStatusBadge } = require('../build-status') const { BaseJsonService, NotFound } = require('..') // source: https://github.com/badges/shields/pull/1362#discussion_r161693830 diff --git a/services/shippable/shippable.tester.js b/services/shippable/shippable.tester.js index aa6d19699a784..10278ae1a2c33 100644 --- a/services/shippable/shippable.tester.js +++ b/services/shippable/shippable.tester.js @@ -1,7 +1,7 @@ 'use strict' const Joi = require('joi') -const { isBuildStatus } = require('../../lib/build-status') +const { isBuildStatus } = require('../build-status') const t = (module.exports = require('../tester').createServiceTester()) t.create('build status (valid, without branch)') diff --git a/services/sonarqube/sonarqube.service.js b/services/sonarqube/sonarqube.service.js index 76712482754c3..784f81591810a 100644 --- a/services/sonarqube/sonarqube.service.js +++ b/services/sonarqube/sonarqube.service.js @@ -3,10 +3,10 @@ const LegacyService = require('../legacy-service') const { makeBadgeData: getBadgeData } = require('../../lib/badge-data') const serverSecrets = require('../../lib/server-secrets') -const { metric } = require('../../lib/text-formatters') +const { metric } = require('../text-formatters') const { coveragePercentage: coveragePercentageColor, -} = require('../../lib/color-formatters') +} = require('../color-formatters') class SonarqubeCoverage extends LegacyService { static get category() { diff --git a/services/sourceforge/sourceforge.service.js b/services/sourceforge/sourceforge.service.js index f9359c0b1cb0a..aad987bab6a1e 100644 --- a/services/sourceforge/sourceforge.service.js +++ b/services/sourceforge/sourceforge.service.js @@ -6,10 +6,8 @@ const { makeBadgeData: getBadgeData, makeLabel: getLabel, } = require('../../lib/badge-data') -const { metric } = require('../../lib/text-formatters') -const { - downloadCount: downloadCountColor, -} = require('../../lib/color-formatters') +const { metric } = require('../text-formatters') +const { downloadCount: downloadCountColor } = require('../color-formatters') // This legacy service should be rewritten to use e.g. BaseJsonService. // diff --git a/services/spiget/spiget-downloads.service.js b/services/spiget/spiget-downloads.service.js index 62f90aeb7767e..632c8983b0fc6 100644 --- a/services/spiget/spiget-downloads.service.js +++ b/services/spiget/spiget-downloads.service.js @@ -1,7 +1,7 @@ 'use strict' -const { metric } = require('../../lib/text-formatters') -const { downloadCount } = require('../../lib/color-formatters') +const { metric } = require('../text-formatters') +const { downloadCount } = require('../color-formatters') const { BaseSpigetService, documentation, keywords } = require('./spiget-base') module.exports = class SpigetDownloads extends BaseSpigetService { diff --git a/services/spiget/spiget-latest-version.service.js b/services/spiget/spiget-latest-version.service.js index a2371ff0e226c..0749f10ef1dff 100644 --- a/services/spiget/spiget-latest-version.service.js +++ b/services/spiget/spiget-latest-version.service.js @@ -1,7 +1,7 @@ 'use strict' const Joi = require('joi') -const { renderVersionBadge } = require('../../lib/version') +const { renderVersionBadge } = require('../version') const { BaseSpigetService, documentation, keywords } = require('./spiget-base') const versionSchema = Joi.object({ diff --git a/services/spiget/spiget-rating.service.js b/services/spiget/spiget-rating.service.js index d2cd6b77720b1..dc410983e493c 100644 --- a/services/spiget/spiget-rating.service.js +++ b/services/spiget/spiget-rating.service.js @@ -1,7 +1,7 @@ 'use strict' -const { starRating, metric } = require('../../lib/text-formatters') -const { floorCount } = require('../../lib/color-formatters') +const { starRating, metric } = require('../text-formatters') +const { floorCount } = require('../color-formatters') const { BaseSpigetService, documentation, keywords } = require('./spiget-base') module.exports = class SpigetRatings extends BaseSpigetService { diff --git a/services/stackexchange/stackexchange-helpers.js b/services/stackexchange/stackexchange-helpers.js index 239a91eafca4e..edb85404beeef 100644 --- a/services/stackexchange/stackexchange-helpers.js +++ b/services/stackexchange/stackexchange-helpers.js @@ -1,7 +1,7 @@ 'use strict' -const { metric } = require('../../lib/text-formatters') -const { floorCount: floorCountColor } = require('../../lib/color-formatters') +const { metric } = require('../text-formatters') +const { floorCount: floorCountColor } = require('../color-formatters') module.exports = function renderQuestionsBadge({ suffix, diff --git a/services/stackexchange/stackexchange-reputation.service.js b/services/stackexchange/stackexchange-reputation.service.js index c71a1efd2199d..597fd44527588 100644 --- a/services/stackexchange/stackexchange-reputation.service.js +++ b/services/stackexchange/stackexchange-reputation.service.js @@ -1,8 +1,8 @@ 'use strict' const Joi = require('joi') -const { metric } = require('../../lib/text-formatters') -const { floorCount: floorCountColor } = require('../../lib/color-formatters') +const { metric } = require('../text-formatters') +const { floorCount: floorCountColor } = require('../color-formatters') const { BaseJsonService } = require('..') const reputationSchema = Joi.object({ diff --git a/services/steam/steam-workshop.service.js b/services/steam/steam-workshop.service.js index 21f94cf2a02aa..608086159f45c 100644 --- a/services/steam/steam-workshop.service.js +++ b/services/steam/steam-workshop.service.js @@ -2,8 +2,8 @@ const Joi = require('joi') const prettyBytes = require('pretty-bytes') -const { metric, formatDate } = require('../../lib/text-formatters') -const { age: ageColor, downloadCount } = require('../../lib/color-formatters') +const { metric, formatDate } = require('../text-formatters') +const { age: ageColor, downloadCount } = require('../color-formatters') const { NotFound } = require('..') const BaseSteamAPI = require('./steam-base') diff --git a/services/symfony/symfony-insight-stars.service.js b/services/symfony/symfony-insight-stars.service.js index e2f52a739587a..a66eac4ca2523 100644 --- a/services/symfony/symfony-insight-stars.service.js +++ b/services/symfony/symfony-insight-stars.service.js @@ -1,6 +1,6 @@ 'use strict' -const { starRating } = require('../../lib/text-formatters') +const { starRating } = require('../text-formatters') const { SymfonyInsightBase, keywords, diff --git a/services/teamcity/teamcity-coverage.service.js b/services/teamcity/teamcity-coverage.service.js index 5d27f6dc094b6..f89d1e81339d2 100644 --- a/services/teamcity/teamcity-coverage.service.js +++ b/services/teamcity/teamcity-coverage.service.js @@ -1,7 +1,7 @@ 'use strict' const Joi = require('joi') -const { coveragePercentage } = require('../../lib/color-formatters') +const { coveragePercentage } = require('../color-formatters') const { InvalidResponse } = require('..') const TeamCityBase = require('./teamcity-base') diff --git a/lib/text-formatters.js b/services/text-formatters.js similarity index 100% rename from lib/text-formatters.js rename to services/text-formatters.js diff --git a/lib/text-formatters.spec.js b/services/text-formatters.spec.js similarity index 100% rename from lib/text-formatters.spec.js rename to services/text-formatters.spec.js diff --git a/services/travis/travis-build.service.js b/services/travis/travis-build.service.js index 943c6f5c12bb2..f601031af0ad0 100644 --- a/services/travis/travis-build.service.js +++ b/services/travis/travis-build.service.js @@ -1,10 +1,7 @@ 'use strict' const Joi = require('joi') -const { - isBuildStatus, - renderBuildStatusBadge, -} = require('../../lib/build-status') +const { isBuildStatus, renderBuildStatusBadge } = require('../build-status') const { BaseSvgScrapingService } = require('..') const schema = Joi.object({ diff --git a/services/travis/travis-build.tester.js b/services/travis/travis-build.tester.js index 78f05ec698df2..2182cc3588710 100644 --- a/services/travis/travis-build.tester.js +++ b/services/travis/travis-build.tester.js @@ -1,7 +1,7 @@ 'use strict' const Joi = require('joi') -const { isBuildStatus } = require('../../lib/build-status') +const { isBuildStatus } = require('../build-status') const { ServiceTester } = require('../tester') const t = (module.exports = new ServiceTester({ diff --git a/services/travis/travis-php-version.service.js b/services/travis/travis-php-version.service.js index fa0cdc2c9f0ad..63879a5e42547 100644 --- a/services/travis/travis-php-version.service.js +++ b/services/travis/travis-php-version.service.js @@ -7,7 +7,7 @@ const { minorVersion: phpMinorVersion, versionReduction: phpVersionReduction, getPhpReleases, -} = require('../../lib/php-version') +} = require('../php-version') // This legacy service should be rewritten to use e.g. BaseJsonService. // diff --git a/services/twitter/twitter.service.js b/services/twitter/twitter.service.js index e6b7698de1a03..3aea7a00b28f5 100644 --- a/services/twitter/twitter.service.js +++ b/services/twitter/twitter.service.js @@ -3,7 +3,7 @@ const LegacyService = require('../legacy-service') const { makeBadgeData: getBadgeData } = require('../../lib/badge-data') const { makeLogo: getLogo } = require('../../lib/logos') -const { metric } = require('../../lib/text-formatters') +const { metric } = require('../text-formatters') // This legacy service should be rewritten to use e.g. BaseJsonService. // diff --git a/services/uptimerobot/uptimerobot-ratio.service.js b/services/uptimerobot/uptimerobot-ratio.service.js index f15c1571af134..06d4e897a2ef6 100644 --- a/services/uptimerobot/uptimerobot-ratio.service.js +++ b/services/uptimerobot/uptimerobot-ratio.service.js @@ -1,6 +1,6 @@ 'use strict' -const { colorScale } = require('../../lib/color-formatters') +const { colorScale } = require('../color-formatters') const UptimeRobotBase = require('./uptimerobot-base') const ratioColor = colorScale([10, 30, 50, 70]) diff --git a/services/vaadin-directory/vaadin-directory.service.js b/services/vaadin-directory/vaadin-directory.service.js index b63878f0f0091..34332c3523dfd 100644 --- a/services/vaadin-directory/vaadin-directory.service.js +++ b/services/vaadin-directory/vaadin-directory.service.js @@ -6,11 +6,11 @@ const { makeLabel: getLabel, } = require('../../lib/badge-data') const { checkErrorResponse } = require('../../lib/error-helper') -const { metric, starRating, formatDate } = require('../../lib/text-formatters') +const { metric, starRating, formatDate } = require('../text-formatters') const { floorCount: floorCountColor, age: ageColor, -} = require('../../lib/color-formatters') +} = require('../color-formatters') class VaadinDirectoryRating extends LegacyService { static get category() { diff --git a/lib/version.js b/services/version.js similarity index 100% rename from lib/version.js rename to services/version.js diff --git a/lib/version.spec.js b/services/version.spec.js similarity index 100% rename from lib/version.spec.js rename to services/version.spec.js diff --git a/services/visual-studio-marketplace/visual-studio-marketplace-azure-devops-installs.service.js b/services/visual-studio-marketplace/visual-studio-marketplace-azure-devops-installs.service.js index 212103b6a8abb..877c139c078b7 100644 --- a/services/visual-studio-marketplace/visual-studio-marketplace-azure-devops-installs.service.js +++ b/services/visual-studio-marketplace/visual-studio-marketplace-azure-devops-installs.service.js @@ -1,7 +1,7 @@ 'use strict' -const { metric } = require('../../lib/text-formatters') -const { downloadCount } = require('../../lib/color-formatters') +const { metric } = require('../text-formatters') +const { downloadCount } = require('../color-formatters') const VisualStudioMarketplaceBase = require('./visual-studio-marketplace-base') const documentation = ` diff --git a/services/visual-studio-marketplace/visual-studio-marketplace-downloads.service.js b/services/visual-studio-marketplace/visual-studio-marketplace-downloads.service.js index 3f9594c5ba9d1..2317d1894abdf 100644 --- a/services/visual-studio-marketplace/visual-studio-marketplace-downloads.service.js +++ b/services/visual-studio-marketplace/visual-studio-marketplace-downloads.service.js @@ -1,7 +1,7 @@ 'use strict' -const { metric } = require('../../lib/text-formatters') -const { downloadCount } = require('../../lib/color-formatters') +const { metric } = require('../text-formatters') +const { downloadCount } = require('../color-formatters') const VisualStudioMarketplaceBase = require('./visual-studio-marketplace-base') const documentation = ` diff --git a/services/visual-studio-marketplace/visual-studio-marketplace-rating.service.js b/services/visual-studio-marketplace/visual-studio-marketplace-rating.service.js index 158674ae97bed..fe748619c2bcb 100644 --- a/services/visual-studio-marketplace/visual-studio-marketplace-rating.service.js +++ b/services/visual-studio-marketplace/visual-studio-marketplace-rating.service.js @@ -1,7 +1,7 @@ 'use strict' -const { starRating } = require('../../lib/text-formatters') -const { floorCount } = require('../../lib/color-formatters') +const { starRating } = require('../text-formatters') +const { floorCount } = require('../color-formatters') const VisualStudioMarketplaceBase = require('./visual-studio-marketplace-base') module.exports = class VisualStudioMarketplaceRating extends VisualStudioMarketplaceBase { diff --git a/services/visual-studio-marketplace/visual-studio-marketplace-version.service.js b/services/visual-studio-marketplace/visual-studio-marketplace-version.service.js index c17056515a9ff..7431fbdcd4da4 100644 --- a/services/visual-studio-marketplace/visual-studio-marketplace-version.service.js +++ b/services/visual-studio-marketplace/visual-studio-marketplace-version.service.js @@ -1,6 +1,6 @@ 'use strict' -const { renderVersionBadge } = require('../../lib/version') +const { renderVersionBadge } = require('../version') const VisualStudioMarketplaceBase = require('./visual-studio-marketplace-base') module.exports = class VisualStudioMarketplaceVersion extends VisualStudioMarketplaceBase { diff --git a/services/wercker/wercker.service.js b/services/wercker/wercker.service.js index 45278d6334349..24a32c83f0ba9 100644 --- a/services/wercker/wercker.service.js +++ b/services/wercker/wercker.service.js @@ -1,10 +1,7 @@ 'use strict' const Joi = require('joi') -const { - isBuildStatus, - renderBuildStatusBadge, -} = require('../../lib/build-status') +const { isBuildStatus, renderBuildStatusBadge } = require('../build-status') const { BaseJsonService } = require('..') const werckerSchema = Joi.array() diff --git a/services/wercker/wercker.tester.js b/services/wercker/wercker.tester.js index e8b6249f6d083..6afc98a61a791 100644 --- a/services/wercker/wercker.tester.js +++ b/services/wercker/wercker.tester.js @@ -1,7 +1,7 @@ 'use strict' const Joi = require('joi') -const { isBuildStatus } = require('../../lib/build-status') +const { isBuildStatus } = require('../build-status') const t = (module.exports = require('../tester').createServiceTester()) t.create('Build status') diff --git a/services/wordpress/wordpress-downloads.service.js b/services/wordpress/wordpress-downloads.service.js index 20063f356fa6b..b0e4d3c3f4649 100644 --- a/services/wordpress/wordpress-downloads.service.js +++ b/services/wordpress/wordpress-downloads.service.js @@ -1,8 +1,8 @@ 'use strict' const Joi = require('joi') -const { metric } = require('../../lib/text-formatters') -const { downloadCount } = require('../../lib/color-formatters') +const { metric } = require('../text-formatters') +const { downloadCount } = require('../color-formatters') const { BaseJsonService, NotFound } = require('..') const BaseWordpress = require('./wordpress-base') diff --git a/services/wordpress/wordpress-platform.service.js b/services/wordpress/wordpress-platform.service.js index 4eb073edbd4ea..18611d8f675df 100644 --- a/services/wordpress/wordpress-platform.service.js +++ b/services/wordpress/wordpress-platform.service.js @@ -2,8 +2,8 @@ const semver = require('semver') const Joi = require('joi') -const { addv } = require('../../lib/text-formatters') -const { version: versionColor } = require('../../lib/color-formatters') +const { addv } = require('../text-formatters') +const { version: versionColor } = require('../color-formatters') const { NotFound } = require('..') const BaseWordpress = require('./wordpress-base') diff --git a/services/wordpress/wordpress-rating.service.js b/services/wordpress/wordpress-rating.service.js index d160ab95fffcc..8203ffc422083 100644 --- a/services/wordpress/wordpress-rating.service.js +++ b/services/wordpress/wordpress-rating.service.js @@ -1,7 +1,7 @@ 'use strict' -const { starRating, metric } = require('../../lib/text-formatters') -const { floorCount } = require('../../lib/color-formatters') +const { starRating, metric } = require('../text-formatters') +const { floorCount } = require('../color-formatters') const BaseWordpress = require('./wordpress-base') const extensionData = { diff --git a/services/wordpress/wordpress-version.service.js b/services/wordpress/wordpress-version.service.js index 541871e9738cc..5d3f4c8e4033c 100644 --- a/services/wordpress/wordpress-version.service.js +++ b/services/wordpress/wordpress-version.service.js @@ -1,7 +1,7 @@ 'use strict' -const { addv } = require('../../lib/text-formatters') -const { version: versionColor } = require('../../lib/color-formatters') +const { addv } = require('../text-formatters') +const { version: versionColor } = require('../color-formatters') const BaseWordpress = require('./wordpress-base') function VersionForExtensionType(extensionType) {