1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 | class Badges {
|
10 | static isBadgeUrl(url ) {
|
11 | return !!url;
|
12 | }
|
13 |
|
14 | static nodeico(packageData ) {
|
15 |
|
16 | return [
|
17 | '[',
|
18 | '![NPM]',
|
19 | `(https://nodei.co/npm/${packageData.name}.png)]`,
|
20 | `(https://nodei.co/npm/${packageData.name}/)`,
|
21 | ].join('');
|
22 | }
|
23 |
|
24 | static travis(packageData ) {
|
25 | const repository = packageData.getRepositry();
|
26 | return repository ? [
|
27 | '[',
|
28 | '![Build Status]',
|
29 | `(https://api.travis-ci.org/${repository.path}.svg?branch=master)`,
|
30 | `](https://travis-ci.org/${repository.path})`
|
31 | ].join('') : '';
|
32 | }
|
33 |
|
34 | static bithound(packageData ) {
|
35 | const repository = packageData.getRepositry();
|
36 | const host = repository && repository.host.split('.')[0];
|
37 |
|
38 | return repository && host ? [
|
39 | '[',
|
40 | '![bitHound Score]',
|
41 | `(https://www.bithound.io/${host}/${repository.path}/badges/score.svg)`,
|
42 | `](https://www.bithound.io/${host}/${repository.path})`
|
43 | ].join('') : '';
|
44 | }
|
45 | }
|
46 |
|
47 | module.exports = {
|
48 | Badges
|
49 | };
|