detect-readme-badges
Advanced tools
Comparing version 1.1.2 to 1.2.0
16
index.js
@@ -10,3 +10,2 @@ 'use strict'; | ||
// TODO badges to support: | ||
// appveyor https://ci.appveyor.com/api/projects/status/${hash}?svg=true | ||
// circle-ci https://circleci.com/gh/${user}/${package}.svg | ||
@@ -16,8 +15,9 @@ // codacy https://api.codacy.com/project/badge/grade/${hash} | ||
// parallelci | ||
// https://codecov.io/github/codecov/codecov-ruby/coverage.svg?branch=master | ||
// http://www.coverity.com/ | ||
// loose definition of a badge url | ||
// Loose definition of a badge url | ||
// Appveyor is the only that doesn't have any extension. It has /api on the url, | ||
// but this is too generic to be added here, so we playing safe and not applying it. | ||
function isBadgeUrl(url) { | ||
return ['.svg', '.png', '.jpg', '.gif', 'svg=true', 'png=true', 'badge'] | ||
return ['.svg', '.png', '.jpg', '.gif', 'svg=true', 'png=true', 'badge', 'appveyor'] | ||
.some(extension => url.indexOf(extension) !== -1); | ||
@@ -29,3 +29,4 @@ } | ||
readme = readme || readme.split('http').map(url => 'http' + url).join(' '); // Separate urls by spaces first | ||
// Separate urls by spaces first | ||
readme = readme || readme.split('http').map(url => `http${url}`).join(' '); | ||
@@ -39,3 +40,3 @@ try { | ||
return urls | ||
.map(url => url && url.split(')')[0]) // ignore markdown syntax leftovers | ||
.map(url => url && url.split(')')[0]) // Ignore markdown syntax leftovers | ||
.filter(url => !!url && isBadgeUrl(url)) | ||
@@ -50,3 +51,4 @@ .map(url => { | ||
// fallback to generic shields.io | ||
// TODO: Fallback to generic shields.io | ||
// If that is the case we should add a flag indicating that it is a guess. | ||
@@ -53,0 +55,0 @@ return badge; |
{ | ||
"name": "detect-readme-badges", | ||
"version": "1.1.2", | ||
"version": "1.2.0", | ||
"description": "Scans a repository's readme file, searching for badges", | ||
@@ -9,3 +9,4 @@ "main": "index.js", | ||
"test": "npm run lint && ava test/spec --tap | tap-nyan", | ||
"test-cov": "nyc ava test/spec --reporter=lcov && echo coverage report: coverage/lcov-report/index.html" | ||
"test:simple": "ava test/spec", | ||
"test:cov": "nyc ava test/spec --reporter=lcov && echo coverage report: coverage/lcov-report/index.html" | ||
}, | ||
@@ -32,6 +33,6 @@ "bugs": { | ||
"@carsy/eslint-config": "^0.3.0", | ||
"ava": "^0.17.0", | ||
"ava": "^0.21.0", | ||
"coveralls": "^2.11.6", | ||
"eslint": "^3.0.0", | ||
"nyc": "^10.1.2", | ||
"nyc": "^11.0.2", | ||
"tap-nyan": "1.1.0" | ||
@@ -38,0 +39,0 @@ }, |
@@ -5,3 +5,3 @@ # detect-readme-badges | ||
[![NPM version][npm-image]][npm-url] [![Build Status][travis-image]][travis-url] [![Coverage Status][coveralls-image]][coveralls-url] [![Dependency status][david-dm-image]][david-dm-url] [![Dev Dependency status][david-dm-dev-image]][david-dm-dev-url] | ||
[![NPM version][npm-image]][npm-url] [![Build Status][travis-image]][travis-url] [![Coverage Status][coveralls-image]][coveralls-url] [![Dependency status][david-dm-image]][david-dm-url] [![Dev Dependency status][david-dm-dev-image]][david-dm-dev-url] [![Greenkeeper badge][greenkeeper-image]][greenkeeper-url] | ||
@@ -16,4 +16,6 @@ [npm-url]:https://npmjs.org/package/detect-readme-badges | ||
[david-dm-image]:https://img.shields.io/david/IndigoUnited/node-detect-readme-badges.svg?style=flat-square | ||
[david-dm-dev-url]:https://david-dm.org/IndigoUnited/node-detect-readme-badges#info=devDependencies | ||
[david-dm-dev-url]:https://david-dm.org/IndigoUnited/node-detect-readme-badges?type=dev | ||
[david-dm-dev-image]:https://img.shields.io/david/dev/IndigoUnited/node-detect-readme-badges.svg?style=flat-square | ||
[greenkeeper-image]:https://badges.greenkeeper.io/IndigoUnited/node-detect-readme-badges.svg | ||
[greenkeeper-url]:https://greenkeeper.io/ | ||
@@ -20,0 +22,0 @@ ## Usage |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
20815
13
331
99