Comparing version 3.1.0 to 4.0.0-next.1585173540.e02ebab0f4ee6d0f7d4d059b0262d71412f5f965
@@ -1,776 +0,468 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.badge = badge; | ||
exports.shields = shields; | ||
exports.npmversion = npmversion; | ||
exports.npmdownloads = npmdownloads; | ||
exports.daviddm = daviddm; | ||
exports.daviddmdev = daviddmdev; | ||
exports.nodeico = nodeico; | ||
exports.saucelabsbm = saucelabsbm; | ||
exports.saucelabs = saucelabs; | ||
exports.travisci = travisci; | ||
exports.codeship = codeship; | ||
exports.coveralls = coveralls; | ||
exports.codeclimate = codeclimate; | ||
exports.bithound = bithound; | ||
exports.waffle = waffle; | ||
exports.sixtydevstips = sixtydevstips; | ||
exports.githubsponsors = githubsponsors; | ||
exports.patreon = patreon; | ||
exports.opencollective = opencollective; | ||
exports.gratipay = gratipay; | ||
exports.flattr = flattr; | ||
exports.paypal = paypal; | ||
exports.crypto = crypto; | ||
exports.bitcoin = bitcoin; | ||
exports.wishlist = wishlist; | ||
exports.buymeacoffee = buymeacoffee; | ||
exports.liberapay = liberapay; | ||
exports.thanksapp = thanksapp; | ||
exports.boostlab = boostlab; | ||
exports.slackinscript = slackinscript; | ||
exports.slackin = slackin; | ||
exports.gabeacon = gabeacon; | ||
exports.googleplusone = googleplusone; | ||
exports.redditsubmit = redditsubmit; | ||
exports.hackernewssubmit = hackernewssubmit; | ||
exports.facebooklike = facebooklike; | ||
exports.facebookfollow = facebookfollow; | ||
exports.twittertweet = twittertweet; | ||
exports.twitterfollow = twitterfollow; | ||
exports.githubfollow = githubfollow; | ||
exports.githubstar = githubstar; | ||
exports.quorafollow = quorafollow; | ||
var _querystring = _interopRequireDefault(require("querystring")); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
// Import | ||
import querystring from 'querystring' | ||
/** Generate a HTML badge */ | ||
function badge(_ref) { | ||
var image = _ref.image, | ||
alt = _ref.alt, | ||
url = _ref.url, | ||
title = _ref.title; | ||
// Check | ||
if (!image) throw new Error('image is missing'); // Create | ||
var result = alt ? "<img src=\"".concat(image, "\" alt=\"").concat(alt, "\" />") : "<img src=\"".concat(image, "\" />"); | ||
if (url) { | ||
result = (title ? "<a href=\"".concat(url, "\" title=\"").concat(title, "\">") : "<a href=\"".concat(url, "\">")) + result + '</a>'; | ||
} | ||
return result; | ||
export function badge({ image, alt, url, title }) { | ||
// Check | ||
if (!image) throw new Error('image is missing') | ||
// Create | ||
let result = alt | ||
? `<img src="${image}" alt="${alt}" />` | ||
: `<img src="${image}" />` | ||
if (url) { | ||
result = | ||
(title ? `<a href="${url}" title="${title}">` : `<a href="${url}">`) + | ||
result + | ||
'</a>' | ||
} | ||
return result | ||
} | ||
badge.badgeCategory = 'custom'; | ||
badge.badgeCategory = 'custom' | ||
/** Shields Custom Badge */ | ||
function shields(_ref2) { | ||
var left = _ref2.left, | ||
right = _ref2.right, | ||
_ref2$color = _ref2.color, | ||
color = _ref2$color === void 0 ? 'yellow' : _ref2$color, | ||
alt = _ref2.alt, | ||
url = _ref2.url, | ||
title = _ref2.title; | ||
// Check | ||
if (!left) throw new Error('left is missing'); | ||
if (!right) throw new Error('right is missing'); // Create | ||
var image = "https://img.shields.io/badge/".concat(left, "-").concat(right, "-").concat(color, ".svg"); | ||
return badge({ | ||
image: image, | ||
alt: alt, | ||
url: url, | ||
title: title | ||
}); | ||
export function shields({ left, right, color = 'yellow', alt, url, title }) { | ||
// Check | ||
if (!left) throw new Error('left is missing') | ||
if (!right) throw new Error('right is missing') | ||
// Create | ||
const image = `https://img.shields.io/badge/${left}-${right}-${color}.svg` | ||
return badge({ image, alt, url, title }) | ||
} | ||
shields.badgeCategory = 'custom'; // ==================================== | ||
// Development Badges | ||
shields.badgeCategory = 'custom' | ||
/** NPM Version Badge */ | ||
function npmversion(_ref3) { | ||
var npmPackageName = _ref3.npmPackageName; | ||
// Check | ||
if (!npmPackageName) throw new Error('npmPackageName is missing'); // Create | ||
var image = "https://img.shields.io/npm/v/".concat(npmPackageName, ".svg"); | ||
var url = "https://npmjs.org/package/".concat(npmPackageName); | ||
var alt = 'NPM version'; | ||
var title = 'View this project on NPM'; | ||
return badge({ | ||
image: image, | ||
alt: alt, | ||
url: url, | ||
title: title | ||
}); | ||
export function npmversion({ npmPackageName }) { | ||
// Check | ||
if (!npmPackageName) throw new Error('npmPackageName is missing') | ||
// Create | ||
const image = `https://img.shields.io/npm/v/${npmPackageName}.svg` | ||
const url = `https://npmjs.org/package/${npmPackageName}` | ||
const alt = 'NPM version' | ||
const title = 'View this project on NPM' | ||
return badge({ image, alt, url, title }) | ||
} | ||
npmversion.badgeCategory = 'development'; | ||
npmversion.badgeCategory = 'development' | ||
/** NPM Downloads Badge */ | ||
function npmdownloads(_ref4) { | ||
var npmPackageName = _ref4.npmPackageName; | ||
// Check | ||
if (!npmPackageName) throw new Error('npmPackageName is missing'); | ||
var image = "https://img.shields.io/npm/dm/".concat(npmPackageName, ".svg"); | ||
var url = "https://npmjs.org/package/".concat(npmPackageName); | ||
var alt = 'NPM downloads'; | ||
var title = 'View this project on NPM'; | ||
return badge({ | ||
image: image, | ||
alt: alt, | ||
url: url, | ||
title: title | ||
}); | ||
export function npmdownloads({ npmPackageName }) { | ||
// Check | ||
if (!npmPackageName) throw new Error('npmPackageName is missing') | ||
const image = `https://img.shields.io/npm/dm/${npmPackageName}.svg` | ||
const url = `https://npmjs.org/package/${npmPackageName}` | ||
const alt = 'NPM downloads' | ||
const title = 'View this project on NPM' | ||
return badge({ image, alt, url, title }) | ||
} | ||
npmdownloads.badgeCategory = 'development'; | ||
npmdownloads.badgeCategory = 'development' | ||
/** David DM Dependencies Badge */ | ||
function daviddm(_ref5) { | ||
var githubSlug = _ref5.githubSlug; | ||
// Check | ||
if (!githubSlug) throw new Error('githubSlug is missing'); // Create | ||
var image = "https://img.shields.io/david/".concat(githubSlug, ".svg"); | ||
var url = "https://david-dm.org/".concat(githubSlug); | ||
var alt = 'Dependency Status'; | ||
var title = "View the status of this project's dependencies on DavidDM"; | ||
return badge({ | ||
image: image, | ||
alt: alt, | ||
url: url, | ||
title: title | ||
}); | ||
export function daviddm({ githubSlug }) { | ||
// Check | ||
if (!githubSlug) throw new Error('githubSlug is missing') | ||
// Create | ||
const image = `https://img.shields.io/david/${githubSlug}.svg` | ||
const url = `https://david-dm.org/${githubSlug}` | ||
const alt = 'Dependency Status' | ||
const title = "View the status of this project's dependencies on DavidDM" | ||
return badge({ image, alt, url, title }) | ||
} | ||
daviddm.badgeCategory = 'development'; | ||
daviddm.badgeCategory = 'development' | ||
/** David DM Dev Dependencies Badge */ | ||
function daviddmdev(_ref6) { | ||
var githubSlug = _ref6.githubSlug; | ||
// Check | ||
if (!githubSlug) throw new Error('githubSlug is missing'); // Create | ||
var image = "https://img.shields.io/david/dev/".concat(githubSlug, ".svg"); | ||
var url = "https://david-dm.org/".concat(githubSlug, "#info=devDependencies"); | ||
var alt = 'Dev Dependency Status'; | ||
var title = "View the status of this project's development dependencies on DavidDM"; | ||
return badge({ | ||
image: image, | ||
alt: alt, | ||
url: url, | ||
title: title | ||
}); | ||
export function daviddmdev({ githubSlug }) { | ||
// Check | ||
if (!githubSlug) throw new Error('githubSlug is missing') | ||
// Create | ||
const image = `https://img.shields.io/david/dev/${githubSlug}.svg` | ||
const url = `https://david-dm.org/${githubSlug}#info=devDependencies` | ||
const alt = 'Dev Dependency Status' | ||
const title = | ||
"View the status of this project's development dependencies on DavidDM" | ||
return badge({ image, alt, url, title }) | ||
} | ||
daviddmdev.badgeCategory = 'development'; | ||
daviddmdev.badgeCategory = 'development' | ||
/** Nodei.co Badge */ | ||
function nodeico(_ref7) { | ||
var npmPackageName = _ref7.npmPackageName, | ||
nodeicoQueryString = _ref7.nodeicoQueryString; | ||
// Prepare | ||
if (!npmPackageName) throw new Error('npmPackageName is missing'); | ||
if (nodeicoQueryString && typeof nodeicoQueryString !== 'string' && _typeof(nodeicoQueryString) !== 'object') { | ||
throw new Error('nodeicoQueryString must be a string or an object'); | ||
} // Return | ||
var url = "https://www.npmjs.com/package/".concat(npmPackageName); | ||
var alt = 'Nodei.co badge'; | ||
var title = 'Nodei.co badge'; | ||
var image = "https://nodei.co/npm/".concat(npmPackageName, ".png"); | ||
var query = _typeof(nodeicoQueryString) === 'object' ? _querystring.default.stringify(nodeicoQueryString) : nodeicoQueryString; | ||
if (query) image += "?".concat(query); | ||
return badge({ | ||
image: image, | ||
alt: alt, | ||
url: url, | ||
title: title | ||
}); | ||
export function nodeico({ npmPackageName, nodeicoQueryString }) { | ||
// Prepare | ||
if (!npmPackageName) throw new Error('npmPackageName is missing') | ||
if ( | ||
nodeicoQueryString && | ||
typeof nodeicoQueryString !== 'string' && | ||
typeof nodeicoQueryString !== 'object' | ||
) { | ||
throw new Error('nodeicoQueryString must be a string or an object') | ||
} | ||
// Return | ||
const url = `https://www.npmjs.com/package/${npmPackageName}` | ||
const alt = 'Nodei.co badge' | ||
const title = 'Nodei.co badge' | ||
let image = `https://nodei.co/npm/${npmPackageName}.png` | ||
const query = | ||
typeof nodeicoQueryString === 'object' | ||
? querystring.stringify(nodeicoQueryString) | ||
: nodeicoQueryString | ||
if (query) image += `?${query}` | ||
return badge({ image, alt, url, title }) | ||
} | ||
nodeico.badgeCategory = 'development'; // ==================================== | ||
// Testing Badges | ||
nodeico.badgeCategory = 'development' | ||
/** Sauce Labs Browser Matrix Badge */ | ||
function saucelabsbm(_ref8) { | ||
var saucelabsUsername = _ref8.saucelabsUsername, | ||
saucelabsAuthToken = _ref8.saucelabsAuthToken; | ||
// Check | ||
if (!saucelabsUsername) throw new Error('saucelabsUsername is missing'); | ||
saucelabsAuthToken = saucelabsAuthToken || process.env.SAUCELABS_AUTH_TOKEN; | ||
if (!saucelabsAuthToken) throw new Error('saucelabsAuthToken is missing'); // Create | ||
var image = "https://saucelabs.com/browser-matrix/".concat(saucelabsUsername, ".svg?auth=").concat(escape(saucelabsAuthToken)); | ||
var url = "https://saucelabs.com/u/".concat(saucelabsUsername); | ||
var alt = 'Sauce Labs Browser Matrix'; | ||
var title = "Check this project's browser tests on Sauce Labs"; | ||
return badge({ | ||
image: image, | ||
alt: alt, | ||
url: url, | ||
title: title | ||
}); | ||
export function saucelabsbm({ saucelabsUsername, saucelabsAuthToken }) { | ||
// Check | ||
if (!saucelabsUsername) throw new Error('saucelabsUsername is missing') | ||
saucelabsAuthToken = saucelabsAuthToken || process.env.SAUCELABS_AUTH_TOKEN | ||
if (!saucelabsAuthToken) throw new Error('saucelabsAuthToken is missing') | ||
// Create | ||
const image = `https://saucelabs.com/browser-matrix/${saucelabsUsername}.svg?auth=${escape( | ||
saucelabsAuthToken | ||
)}` | ||
const url = `https://saucelabs.com/u/${saucelabsUsername}` | ||
const alt = 'Sauce Labs Browser Matrix' | ||
const title = "Check this project's browser tests on Sauce Labs" | ||
return badge({ image, alt, url, title }) | ||
} | ||
saucelabsbm.badgeCategory = 'testing'; | ||
saucelabsbm.badgeInline = false; | ||
saucelabsbm.badgeCategory = 'testing' | ||
saucelabsbm.badgeInline = false | ||
/** Sauce Labs Badge */ | ||
function saucelabs(_ref9) { | ||
var saucelabsUsername = _ref9.saucelabsUsername, | ||
saucelabsAuthToken = _ref9.saucelabsAuthToken; | ||
// Check | ||
if (!saucelabsUsername) throw new Error('saucelabsUsername is missing'); | ||
saucelabsAuthToken = saucelabsAuthToken || process.env.SAUCELABS_AUTH_TOKEN; | ||
if (!saucelabsAuthToken) throw new Error('saucelabsAuthToken is missing'); // Create | ||
var image = "https://saucelabs.com/browser-matrix/".concat(saucelabsUsername, ".svg?auth=").concat(escape(saucelabsAuthToken)); | ||
var url = "https://saucelabs.com/u/".concat(saucelabsUsername); | ||
var alt = 'Sauce Labs Browser Matrix'; | ||
var title = "Check this project's browser tests on Sauce Labs"; | ||
return badge({ | ||
image: image, | ||
alt: alt, | ||
url: url, | ||
title: title | ||
}); | ||
export function saucelabs({ saucelabsUsername, saucelabsAuthToken }) { | ||
// Check | ||
if (!saucelabsUsername) throw new Error('saucelabsUsername is missing') | ||
saucelabsAuthToken = saucelabsAuthToken || process.env.SAUCELABS_AUTH_TOKEN | ||
if (!saucelabsAuthToken) throw new Error('saucelabsAuthToken is missing') | ||
// Create | ||
const image = `https://saucelabs.com/browser-matrix/${saucelabsUsername}.svg?auth=${escape( | ||
saucelabsAuthToken | ||
)}` | ||
const url = `https://saucelabs.com/u/${saucelabsUsername}` | ||
const alt = 'Sauce Labs Browser Matrix' | ||
const title = "Check this project's browser tests on Sauce Labs" | ||
return badge({ image, alt, url, title }) | ||
} | ||
saucelabs.badgeCategory = 'testing'; | ||
saucelabs.badgeCategory = 'testing' | ||
/** Travis CI Badge */ | ||
function travisci(_ref10) { | ||
var githubSlug = _ref10.githubSlug, | ||
_ref10$travisTLD = _ref10.travisTLD, | ||
travisTLD = _ref10$travisTLD === void 0 ? 'org' : _ref10$travisTLD; | ||
// Check | ||
if (!githubSlug) throw new Error('githubSlug is missing'); // Create | ||
var image = ['https://img.shields.io/travis', travisTLD === 'com' ? 'com' : '', githubSlug, 'master.svg'].filter(function (i) { | ||
return Boolean(i); | ||
}).join('/'); | ||
var url = "http://travis-ci.".concat(travisTLD, "/").concat(githubSlug); | ||
var alt = 'Travis CI Build Status'; | ||
var title = "Check this project's build status on TravisCI"; | ||
return badge({ | ||
image: image, | ||
alt: alt, | ||
url: url, | ||
title: title | ||
}); | ||
export function travisci({ githubSlug, travisTLD = 'org' }) { | ||
// Check | ||
if (!githubSlug) throw new Error('githubSlug is missing') | ||
// Create | ||
const image = [ | ||
'https://img.shields.io/travis', | ||
travisTLD === 'com' ? 'com' : '', | ||
githubSlug, | ||
'master.svg', | ||
] | ||
.filter((i) => Boolean(i)) | ||
.join('/') | ||
const url = `http://travis-ci.${travisTLD}/${githubSlug}` | ||
const alt = 'Travis CI Build Status' | ||
const title = "Check this project's build status on TravisCI" | ||
return badge({ image, alt, url, title }) | ||
} | ||
travisci.badgeCategory = 'testing'; | ||
travisci.badgeCategory = 'testing' | ||
/** Codeship Badge */ | ||
function codeship(_ref11) { | ||
var codeshipProjectUUID = _ref11.codeshipProjectUUID, | ||
codeshipProjectID = _ref11.codeshipProjectID; | ||
// Check | ||
if (!codeshipProjectUUID) throw new Error('codeshipProjectUUID is missing'); | ||
if (!codeshipProjectID) throw new Error('codeshipProjectID is missing'); // Create | ||
var image = "https://img.shields.io/codeship/".concat(codeshipProjectUUID, "/master.svg"); | ||
var url = "https://www.codeship.io/projects/".concat(codeshipProjectID); | ||
var alt = 'Codeship Status'; | ||
var title = "Check this project's status on Codeship"; | ||
return badge({ | ||
image: image, | ||
alt: alt, | ||
url: url, | ||
title: title | ||
}); | ||
export function codeship({ codeshipProjectUUID, codeshipProjectID }) { | ||
// Check | ||
if (!codeshipProjectUUID) throw new Error('codeshipProjectUUID is missing') | ||
if (!codeshipProjectID) throw new Error('codeshipProjectID is missing') | ||
// Create | ||
const image = `https://img.shields.io/codeship/${codeshipProjectUUID}/master.svg` | ||
const url = `https://www.codeship.io/projects/${codeshipProjectID}` | ||
const alt = 'Codeship Status' | ||
const title = "Check this project's status on Codeship" | ||
return badge({ image, alt, url, title }) | ||
} | ||
codeship.badgeCategory = 'testing'; | ||
codeship.badgeCategory = 'testing' | ||
/** Coveralls Badge */ | ||
function coveralls(_ref12) { | ||
var githubSlug = _ref12.githubSlug; | ||
// Check | ||
if (!githubSlug) throw new Error('githubSlug is missing'); // Create | ||
var image = "https://img.shields.io/coveralls/".concat(githubSlug, ".svg"); | ||
var url = "https://coveralls.io/r/".concat(githubSlug); | ||
var alt = 'Coveralls Coverage Status'; | ||
var title = "View this project's coverage on Coveralls"; | ||
return badge({ | ||
image: image, | ||
alt: alt, | ||
url: url, | ||
title: title | ||
}); | ||
export function coveralls({ githubSlug }) { | ||
// Check | ||
if (!githubSlug) throw new Error('githubSlug is missing') | ||
// Create | ||
const image = `https://img.shields.io/coveralls/${githubSlug}.svg` | ||
const url = `https://coveralls.io/r/${githubSlug}` | ||
const alt = 'Coveralls Coverage Status' | ||
const title = "View this project's coverage on Coveralls" | ||
return badge({ image, alt, url, title }) | ||
} | ||
coveralls.badgeCategory = 'testing'; | ||
coveralls.badgeCategory = 'testing' | ||
/** Code Climate Rating Badge */ | ||
function codeclimate(_ref13) { | ||
var githubSlug = _ref13.githubSlug; | ||
// Check | ||
if (!githubSlug) throw new Error('githubSlug is missing'); // Create | ||
var image = "https://img.shields.io/codeclimate/github/".concat(githubSlug, ".svg"); | ||
var url = "https://codeclimate.com/github/".concat(githubSlug); | ||
var alt = 'Code Climate Rating'; | ||
var title = "View this project's rating on Code Climate"; | ||
return badge({ | ||
image: image, | ||
alt: alt, | ||
url: url, | ||
title: title | ||
}); | ||
export function codeclimate({ githubSlug }) { | ||
// Check | ||
if (!githubSlug) throw new Error('githubSlug is missing') | ||
// Create | ||
const image = `https://img.shields.io/codeclimate/github/${githubSlug}.svg` | ||
const url = `https://codeclimate.com/github/${githubSlug}` | ||
const alt = 'Code Climate Rating' | ||
const title = "View this project's rating on Code Climate" | ||
return badge({ image, alt, url, title }) | ||
} | ||
codeclimate.badgeCategory = 'testing'; | ||
codeclimate.badgeCategory = 'testing' | ||
/** BitHound Score Badge */ | ||
function bithound(_ref14) { | ||
var githubSlug = _ref14.githubSlug; | ||
// Check | ||
if (!githubSlug) throw new Error('githubSlug is missing'); // Create | ||
var image = "https://bithound.io/github/".concat(githubSlug, "/badges/score.svg"); | ||
var url = "https://bithound.io/github/".concat(githubSlug); | ||
var alt = 'BitHound Score'; | ||
var title = "View this project's score on BitHound"; | ||
return badge({ | ||
image: image, | ||
alt: alt, | ||
url: url, | ||
title: title | ||
}); | ||
export function bithound({ githubSlug }) { | ||
// Check | ||
if (!githubSlug) throw new Error('githubSlug is missing') | ||
// Create | ||
const image = `https://bithound.io/github/${githubSlug}/badges/score.svg` | ||
const url = `https://bithound.io/github/${githubSlug}` | ||
const alt = 'BitHound Score' | ||
const title = "View this project's score on BitHound" | ||
return badge({ image, alt, url, title }) | ||
} | ||
bithound.badgeCategory = 'testing'; | ||
bithound.badgeCategory = 'testing' | ||
/** Waffle Badge */ | ||
function waffle(_ref15) { | ||
var githubSlug = _ref15.githubSlug; | ||
// Check | ||
if (!githubSlug) throw new Error('githubSlug is missing'); // Create | ||
var label = 'ready'; | ||
var image = "https://badge.waffle.io/".concat(githubSlug, ".png?label=").concat(escape(label)); | ||
var url = "http://waffle.io/".concat(githubSlug); | ||
var alt = 'Stories in Ready'; | ||
var title = "View this project's stories on Waffle.io"; | ||
return badge({ | ||
image: image, | ||
alt: alt, | ||
url: url, | ||
title: title | ||
}); | ||
export function waffle({ githubSlug }) { | ||
// Check | ||
if (!githubSlug) throw new Error('githubSlug is missing') | ||
// Create | ||
const label = 'ready' | ||
const image = `https://badge.waffle.io/${githubSlug}.png?label=${escape( | ||
label | ||
)}` | ||
const url = `http://waffle.io/${githubSlug}` | ||
const alt = 'Stories in Ready' | ||
const title = "View this project's stories on Waffle.io" | ||
return badge({ image, alt, url, title }) | ||
} | ||
waffle.badgeCategory = 'testing'; // ==================================== | ||
// Funding Badges | ||
/** At least one of the properties must be provided */ | ||
waffle.badgeCategory = 'testing' | ||
/** 60devs Tips Badge */ | ||
function sixtydevstips(_ref16) { | ||
var sixtydevstipsID = _ref16.sixtydevstipsID, | ||
sixtydevstipsURL = _ref16.sixtydevstipsURL; | ||
// Check | ||
if (!sixtydevstipsURL) { | ||
if (!sixtydevstipsID) throw new Error('sixtydevstipsID is missing'); | ||
sixtydevstipsURL = "https://tips.60devs.com/tip/".concat(sixtydevstipsID); | ||
} // Create | ||
var image = 'https://img.shields.io/badge/60devs-donate-yellow.svg'; | ||
var url = sixtydevstipsURL; | ||
var alt = '60devs tips donate button'; | ||
var title = 'Donate to this project using 60devs tips'; | ||
return badge({ | ||
image: image, | ||
alt: alt, | ||
url: url, | ||
title: title | ||
}); | ||
export function sixtydevstips({ sixtydevstipsID, sixtydevstipsURL }) { | ||
// Check | ||
if (!sixtydevstipsURL) { | ||
if (!sixtydevstipsID) throw new Error('sixtydevstipsID is missing') | ||
sixtydevstipsURL = `https://tips.60devs.com/tip/${sixtydevstipsID}` | ||
} | ||
// Create | ||
const image = 'https://img.shields.io/badge/60devs-donate-yellow.svg' | ||
const url = sixtydevstipsURL | ||
const alt = '60devs tips donate button' | ||
const title = 'Donate to this project using 60devs tips' | ||
return badge({ image, alt, url, title }) | ||
} | ||
sixtydevstips.badgeCategory = 'funding'; | ||
/** At least one of the properties must be provided */ | ||
sixtydevstips.badgeCategory = 'funding' | ||
/** Github Sponsors Badge */ | ||
function githubsponsors(_ref17) { | ||
var githubSponsorsURL = _ref17.githubSponsorsURL, | ||
githubSponsorsUsername = _ref17.githubSponsorsUsername, | ||
githubUsername = _ref17.githubUsername; | ||
if (!githubSponsorsURL) { | ||
if (!githubSponsorsUsername && !githubUsername) throw new Error('githubSponsorsUsername and githubUsername are missing'); | ||
githubSponsorsURL = "https://github.com/sponsors/".concat(githubSponsorsUsername || githubUsername); | ||
} // Create | ||
var image = 'https://img.shields.io/badge/github-donate-yellow.svg'; | ||
var url = githubSponsorsURL; | ||
var alt = 'GitHub Sponsors donate button'; | ||
var title = 'Donate to this project using GitHub Sponsors'; | ||
return badge({ | ||
image: image, | ||
alt: alt, | ||
url: url, | ||
title: title | ||
}); | ||
export function githubsponsors({ | ||
githubSponsorsURL, | ||
githubSponsorsUsername, | ||
githubUsername, | ||
}) { | ||
if (!githubSponsorsURL) { | ||
if (!githubSponsorsUsername && !githubUsername) | ||
throw new Error('githubSponsorsUsername and githubUsername are missing') | ||
githubSponsorsURL = `https://github.com/sponsors/${ | ||
githubSponsorsUsername || githubUsername | ||
}` | ||
} | ||
// Create | ||
const image = 'https://img.shields.io/badge/github-donate-yellow.svg' | ||
const url = githubSponsorsURL | ||
const alt = 'GitHub Sponsors donate button' | ||
const title = 'Donate to this project using GitHub Sponsors' | ||
return badge({ image, alt, url, title }) | ||
} | ||
githubsponsors.badgeCategory = 'funding'; | ||
/** At least one of the properties must be provided */ | ||
githubsponsors.badgeCategory = 'funding' | ||
/** Patreon Badge */ | ||
function patreon(_ref18) { | ||
var patreonUsername = _ref18.patreonUsername, | ||
patreonURL = _ref18.patreonURL; | ||
// Check | ||
if (!patreonURL) { | ||
if (!patreonUsername) throw new Error('patreonUsername is missing'); | ||
patreonURL = "https://patreon.com/".concat(patreonUsername); | ||
} // Create | ||
var image = 'https://img.shields.io/badge/patreon-donate-yellow.svg'; | ||
var url = patreonURL; | ||
var alt = 'Patreon donate button'; | ||
var title = 'Donate to this project using Patreon'; | ||
return badge({ | ||
image: image, | ||
alt: alt, | ||
url: url, | ||
title: title | ||
}); | ||
export function patreon({ patreonUsername, patreonURL }) { | ||
// Check | ||
if (!patreonURL) { | ||
if (!patreonUsername) throw new Error('patreonUsername is missing') | ||
patreonURL = `https://patreon.com/${patreonUsername}` | ||
} | ||
// Create | ||
const image = 'https://img.shields.io/badge/patreon-donate-yellow.svg' | ||
const url = patreonURL | ||
const alt = 'Patreon donate button' | ||
const title = 'Donate to this project using Patreon' | ||
return badge({ image, alt, url, title }) | ||
} | ||
patreon.badgeCategory = 'funding'; | ||
/** At least one of the properties must be provided */ | ||
patreon.badgeCategory = 'funding' | ||
/** Open Collective Badge */ | ||
function opencollective(_ref19) { | ||
var opencollectiveUsername = _ref19.opencollectiveUsername, | ||
opencollectiveURL = _ref19.opencollectiveURL; | ||
// Check | ||
if (!opencollectiveURL) { | ||
if (!opencollectiveUsername) throw new Error('opencollectiveUsername is missing'); | ||
opencollectiveURL = "https://opencollective.com/".concat(opencollectiveUsername); | ||
} // Create | ||
var image = 'https://img.shields.io/badge/open%20collective-donate-yellow.svg'; | ||
var url = opencollectiveURL; | ||
var alt = 'Open Collective donate button'; | ||
var title = 'Donate to this project using Open Collective'; | ||
return badge({ | ||
image: image, | ||
alt: alt, | ||
url: url, | ||
title: title | ||
}); | ||
export function opencollective({ opencollectiveUsername, opencollectiveURL }) { | ||
// Check | ||
if (!opencollectiveURL) { | ||
if (!opencollectiveUsername) | ||
throw new Error('opencollectiveUsername is missing') | ||
opencollectiveURL = `https://opencollective.com/${opencollectiveUsername}` | ||
} | ||
// Create | ||
const image = | ||
'https://img.shields.io/badge/open%20collective-donate-yellow.svg' | ||
const url = opencollectiveURL | ||
const alt = 'Open Collective donate button' | ||
const title = 'Donate to this project using Open Collective' | ||
return badge({ image, alt, url, title }) | ||
} | ||
opencollective.badgeCategory = 'funding'; | ||
/** At least one of the properties must be provided */ | ||
opencollective.badgeCategory = 'funding' | ||
/** Gratipay Badge */ | ||
function gratipay(_ref20) { | ||
var gratipayUsername = _ref20.gratipayUsername, | ||
gratipayURL = _ref20.gratipayURL; | ||
// Check | ||
if (!gratipayURL) { | ||
if (!gratipayUsername) throw new Error('gratipayUsername is missing'); | ||
gratipayURL = "https://gratipay.com/".concat(gratipayUsername); | ||
} // Create | ||
var image = 'https://img.shields.io/badge/gratipay-donate-yellow.svg'; | ||
var url = gratipayURL; | ||
var alt = 'Gratipay donate button'; | ||
var title = 'Donate weekly to this project using Gratipay'; | ||
return badge({ | ||
image: image, | ||
alt: alt, | ||
url: url, | ||
title: title | ||
}); | ||
export function gratipay({ gratipayUsername, gratipayURL }) { | ||
// Check | ||
if (!gratipayURL) { | ||
if (!gratipayUsername) throw new Error('gratipayUsername is missing') | ||
gratipayURL = `https://gratipay.com/${gratipayUsername}` | ||
} | ||
// Create | ||
const image = 'https://img.shields.io/badge/gratipay-donate-yellow.svg' | ||
const url = gratipayURL | ||
const alt = 'Gratipay donate button' | ||
const title = 'Donate weekly to this project using Gratipay' | ||
return badge({ image, alt, url, title }) | ||
} | ||
gratipay.badgeCategory = 'funding'; | ||
/** At least one of the properties must be provided */ | ||
gratipay.badgeCategory = 'funding' | ||
/** Flattr Badge */ | ||
function flattr(_ref21) { | ||
var flattrCode = _ref21.flattrCode, | ||
flattrUsername = _ref21.flattrUsername, | ||
flattrURL = _ref21.flattrURL; | ||
// Check | ||
if (!flattrURL) { | ||
if (flattrUsername) { | ||
flattrURL = "https://flattr.com/profile/".concat(flattrUsername); | ||
} else if (flattrCode) { | ||
flattrURL = "https://flattr.com/thing/".concat(flattrCode); | ||
} else { | ||
throw new Error('flattrUsername/flattrCode is missing'); | ||
} | ||
} // Create | ||
var image = 'https://img.shields.io/badge/flattr-donate-yellow.svg'; | ||
var url = flattrURL; | ||
var alt = 'Flattr donate button'; | ||
var title = 'Donate to this project using Flattr'; | ||
return badge({ | ||
image: image, | ||
alt: alt, | ||
url: url, | ||
title: title | ||
}); | ||
export function flattr({ flattrCode, flattrUsername, flattrURL }) { | ||
// Check | ||
if (!flattrURL) { | ||
if (flattrUsername) { | ||
flattrURL = `https://flattr.com/profile/${flattrUsername}` | ||
} else if (flattrCode) { | ||
flattrURL = `https://flattr.com/thing/${flattrCode}` | ||
} else { | ||
throw new Error('flattrUsername/flattrCode is missing') | ||
} | ||
} | ||
// Create | ||
const image = 'https://img.shields.io/badge/flattr-donate-yellow.svg' | ||
const url = flattrURL | ||
const alt = 'Flattr donate button' | ||
const title = 'Donate to this project using Flattr' | ||
return badge({ image, alt, url, title }) | ||
} | ||
flattr.badgeCategory = 'funding'; | ||
/** At least one of the properties must be provided */ | ||
flattr.badgeCategory = 'funding' | ||
/** Paypal Badge */ | ||
function paypal(_ref22) { | ||
var paypalURL = _ref22.paypalURL, | ||
paypalButtonID = _ref22.paypalButtonID, | ||
paypalUsername = _ref22.paypalUsername; | ||
// Check | ||
if (!paypalURL) { | ||
if (paypalButtonID) { | ||
paypalURL = "https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=".concat(escape(paypalButtonID)); | ||
} else if (paypalUsername) { | ||
paypalURL = "https://paypal.me/".concat(paypalUsername); | ||
} else { | ||
throw new Error('paypalURL, paypalButtonID, or paypalUsername is missing, at least one must exist'); | ||
} | ||
} // Create | ||
var image = 'https://img.shields.io/badge/paypal-donate-yellow.svg'; | ||
var url = paypalURL; | ||
var alt = 'PayPal donate button'; | ||
var title = 'Donate to this project using Paypal'; | ||
return badge({ | ||
image: image, | ||
alt: alt, | ||
url: url, | ||
title: title | ||
}); | ||
export function paypal({ paypalURL, paypalButtonID, paypalUsername }) { | ||
// Check | ||
if (!paypalURL) { | ||
if (paypalButtonID) { | ||
paypalURL = `https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=${escape( | ||
paypalButtonID | ||
)}` | ||
} else if (paypalUsername) { | ||
paypalURL = `https://paypal.me/${paypalUsername}` | ||
} else { | ||
throw new Error( | ||
'paypalURL, paypalButtonID, or paypalUsername is missing, at least one must exist' | ||
) | ||
} | ||
} | ||
// Create | ||
const image = 'https://img.shields.io/badge/paypal-donate-yellow.svg' | ||
const url = paypalURL | ||
const alt = 'PayPal donate button' | ||
const title = 'Donate to this project using Paypal' | ||
return badge({ image, alt, url, title }) | ||
} | ||
paypal.badgeCategory = 'funding'; | ||
paypal.badgeCategory = 'funding' | ||
/** Crypto Badge */ | ||
function crypto(_ref23) { | ||
var cryptoURL = _ref23.cryptoURL, | ||
bitcoinURL = _ref23.bitcoinURL; | ||
// Check | ||
var url = cryptoURL || bitcoinURL; | ||
if (!url) throw new Error('cryptoURL is missing'); // Create | ||
var image = 'https://img.shields.io/badge/crypto-donate-yellow.svg'; | ||
var alt = 'crypto donate button'; | ||
var title = 'Donate to this project using Cryptocurrency'; | ||
return badge({ | ||
image: image, | ||
alt: alt, | ||
url: url, | ||
title: title | ||
}); | ||
export function crypto({ cryptoURL, bitcoinURL }) { | ||
// Check | ||
const url = cryptoURL || bitcoinURL | ||
if (!url) throw new Error('cryptoURL is missing') | ||
// Create | ||
const image = 'https://img.shields.io/badge/crypto-donate-yellow.svg' | ||
const alt = 'crypto donate button' | ||
const title = 'Donate to this project using Cryptocurrency' | ||
return badge({ image, alt, url, title }) | ||
} | ||
crypto.badgeCategory = 'funding'; | ||
crypto.badgeCategory = 'funding' | ||
/** @deprecated */ | ||
function bitcoin(opts) { | ||
return crypto(opts); | ||
export function bitcoin(opts) { | ||
return crypto(opts) | ||
} | ||
bitcoin.badgeCategory = 'funding'; | ||
bitcoin.badgeCategory = 'funding' | ||
/** Wishlist Badge */ | ||
function wishlist(_ref24) { | ||
var wishlistURL = _ref24.wishlistURL; | ||
// Check | ||
if (!wishlistURL) throw new Error('wishlistURL is missing'); // Create | ||
var image = 'https://img.shields.io/badge/wishlist-donate-yellow.svg'; | ||
var url = wishlistURL; | ||
var alt = 'Wishlist browse button'; | ||
var title = 'Buy an item on our wishlist for us'; | ||
return badge({ | ||
image: image, | ||
alt: alt, | ||
url: url, | ||
title: title | ||
}); | ||
export function wishlist({ wishlistURL }) { | ||
// Check | ||
if (!wishlistURL) throw new Error('wishlistURL is missing') | ||
// Create | ||
const image = 'https://img.shields.io/badge/wishlist-donate-yellow.svg' | ||
const url = wishlistURL | ||
const alt = 'Wishlist browse button' | ||
const title = 'Buy an item on our wishlist for us' | ||
return badge({ image, alt, url, title }) | ||
} | ||
wishlist.badgeCategory = 'funding'; | ||
/** At least one of the properties must be provided */ | ||
wishlist.badgeCategory = 'funding' | ||
/** Buy Me A Coffee Badge */ | ||
function buymeacoffee(_ref25) { | ||
var buymeacoffeeUsername = _ref25.buymeacoffeeUsername, | ||
buymeacoffeeURL = _ref25.buymeacoffeeURL; | ||
// Check | ||
if (!buymeacoffeeURL) { | ||
if (!buymeacoffeeUsername) throw new Error('buymeacoffeeUsername is missing'); | ||
buymeacoffeeURL = "https://buymeacoffee.com/".concat(buymeacoffeeUsername); | ||
} // Create | ||
var image = 'https://img.shields.io/badge/buy%20me%20a%20coffee-donate-yellow.svg'; | ||
var url = buymeacoffeeURL; | ||
var alt = 'Buy Me A Coffee donate button'; | ||
var title = 'Donate to this project using Buy Me A Coffee'; | ||
return badge({ | ||
image: image, | ||
alt: alt, | ||
url: url, | ||
title: title | ||
}); | ||
export function buymeacoffee({ buymeacoffeeUsername, buymeacoffeeURL }) { | ||
// Check | ||
if (!buymeacoffeeURL) { | ||
if (!buymeacoffeeUsername) | ||
throw new Error('buymeacoffeeUsername is missing') | ||
buymeacoffeeURL = `https://buymeacoffee.com/${buymeacoffeeUsername}` | ||
} | ||
// Create | ||
const image = | ||
'https://img.shields.io/badge/buy%20me%20a%20coffee-donate-yellow.svg' | ||
const url = buymeacoffeeURL | ||
const alt = 'Buy Me A Coffee donate button' | ||
const title = 'Donate to this project using Buy Me A Coffee' | ||
return badge({ image, alt, url, title }) | ||
} | ||
buymeacoffee.badgeCategory = 'funding'; | ||
/** At least one of the properties must be provided */ | ||
buymeacoffee.badgeCategory = 'funding' | ||
/** Liberapay Badge */ | ||
function liberapay(_ref26) { | ||
var liberapayUsername = _ref26.liberapayUsername, | ||
liberapayURL = _ref26.liberapayURL; | ||
// Check | ||
if (!liberapayURL) { | ||
if (!liberapayUsername) throw new Error('liberapayUsername is missing'); | ||
liberapayURL = "https://liberapay.com/".concat(liberapayUsername); | ||
} // Create | ||
var image = 'https://img.shields.io/badge/liberapay-donate-yellow.svg'; | ||
var url = liberapayURL; | ||
var alt = 'Liberapay donate button'; | ||
var title = 'Donate to this project using Liberapay'; | ||
return badge({ | ||
image: image, | ||
alt: alt, | ||
url: url, | ||
title: title | ||
}); | ||
export function liberapay({ liberapayUsername, liberapayURL }) { | ||
// Check | ||
if (!liberapayURL) { | ||
if (!liberapayUsername) throw new Error('liberapayUsername is missing') | ||
liberapayURL = `https://liberapay.com/${liberapayUsername}` | ||
} | ||
// Create | ||
const image = 'https://img.shields.io/badge/liberapay-donate-yellow.svg' | ||
const url = liberapayURL | ||
const alt = 'Liberapay donate button' | ||
const title = 'Donate to this project using Liberapay' | ||
return badge({ image, alt, url, title }) | ||
} | ||
liberapay.badgeCategory = 'funding'; | ||
/** At least one of the properties must be provided */ | ||
liberapay.badgeCategory = 'funding' | ||
/** Thanks App Badge */ | ||
function thanksapp(_ref27) { | ||
var npmPackageName = _ref27.npmPackageName, | ||
githubSlug = _ref27.githubSlug, | ||
thanksappUsername = _ref27.thanksappUsername, | ||
thanksappURL = _ref27.thanksappURL; | ||
// Check | ||
if (!thanksappURL) { | ||
if (thanksappUsername) { | ||
thanksappURL = "https://givethanks.app/u/".concat(thanksappUsername); | ||
} else if (npmPackageName) { | ||
thanksappURL = "https://givethanks.app/donate/npm/".concat(npmPackageName); | ||
} else if (githubSlug) { | ||
thanksappURL = "https://givethanks.app/donate/github/".concat(githubSlug); | ||
} else { | ||
throw new Error('at least one of these is required: thanksappUsername, npmPackageName, githubSlug'); | ||
} | ||
} // Create | ||
var image = 'https://img.shields.io/badge/thanksapp-donate-yellow.svg'; | ||
var url = thanksappURL; | ||
var alt = 'Thanks App donate button'; | ||
var title = 'Donate to this project using Thanks App'; | ||
return badge({ | ||
image: image, | ||
alt: alt, | ||
url: url, | ||
title: title | ||
}); | ||
export function thanksapp({ | ||
npmPackageName, | ||
githubSlug, | ||
thanksappUsername, | ||
thanksappURL, | ||
}) { | ||
// Check | ||
if (!thanksappURL) { | ||
if (thanksappUsername) { | ||
thanksappURL = `https://givethanks.app/u/${thanksappUsername}` | ||
} else if (npmPackageName) { | ||
thanksappURL = `https://givethanks.app/donate/npm/${npmPackageName}` | ||
} else if (githubSlug) { | ||
thanksappURL = `https://givethanks.app/donate/github/${githubSlug}` | ||
} else { | ||
throw new Error( | ||
'at least one of these is required: thanksappUsername, npmPackageName, githubSlug' | ||
) | ||
} | ||
} | ||
// Create | ||
const image = 'https://img.shields.io/badge/thanksapp-donate-yellow.svg' | ||
const url = thanksappURL | ||
const alt = 'Thanks App donate button' | ||
const title = 'Donate to this project using Thanks App' | ||
return badge({ image, alt, url, title }) | ||
} | ||
thanksapp.badgeCategory = 'funding'; | ||
thanksapp.badgeCategory = 'funding' | ||
/** Boost Lab Badge */ | ||
function boostlab(_ref28) { | ||
var githubSlug = _ref28.githubSlug; | ||
// Check | ||
if (!githubSlug) throw new Error('githubSlug is missing'); // Create | ||
var image = 'https://img.shields.io/badge/boostlab-donate-yellow.svg'; | ||
var url = "https://boost-lab.app/".concat(githubSlug); | ||
var alt = 'Boost Lab donate button'; | ||
var title = 'Donate to this project using Boost Lab'; | ||
return badge({ | ||
image: image, | ||
alt: alt, | ||
url: url, | ||
title: title | ||
}); | ||
export function boostlab({ githubSlug }) { | ||
// Check | ||
if (!githubSlug) throw new Error('githubSlug is missing') | ||
// Create | ||
const image = 'https://img.shields.io/badge/boostlab-donate-yellow.svg' | ||
const url = `https://boost-lab.app/${githubSlug}` | ||
const alt = 'Boost Lab donate button' | ||
const title = 'Donate to this project using Boost Lab' | ||
return badge({ image, alt, url, title }) | ||
} | ||
boostlab.badgeCategory = 'funding'; // ==================================== | ||
// Social Badges | ||
boostlab.badgeCategory = 'funding' | ||
/** Slackin Script Badge */ | ||
function slackinscript(_ref29) { | ||
var slackinURL = _ref29.slackinURL; | ||
// Check | ||
if (!slackinURL) throw new Error('slackinURL is missing'); // Create | ||
return "<script async defer src=\"".concat(slackinURL, "/slackin.js\"></script>"); | ||
export function slackinscript({ slackinURL }) { | ||
// Check | ||
if (!slackinURL) throw new Error('slackinURL is missing') | ||
// Create | ||
return `<script async defer src="${slackinURL}/slackin.js"></script>` | ||
} | ||
slackinscript.badgeCategory = 'social'; | ||
slackinscript.badgeScript = true; | ||
slackinscript.badgeCategory = 'social' | ||
slackinscript.badgeScript = true | ||
/** Slackin Badge */ | ||
function slackin(_ref30) { | ||
var slackinURL = _ref30.slackinURL; | ||
// Check | ||
if (!slackinURL) throw new Error('slackinURL is missing'); // Create | ||
var image = "".concat(slackinURL, "/badge.svg"); | ||
var url = slackinURL; | ||
var alt = 'Slack community badge'; | ||
var title = "Join this project's slack community"; | ||
return badge({ | ||
image: image, | ||
alt: alt, | ||
url: url, | ||
title: title | ||
}); | ||
export function slackin({ slackinURL }) { | ||
// Check | ||
if (!slackinURL) throw new Error('slackinURL is missing') | ||
// Create | ||
const image = `${slackinURL}/badge.svg` | ||
const url = slackinURL | ||
const alt = 'Slack community badge' | ||
const title = "Join this project's slack community" | ||
return badge({ image, alt, url, title }) | ||
} | ||
slackin.badgeCategory = 'social'; | ||
slackin.badgeCategory = 'social' | ||
/** | ||
@@ -780,155 +472,140 @@ * Google Analytics Beacon Badge | ||
*/ | ||
function gabeacon(_ref31) { | ||
var gaTrackingID = _ref31.gaTrackingID, | ||
githubSlug = _ref31.githubSlug; | ||
// Check | ||
if (!gaTrackingID) throw new Error('gaTrackingID is missing'); | ||
if (!githubSlug) throw new Error('githubSlug is missing'); // Create | ||
var image = "https://ga-beacon.appspot.com/".concat(gaTrackingID, "/").concat(githubSlug); | ||
var url = 'https://github.com/igrigorik/ga-beacon'; | ||
var alt = 'Google Analytics beacon image'; | ||
var title = 'Get Google Analytics for your project'; | ||
return badge({ | ||
image: image, | ||
alt: alt, | ||
url: url, | ||
title: title | ||
}); | ||
export function gabeacon({ gaTrackingID, githubSlug }) { | ||
// Check | ||
if (!gaTrackingID) throw new Error('gaTrackingID is missing') | ||
if (!githubSlug) throw new Error('githubSlug is missing') | ||
// Create | ||
const image = `https://ga-beacon.appspot.com/${gaTrackingID}/${githubSlug}` | ||
const url = 'https://github.com/igrigorik/ga-beacon' | ||
const alt = 'Google Analytics beacon image' | ||
const title = 'Get Google Analytics for your project' | ||
return badge({ image, alt, url, title }) | ||
} | ||
gabeacon.badgeCategory = 'social'; | ||
gabeacon.badgeCategory = 'social' | ||
/** Google Plus One Button */ | ||
function googleplusone(_ref32) { | ||
var homepage = _ref32.homepage; | ||
// Check | ||
if (!homepage) throw new Error('homepage is missing'); // Create | ||
return "<span class=\"g-plusone\" data-size=\"medium\" data-href=\"".concat(homepage, "\"></span><script>(function() {var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true; po.src = '//apis.google.com/js/plusone.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);})();</script>"); | ||
export function googleplusone({ homepage }) { | ||
// Check | ||
if (!homepage) throw new Error('homepage is missing') | ||
// Create | ||
return `<span class="g-plusone" data-size="medium" data-href="${homepage}"></span><script>(function() {var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true; po.src = '//apis.google.com/js/plusone.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);})();</script>` | ||
} | ||
googleplusone.badgeCategory = 'social'; | ||
googleplusone.badgeScript = true; | ||
googleplusone.badgeCategory = 'social' | ||
googleplusone.badgeScript = true | ||
/** Reddit Submit Button */ | ||
function redditsubmit(_ref33) { | ||
var homepage = _ref33.homepage; | ||
// Check | ||
if (!homepage) throw new Error('homepage is missing'); // Create | ||
return "<script>reddit_url=\"".concat(homepage, "\"</script><script src=\"https://en.reddit.com/static/button/button1.js\"></script>"); | ||
export function redditsubmit({ homepage }) { | ||
// Check | ||
if (!homepage) throw new Error('homepage is missing') | ||
// Create | ||
return `<script>reddit_url="${homepage}"</script><script src="https://en.reddit.com/static/button/button1.js"></script>` | ||
} | ||
redditsubmit.badgeCategory = 'social'; | ||
redditsubmit.badgeScript = true; | ||
redditsubmit.badgeCategory = 'social' | ||
redditsubmit.badgeScript = true | ||
/** Hacker News Submit Button */ | ||
function hackernewssubmit(_ref34) { | ||
var homepage = _ref34.homepage; | ||
// Check | ||
if (!homepage) throw new Error('homepage is missing'); // Create | ||
return "<a href=\"https://news.ycombinator.com/submit\" class=\"hn-button\" data-url=\"".concat(homepage, "\" data-count=\"horizontal\">Vote on Hacker News</a><script>var HN=[];HN.factory=function(e){return function(){HN.push([e].concat(Array.prototype.slice.call(arguments,0)))};},HN.on=HN.factory(\"on\"),HN.once=HN.factory(\"once\"),HN.off=HN.factory(\"off\"),HN.emit=HN.factory(\"emit\"),HN.load=function(){var e=\"hn-button.js\";if(document.getElementById(e))return;var t=document.createElement(\"script\");t.id=e,t.src=\"https://hn-button.herokuapp.com/hn-button.js\";var n=document.getElementsByTagName(\"script\")[0];n.parentNode.insertBefore(t,n)},HN.load();</script>"); | ||
export function hackernewssubmit({ homepage }) { | ||
// Check | ||
if (!homepage) throw new Error('homepage is missing') | ||
// Create | ||
return `<a href="https://news.ycombinator.com/submit" class="hn-button" data-url="${homepage}" data-count="horizontal">Vote on Hacker News</a><script>var HN=[];HN.factory=function(e){return function(){HN.push([e].concat(Array.prototype.slice.call(arguments,0)))};},HN.on=HN.factory("on"),HN.once=HN.factory("once"),HN.off=HN.factory("off"),HN.emit=HN.factory("emit"),HN.load=function(){var e="hn-button.js";if(document.getElementById(e))return;var t=document.createElement("script");t.id=e,t.src="https://hn-button.herokuapp.com/hn-button.js";var n=document.getElementsByTagName("script")[0];n.parentNode.insertBefore(t,n)},HN.load();</script>` | ||
} | ||
hackernewssubmit.badgeCategory = 'social'; | ||
hackernewssubmit.badgeScript = true; | ||
hackernewssubmit.badgeCategory = 'social' | ||
hackernewssubmit.badgeScript = true | ||
/** Facebook Like Button */ | ||
function facebooklike(_ref35) { | ||
var homepage = _ref35.homepage, | ||
facebookApplicationID = _ref35.facebookApplicationID; | ||
// Prepare | ||
if (!homepage) throw new Error('homepage is missing'); | ||
facebookApplicationID = facebookApplicationID || process.env.FACEBOOK_APPLICATION_ID; | ||
if (!facebookApplicationID) throw new Error('facebookApplicationID is missing'); // Return | ||
return "<iframe src=\"https://www.facebook.com/plugins/like.php?href=".concat(escape(homepage), "&send=false&layout=button_count&width=450&show_faces=false&font&colorscheme=light&action=like&height=21&appId=").concat(escape(facebookApplicationID), "\" scrolling=\"no\" frameborder=\"0\" style=\"border:none; overflow:hidden; width:450px; height:21px;\" allowTransparency=\"true\"></iframe>"); | ||
export function facebooklike({ homepage, facebookApplicationID }) { | ||
// Prepare | ||
if (!homepage) throw new Error('homepage is missing') | ||
facebookApplicationID = | ||
facebookApplicationID || process.env.FACEBOOK_APPLICATION_ID | ||
if (!facebookApplicationID) | ||
throw new Error('facebookApplicationID is missing') | ||
// Return | ||
return `<iframe src="https://www.facebook.com/plugins/like.php?href=${escape( | ||
homepage | ||
)}&send=false&layout=button_count&width=450&show_faces=false&font&colorscheme=light&action=like&height=21&appId=${escape( | ||
facebookApplicationID | ||
)}" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:21px;" allowTransparency="true"></iframe>` | ||
} | ||
facebooklike.badgeCategory = 'social'; | ||
facebooklike.badgeScript = true; | ||
facebooklike.badgeCategory = 'social' | ||
facebooklike.badgeScript = true | ||
/** Facebook Follow Button */ | ||
function facebookfollow(_ref36) { | ||
var facebookUsername = _ref36.facebookUsername, | ||
facebookApplicationID = _ref36.facebookApplicationID; | ||
// Prepare | ||
if (!facebookUsername) throw new Error('facebookUsername is missing'); | ||
facebookApplicationID = facebookApplicationID || process.env.FACEBOOK_APPLICATION_ID; | ||
if (!facebookApplicationID) throw new Error('facebookApplicationID is missing'); // Return | ||
return "<iframe src=\"https://www.facebook.com/plugins/follow.php?href=https%3A%2F%2Fwww.facebook.com%2F".concat(escape(facebookUsername), "&layout=button_count&show_faces=false&colorscheme=light&font&width=450&appId=").concat(escape(facebookApplicationID), "\" scrolling=\"no\" frameborder=\"0\" style=\"border:none; overflow:hidden; width:450px; height: 20px;\" allowTransparency=\"true\"></iframe>"); | ||
export function facebookfollow({ facebookUsername, facebookApplicationID }) { | ||
// Prepare | ||
if (!facebookUsername) throw new Error('facebookUsername is missing') | ||
facebookApplicationID = | ||
facebookApplicationID || process.env.FACEBOOK_APPLICATION_ID | ||
if (!facebookApplicationID) | ||
throw new Error('facebookApplicationID is missing') | ||
// Return | ||
return `<iframe src="https://www.facebook.com/plugins/follow.php?href=https%3A%2F%2Fwww.facebook.com%2F${escape( | ||
facebookUsername | ||
)}&layout=button_count&show_faces=false&colorscheme=light&font&width=450&appId=${escape( | ||
facebookApplicationID | ||
)}" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height: 20px;" allowTransparency="true"></iframe>` | ||
} | ||
facebookfollow.badgeCategory = 'social'; | ||
facebookfollow.badgeScript = true; | ||
facebookfollow.badgeCategory = 'social' | ||
facebookfollow.badgeScript = true | ||
/** Twitter Tweet Button */ | ||
function twittertweet(_ref37) { | ||
var twitterUsername = _ref37.twitterUsername; | ||
// Prepare | ||
if (!twitterUsername) throw new Error('twitterUsername is missing'); // Return | ||
return "<a href=\"https://twitter.com/share\" class=\"twitter-share-button\" data-via=\"".concat(twitterUsername, "\" data-related=\"").concat(twitterUsername, "\">Tweet</a><script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=\"https://platform.twitter.com/widgets.js\";fjs.parentNode.insertBefore(js,fjs);}}(document,\"script\",\"twitter-wjs\");</script>"); | ||
export function twittertweet({ twitterUsername }) { | ||
// Prepare | ||
if (!twitterUsername) throw new Error('twitterUsername is missing') | ||
// Return | ||
return `<a href="https://twitter.com/share" class="twitter-share-button" data-via="${twitterUsername}" data-related="${twitterUsername}">Tweet</a><script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="https://platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>` | ||
} | ||
twittertweet.badgeCategory = 'social'; | ||
twittertweet.badgeScript = true; | ||
twittertweet.badgeCategory = 'social' | ||
twittertweet.badgeScript = true | ||
/** Twitter Follow Button */ | ||
function twitterfollow(_ref38) { | ||
var twitterUsername = _ref38.twitterUsername; | ||
// Prepare | ||
if (!twitterUsername) throw new Error('twitterUsername is missing'); // Return | ||
return "<a href=\"https://twitter.com/".concat(escape(twitterUsername), "\" class=\"twitter-follow-button\" data-show-count=\"false\">Follow @").concat(twitterUsername, "</a><script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=\"https://platform.twitter.com/widgets.js\";fjs.parentNode.insertBefore(js,fjs);}}(document,\"script\",\"twitter-wjs\");</script>"); | ||
export function twitterfollow({ twitterUsername }) { | ||
// Prepare | ||
if (!twitterUsername) throw new Error('twitterUsername is missing') | ||
// Return | ||
return `<a href="https://twitter.com/${escape( | ||
twitterUsername | ||
)}" class="twitter-follow-button" data-show-count="false">Follow @${twitterUsername}</a><script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="https://platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>` | ||
} | ||
twitterfollow.badgeCategory = 'social'; | ||
twitterfollow.badgeScript = true; | ||
twitterfollow.badgeCategory = 'social' | ||
twitterfollow.badgeScript = true | ||
/** Github Follow Button */ | ||
function githubfollow(_ref39) { | ||
var githubUsername = _ref39.githubUsername; | ||
// Prepare | ||
if (!githubUsername) throw new Error('githubUsername is missing'); // Return | ||
return "<iframe src=\"https://ghbtns.com/github-btn.html?user=".concat(escape(githubUsername), "&type=follow&count=true\" allowtransparency=\"true\" frameborder=\"0\" scrolling=\"0\" width=\"165\" height=\"20\"></iframe>"); | ||
export function githubfollow({ githubUsername }) { | ||
// Prepare | ||
if (!githubUsername) throw new Error('githubUsername is missing') | ||
// Return | ||
return `<iframe src="https://ghbtns.com/github-btn.html?user=${escape( | ||
githubUsername | ||
)}&type=follow&count=true" allowtransparency="true" frameborder="0" scrolling="0" width="165" height="20"></iframe>` | ||
} | ||
githubfollow.badgeCategory = 'social'; | ||
githubfollow.badgeScript = true; | ||
githubfollow.badgeCategory = 'social' | ||
githubfollow.badgeScript = true | ||
/** GitHub Star Button */ | ||
function githubstar(_ref40) { | ||
var githubSlug = _ref40.githubSlug; | ||
// Prepare | ||
if (!githubSlug) throw new Error('githubSlug is missing'); | ||
var split = githubSlug.split('/'); | ||
var githubUsername = split[0]; | ||
var githubRepository = split[1]; | ||
if (!githubUsername || !githubRepository) throw new Error('githubSlug is invalid'); // Return | ||
return "<iframe src=\"https://ghbtns.com/github-btn.html?user=".concat(escape(githubUsername), "&repo=").concat(escape(githubRepository), "&type=watch&count=true\" allowtransparency=\"true\" frameborder=\"0\" scrolling=\"0\" width=\"110\" height=\"20\"></iframe>"); | ||
export function githubstar({ githubSlug }) { | ||
// Prepare | ||
if (!githubSlug) throw new Error('githubSlug is missing') | ||
const split = githubSlug.split('/') | ||
const githubUsername = split[0] | ||
const githubRepository = split[1] | ||
if (!githubUsername || !githubRepository) | ||
throw new Error('githubSlug is invalid') | ||
// Return | ||
return `<iframe src="https://ghbtns.com/github-btn.html?user=${escape( | ||
githubUsername | ||
)}&repo=${escape( | ||
githubRepository | ||
)}&type=watch&count=true" allowtransparency="true" frameborder="0" scrolling="0" width="110" height="20"></iframe>` | ||
} | ||
githubstar.badgeCategory = 'social'; | ||
githubstar.badgeScript = true; | ||
githubstar.badgeCategory = 'social' | ||
githubstar.badgeScript = true | ||
/** Quora Follow Button */ | ||
function quorafollow(_ref41) { | ||
var quoraUsername = _ref41.quoraUsername, | ||
quoraRealname = _ref41.quoraRealname, | ||
quoraCode = _ref41.quoraCode; | ||
// Prepare | ||
if (!quoraUsername) throw new Error('quoraUsername is missing'); | ||
quoraRealname = quoraRealname || quoraUsername.replace(/-/g, ' '); | ||
quoraCode = quoraCode || '7N31XJs'; // Return | ||
return "\n\t\t<span data-name=\"".concat(quoraUsername, "\">\n\t\t\tFollow <a href=\"http://www.quora.com/").concat(quoraUsername, "\">").concat(quoraRealname, "</a> on <a href=\"http://www.quora.com\">Quora</a>\n\t\t\t<script src=\"https://www.quora.com/widgets/follow?embed_code=").concat(escape(quoraCode), "\"></script>\n\t\t</span>").replace(/\n\s*/g, ''); | ||
export function quorafollow({ quoraUsername, quoraRealname, quoraCode }) { | ||
// Prepare | ||
if (!quoraUsername) throw new Error('quoraUsername is missing') | ||
quoraRealname = quoraRealname || quoraUsername.replace(/-/g, ' ') | ||
quoraCode = quoraCode || '7N31XJs' | ||
// Return | ||
return ` | ||
<span data-name="${quoraUsername}"> | ||
Follow <a href="http://www.quora.com/${quoraUsername}">${quoraRealname}</a> on <a href="http://www.quora.com">Quora</a> | ||
<script src="https://www.quora.com/widgets/follow?embed_code=${escape( | ||
quoraCode | ||
)}"></script> | ||
</span>`.replace(/\n\s*/g, '') | ||
} | ||
quorafollow.badgeCategory = 'social'; | ||
quorafollow.badgeScript = true; | ||
quorafollow.badgeCategory = 'social' | ||
quorafollow.badgeScript = true |
@@ -1,22 +0,4 @@ | ||
"use strict"; | ||
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.renderBadge = renderBadge; | ||
exports.renderBadges = renderBadges; | ||
exports.badges = void 0; | ||
var badges = _interopRequireWildcard(require("./badges.js")); | ||
exports.badges = badges; | ||
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; } | ||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } | ||
// Import | ||
import * as badges from './badges.js' | ||
export { badges } | ||
/** | ||
@@ -29,22 +11,18 @@ * Render a specified badge with the appropriate wrapping (div if block badge, span if inline badge) | ||
*/ | ||
function renderBadge(badgeName) { | ||
var config = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; | ||
if (badgeName === '---') { | ||
return '<br class="badge-separator" />'; | ||
} // Fetch | ||
// @ts-ignore | ||
var badgeMethod = badges[badgeName]; // Send the badge value and options to the render method | ||
var badgeResult = badgeMethod(config).trim(); | ||
if (!badgeResult) return ''; // We have a result, so let's wrap it | ||
var elementName = badgeMethod.badgeInline === false ? 'div' : 'span'; | ||
var wrappedResult = "<".concat(elementName, " class=\"badge-").concat(badgeName, "\">").concat(badgeResult, "</").concat(elementName, ">"); // Done | ||
return wrappedResult; | ||
export function renderBadge(badgeName, config = {}) { | ||
if (badgeName === '---') { | ||
return '<br class="badge-separator" />' | ||
} | ||
// Fetch | ||
// @ts-ignore | ||
const badgeMethod = badges[badgeName] | ||
// Send the badge value and options to the render method | ||
const badgeResult = badgeMethod(config).trim() | ||
if (!badgeResult) return '' | ||
// We have a result, so let's wrap it | ||
const elementName = badgeMethod.badgeInline === false ? 'div' : 'span' | ||
const wrappedResult = `<${elementName} class="badge-${badgeName}">${badgeResult}</${elementName}>` | ||
// Done | ||
return wrappedResult | ||
} | ||
/** | ||
@@ -57,47 +35,49 @@ * Render specified badges with wrapping | ||
*/ | ||
function renderBadges(list) { | ||
var config = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; | ||
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : { | ||
filterCategory: false, | ||
filterScripts: true | ||
}; | ||
// Prepare | ||
var results = []; // Render the badges | ||
list.forEach(function (badgeName) { | ||
var badgeConfig = config; // Custom Config? | ||
if (Array.isArray(badgeName)) { | ||
badgeConfig = badgeName[1]; | ||
badgeName = badgeName[0]; | ||
} // Seperator? | ||
if (badgeName === '---') { | ||
// Do not render seperators if we only wanted a single category | ||
if (options.filterCategory) return; | ||
} // Exists? | ||
else { | ||
// @ts-ignore | ||
var badge = badges[badgeName]; | ||
if (badge) { | ||
// Category? | ||
if (options.filterCategory && options.filterCategory !== badge.badgeCategory) return; // Script? | ||
if (options.filterScripts && badge.badgeScript) return; | ||
} // Doesn't exist | ||
else { | ||
throw new Error("the badge ".concat(badgeName, " does not exist")); | ||
} | ||
} // Render | ||
var badgeResult = renderBadge(badgeName, badgeConfig).trim(); | ||
if (!badgeResult) return; // Rendered successfully, add the result | ||
results.push(badgeResult); | ||
}); // Return | ||
return results.join('\n'); | ||
} | ||
export function renderBadges( | ||
list, | ||
config = {}, | ||
options = { filterCategory: false, filterScripts: true } | ||
) { | ||
// Prepare | ||
const results = [] | ||
// Render the badges | ||
list.forEach(function (badgeName) { | ||
let badgeConfig = config | ||
// Custom Config? | ||
if (Array.isArray(badgeName)) { | ||
badgeConfig = badgeName[1] | ||
badgeName = badgeName[0] | ||
} | ||
// Seperator? | ||
if (badgeName === '---') { | ||
// Do not render seperators if we only wanted a single category | ||
if (options.filterCategory) return | ||
} | ||
// Exists? | ||
else { | ||
// @ts-ignore | ||
const badge = badges[badgeName] | ||
if (badge) { | ||
// Category? | ||
if ( | ||
options.filterCategory && | ||
options.filterCategory !== badge.badgeCategory | ||
) | ||
return | ||
// Script? | ||
if (options.filterScripts && badge.badgeScript) return | ||
} | ||
// Doesn't exist | ||
else { | ||
throw new Error(`the badge ${badgeName} does not exist`) | ||
} | ||
} | ||
// Render | ||
const badgeResult = renderBadge(badgeName, badgeConfig).trim() | ||
if (!badgeResult) return | ||
// Rendered successfully, add the result | ||
results.push(badgeResult) | ||
}) | ||
// Return | ||
return results.join('\n') | ||
} |
# History | ||
## v4.0.0 2020 March 26 | ||
- Updated dependencies, [base files](https://github.com/bevry/base), and [editions](https://editions.bevry.me) using [boundation](https://github.com/bevry/boundation) | ||
- Minimum required node version changed from `node: >=8` to `node: >=10` to keep up with mandatory ecosystem changes | ||
## v3.1.0 2019 December 9 | ||
@@ -4,0 +9,0 @@ |
221
package.json
{ | ||
"name": "badges", | ||
"version": "3.1.0", | ||
"version": "4.0.0-next.1585173540.e02ebab0f4ee6d0f7d4d059b0262d71412f5f965", | ||
"description": "The definitive collection of badges for rendering", | ||
@@ -8,67 +8,72 @@ "homepage": "https://github.com/bevry/badges", | ||
"keywords": [ | ||
"+1", | ||
"60devs", | ||
"badge", | ||
"badges", | ||
"badge", | ||
"shields", | ||
"shields.io", | ||
"saucelabs", | ||
"sauce labs", | ||
"travis", | ||
"travisci", | ||
"travis ci", | ||
"npm", | ||
"npm version", | ||
"npm downloads", | ||
"nodeico", | ||
"waffle", | ||
"waffle.io", | ||
"bitcoin", | ||
"boost lab", | ||
"boostlab", | ||
"browser", | ||
"buy me a coffee", | ||
"buymeacoffee", | ||
"coveralls", | ||
"coveralls.io", | ||
"crypto", | ||
"david", | ||
"david dm", | ||
"60devs", | ||
"sixtydevs", | ||
"patreon", | ||
"gratipay", | ||
"flattr", | ||
"paypal", | ||
"bitcoin", | ||
"crypto", | ||
"liberapay", | ||
"buymeacoffee", | ||
"buy me a coffee", | ||
"boostlab", | ||
"boost lab", | ||
"thanksapp", | ||
"give thanks", | ||
"thanks app", | ||
"wishlist", | ||
"slack", | ||
"slackin", | ||
"google+", | ||
"google plus", | ||
"reddit", | ||
"hacker news", | ||
"donate", | ||
"donation", | ||
"facebook", | ||
"facebook follow", | ||
"facebook like", | ||
"facebook follow", | ||
"twitter", | ||
"twitter follow", | ||
"flattr", | ||
"follow", | ||
"github", | ||
"github follow", | ||
"github sponsors", | ||
"github follow", | ||
"github star", | ||
"give thanks", | ||
"google plus", | ||
"google+", | ||
"gratipay", | ||
"hacker news", | ||
"liberapay", | ||
"like", | ||
"module", | ||
"nodeico", | ||
"npm", | ||
"npm downloads", | ||
"npm version", | ||
"open collective", | ||
"opencollective", | ||
"patreon", | ||
"paypal", | ||
"plus one", | ||
"quora", | ||
"quora follow", | ||
"tweet", | ||
"like", | ||
"follow", | ||
"plus one", | ||
"+1", | ||
"donate", | ||
"donation", | ||
"reddit", | ||
"sauce labs", | ||
"saucelabs", | ||
"shields", | ||
"shields.io", | ||
"sixtydevs", | ||
"slack", | ||
"slackin", | ||
"star", | ||
"thanks app", | ||
"thanksapp", | ||
"tip", | ||
"tips", | ||
"star", | ||
"opencollective", | ||
"open collective" | ||
"travis", | ||
"travis ci", | ||
"travisci", | ||
"tweet", | ||
"twitter", | ||
"twitter follow", | ||
"typed", | ||
"types", | ||
"typescript", | ||
"waffle", | ||
"waffle.io", | ||
"wishlist" | ||
], | ||
@@ -113,4 +118,3 @@ "badges": { | ||
"Benjamin Lupton <b@lupton.cc> (http://balupton.com)", | ||
"Richard Walker <digitalsadhu@gmail.com> (https://github.com/digitalsadhu)", | ||
"dependabot-preview[bot] (http://github.com/apps/dependabot-preview)" | ||
"Richard Walker <digitalsadhu@gmail.com> (https://github.com/digitalsadhu)" | ||
], | ||
@@ -125,7 +129,7 @@ "bugs": { | ||
"engines": { | ||
"node": ">=8" | ||
"node": ">=10" | ||
}, | ||
"editions": [ | ||
{ | ||
"description": "typescript source code with import for modules", | ||
"description": "TypeScript source code with Import for modules", | ||
"directory": "source", | ||
@@ -140,3 +144,3 @@ "entry": "index.ts", | ||
{ | ||
"description": "typescript compiled for browsers with import for modules", | ||
"description": "TypeScript compiled against ESNext for web browsers with Import for modules", | ||
"directory": "edition-browsers", | ||
@@ -154,11 +158,12 @@ "entry": "index.js", | ||
{ | ||
"description": "typescript compiled for node.js 12 with require for modules", | ||
"directory": "edition-node-12", | ||
"description": "TypeScript compiled against ESNext for Node.js with Require for modules", | ||
"directory": "edition-esnext", | ||
"entry": "index.js", | ||
"tags": [ | ||
"javascript", | ||
"esnext", | ||
"require" | ||
], | ||
"engines": { | ||
"node": "8 || 10 || 12", | ||
"node": "10 || 12", | ||
"browsers": false | ||
@@ -170,34 +175,27 @@ } | ||
"type": "commonjs", | ||
"main": "edition-node-12/index.js", | ||
"main": "edition-esnext/index.js", | ||
"browser": "edition-browsers/index.js", | ||
"module": "edition-browsers/index.js", | ||
"devDependencies": { | ||
"@babel/cli": "^7.7.5", | ||
"@babel/core": "^7.7.5", | ||
"@babel/plugin-proposal-class-properties": "^7.7.4", | ||
"@babel/plugin-proposal-object-rest-spread": "^7.7.4", | ||
"@babel/plugin-proposal-optional-chaining": "^7.7.5", | ||
"@babel/preset-env": "^7.7.6", | ||
"@babel/preset-typescript": "^7.7.4", | ||
"@typescript-eslint/eslint-plugin": "^2.10.0", | ||
"@typescript-eslint/parser": "^2.10.0", | ||
"assert-helpers": "^5.7.0", | ||
"babel-plugin-add-module-exports": "^1.0.2", | ||
"eslint": "^6.7.2", | ||
"eslint-config-bevry": "^2.2.0", | ||
"eslint-config-prettier": "^6.7.0", | ||
"eslint-plugin-prettier": "^3.1.1", | ||
"kava": "^4.3.0", | ||
"prettier": "^1.19.1", | ||
"projectz": "^1.15.0", | ||
"@typescript-eslint/eslint-plugin": "^2.25.0", | ||
"@typescript-eslint/parser": "^2.25.0", | ||
"assert-helpers": "^5.8.0", | ||
"eslint": "^6.8.0", | ||
"eslint-config-bevry": "^2.3.0", | ||
"eslint-config-prettier": "^6.10.1", | ||
"eslint-plugin-prettier": "^3.1.2", | ||
"kava": "^4.4.0", | ||
"prettier": "^2.0.2", | ||
"projectz": "^1.19.0", | ||
"surge": "^0.21.3", | ||
"typedoc": "^0.15.4", | ||
"typescript": "^3.7.3", | ||
"valid-directory": "^1.5.0" | ||
"typedoc": "^0.17.3", | ||
"typescript": "^3.8.3", | ||
"valid-directory": "^1.6.0", | ||
"valid-module": "^1.0.0" | ||
}, | ||
"scripts": { | ||
"our:clean": "rm -Rf ./docs ./edition* ./es2015 ./es5 ./out ./.next", | ||
"our:compile": "npm run our:compile:edition-browsers && npm run our:compile:edition-node-12", | ||
"our:compile:edition-browsers": "env BABEL_ENV=edition-browsers babel --extensions \".ts,.tsx\" --out-dir ./edition-browsers ./source", | ||
"our:compile:edition-node-12": "env BABEL_ENV=edition-node-12 babel --extensions \".ts,.tsx\" --out-dir ./edition-node-12 ./source", | ||
"our:compile": "npm run our:compile:edition-browsers && npm run our:compile:edition-esnext", | ||
"our:compile:edition-browsers": "tsc --module ESNext --target ESNext --outDir ./edition-browsers --project tsconfig.json && test -d edition-browsers/source && ( mv edition-browsers/source edition-temp && rm -Rf edition-browsers && mv edition-temp edition-browsers ) || true", | ||
"our:compile:edition-esnext": "tsc --module commonjs --target ESNext --outDir ./edition-esnext --project tsconfig.json && test -d edition-esnext/source && ( mv edition-esnext/source edition-temp && rm -Rf edition-esnext && mv edition-temp edition-esnext ) || true", | ||
"our:deploy": "echo no need for this project", | ||
@@ -217,8 +215,9 @@ "our:meta": "npm run our:meta:docs && npm run our:meta:projectz", | ||
"our:test": "npm run our:verify && npm test", | ||
"our:verify": "npm run our:verify:directory && npm run our:verify:eslint && npm run our:verify:prettier && npm run our:verify:typescript", | ||
"our:verify:directory": "npx valid-directory", | ||
"our:verify": "npm run our:verify:directory && npm run our:verify:eslint && npm run our:verify:module && npm run our:verify:prettier && npm run our:verify:typescript", | ||
"our:verify:directory": "valid-directory", | ||
"our:verify:eslint": "eslint --fix --ignore-pattern '**/*.d.ts' --ignore-pattern '**/vendor/' --ignore-pattern '**/node_modules/' --ext .mjs,.js,.jsx,.ts,.tsx ./source", | ||
"our:verify:prettier": "prettier --write ./source/**", | ||
"our:verify:module": "valid-module", | ||
"our:verify:prettier": "prettier --write .", | ||
"our:verify:typescript": "tsc --noEmit --project tsconfig.json", | ||
"test": "node ./edition-node-12/test.js" | ||
"test": "node ./edition-esnext/test.js" | ||
}, | ||
@@ -233,47 +232,3 @@ "eslintConfig": { | ||
"singleQuote": true | ||
}, | ||
"babel": { | ||
"env": { | ||
"edition-browsers": { | ||
"sourceType": "module", | ||
"presets": [ | ||
[ | ||
"@babel/preset-env", | ||
{ | ||
"targets": "defaults", | ||
"modules": "commonjs" | ||
} | ||
], | ||
"@babel/preset-typescript" | ||
], | ||
"plugins": [ | ||
"@babel/proposal-object-rest-spread", | ||
"@babel/plugin-proposal-optional-chaining", | ||
"@babel/proposal-class-properties", | ||
"add-module-exports" | ||
] | ||
}, | ||
"edition-node-12": { | ||
"sourceType": "module", | ||
"presets": [ | ||
[ | ||
"@babel/preset-env", | ||
{ | ||
"targets": { | ||
"node": "12" | ||
}, | ||
"modules": "commonjs" | ||
} | ||
], | ||
"@babel/preset-typescript" | ||
], | ||
"plugins": [ | ||
"@babel/proposal-object-rest-spread", | ||
"@babel/plugin-proposal-optional-chaining", | ||
"@babel/proposal-class-properties", | ||
"add-module-exports" | ||
] | ||
} | ||
} | ||
} | ||
} |
108
README.md
@@ -36,35 +36,9 @@ <!-- TITLE/ --> | ||
<!-- INSTALL/ --> | ||
## Usage | ||
<h2>Install</h2> | ||
[Complete API Documentation.](http://master.badges.bevry.surge.sh/docs/globals.html) | ||
<a href="https://npmjs.com" title="npm is a package manager for javascript"><h3>npm</h3></a> | ||
<ul> | ||
<li>Install: <code>npm install --save badges</code></li> | ||
<li>Require: <code>require('badges')</code></li> | ||
</ul> | ||
```javascript | ||
import { renderBadges } from 'badges' | ||
<a href="https://jspm.io" title="Native ES Modules CDN"><h3>jspm</h3></a> | ||
``` html | ||
<script type="module"> | ||
import * as pkg from '//dev.jspm.io/badges' | ||
</script> | ||
``` | ||
<h3><a href="https://editions.bevry.me" title="Editions are the best way to produce and consume packages you care about.">Editions</a></h3> | ||
<p>This package is published with the following editions:</p> | ||
<ul><li><code>badges/source/index.ts</code> is typescript source code with import for modules</li> | ||
<li><code>badges/edition-browsers/index.js</code> is typescript compiled for browsers with import for modules</li> | ||
<li><code>badges</code> aliases <code>badges/edition-node-12/index.js</code></li> | ||
<li><code>badges/edition-node-12/index.js</code> is typescript compiled for node.js 12 with require for modules</li></ul> | ||
<!-- /INSTALL --> | ||
## Usage | ||
```javascript | ||
// Listing of badges to output | ||
@@ -77,3 +51,9 @@ const list = [ | ||
'shields', | ||
{ left: 'left', right: 'right', alt: 'alt', url: 'url', title: 'title' } | ||
{ | ||
left: 'left', | ||
right: 'right', | ||
alt: 'alt', | ||
url: 'url', | ||
title: 'title', | ||
}, | ||
], | ||
@@ -88,4 +68,4 @@ [ | ||
url: 'url', | ||
title: 'title' | ||
} | ||
title: 'title', | ||
}, | ||
], | ||
@@ -133,3 +113,3 @@ '---', | ||
'githubstar', | ||
'quorafollow' | ||
'quorafollow', | ||
] | ||
@@ -167,3 +147,3 @@ | ||
quoraUsername: 'Benjamin-Lupton', | ||
quoraRealname: 'Benjamin Arthur Lupton' // optional, will extract from username | ||
quoraRealname: 'Benjamin Arthur Lupton', // optional, will extract from username | ||
} | ||
@@ -181,7 +161,7 @@ | ||
// When true, do not render any badges from the list that are scripts | ||
filterScripts: false | ||
filterScripts: false, | ||
} | ||
// Render the badges to a string | ||
const result = require('badges').renderBadges(list, config, options) | ||
const result = renderBadges(list, config, options) | ||
@@ -196,2 +176,49 @@ // Output the result | ||
<!-- INSTALL/ --> | ||
<h2>Install</h2> | ||
<a href="https://npmjs.com" title="npm is a package manager for javascript"><h3>npm</h3></a> | ||
<ul> | ||
<li>Install: <code>npm install --save badges</code></li> | ||
<li>Import: <code>import * as pkg from ('badges')</code></li> | ||
<li>Require: <code>const pkg = require('badges')</code></li> | ||
</ul> | ||
<a href="https://www.pika.dev/cdn" title="100% Native ES Modules CDN"><h3>pika</h3></a> | ||
``` html | ||
<script type="module"> | ||
import * as pkg from '//cdn.pika.dev/badges/^4.0.0' | ||
</script> | ||
``` | ||
<a href="https://unpkg.com" title="unpkg is a fast, global content delivery network for everything on npm"><h3>unpkg</h3></a> | ||
``` html | ||
<script type="module"> | ||
import * as pkg from '//unpkg.com/badges@^4.0.0' | ||
</script> | ||
``` | ||
<a href="https://jspm.io" title="Native ES Modules CDN"><h3>jspm</h3></a> | ||
``` html | ||
<script type="module"> | ||
import * as pkg from '//dev.jspm.io/badges@4.0.0' | ||
</script> | ||
``` | ||
<h3><a href="https://editions.bevry.me" title="Editions are the best way to produce and consume packages you care about.">Editions</a></h3> | ||
<p>This package is published with the following editions:</p> | ||
<ul><li><code>badges/source/index.ts</code> is <a href="https://www.typescriptlang.org/" title="TypeScript is a typed superset of JavaScript that compiles to plain JavaScript. ">TypeScript</a> source code with <a href="https://babeljs.io/docs/learn-es2015/#modules" title="ECMAScript Modules">Import</a> for modules</li> | ||
<li><code>badges/edition-browsers/index.js</code> is <a href="https://www.typescriptlang.org/" title="TypeScript is a typed superset of JavaScript that compiles to plain JavaScript. ">TypeScript</a> compiled against <a href="https://en.wikipedia.org/wiki/ECMAScript#ES.Next" title="ECMAScript Next">ESNext</a> for web browsers with <a href="https://babeljs.io/docs/learn-es2015/#modules" title="ECMAScript Modules">Import</a> for modules</li> | ||
<li><code>badges</code> aliases <code>badges/edition-esnext/index.js</code></li> | ||
<li><code>badges/edition-esnext/index.js</code> is <a href="https://www.typescriptlang.org/" title="TypeScript is a typed superset of JavaScript that compiles to plain JavaScript. ">TypeScript</a> compiled against <a href="https://en.wikipedia.org/wiki/ECMAScript#ES.Next" title="ECMAScript Next">ESNext</a> for <a href="https://nodejs.org" title="Node.js is a JavaScript runtime built on Chrome's V8 JavaScript engine">Node.js</a> with <a href="https://nodejs.org/dist/latest-v5.x/docs/api/modules.html" title="Node/CJS Modules">Require</a> for modules</li></ul> | ||
<!-- /INSTALL --> | ||
<!-- HISTORY/ --> | ||
@@ -236,3 +263,3 @@ | ||
<ul><li><a href="http://balupton.com">Benjamin Lupton</a> — <a href="https://github.com/bevry/badges/commits?author=balupton" title="View the GitHub contributions of Benjamin Lupton on repository bevry/badges">view contributions</a></li></ul> | ||
<ul><li><a href="http://balupton.com">Benjamin Lupton</a></li></ul> | ||
@@ -257,5 +284,4 @@ <h3>Sponsors</h3> | ||
<ul><li><a href="http://balupton.com">Benjamin Lupton</a> — <a href="https://github.com/bevry/badges/commits?author=balupton" title="View the GitHub contributions of Benjamin Lupton on repository bevry/badges">view contributions</a></li> | ||
<li><a href="https://github.com/digitalsadhu">Richard Walker</a> — <a href="https://github.com/bevry/badges/commits?author=digitalsadhu" title="View the GitHub contributions of Richard Walker on repository bevry/badges">view contributions</a></li> | ||
<li><a href="http://github.com/apps/dependabot-preview">dependabot-preview[bot]</a> — <a href="https://github.com/bevry/badges/commits?author=dependabot-preview[bot]" title="View the GitHub contributions of dependabot-preview[bot] on repository bevry/badges">view contributions</a></li></ul> | ||
<ul><li><a href="http://balupton.com">Benjamin Lupton</a></li> | ||
<li><a href="https://github.com/digitalsadhu">Richard Walker</a> — <a href="https://github.com/bevry/badges/commits?author=digitalsadhu" title="View the GitHub contributions of Richard Walker on repository bevry/badges">view contributions</a></li></ul> | ||
@@ -262,0 +288,0 @@ <a href="https://github.com/bevry/badges/blob/master/CONTRIBUTING.md#files">Discover how you can contribute by heading on over to the <code>CONTRIBUTING.md</code> file.</a> |
@@ -83,3 +83,3 @@ // Import | ||
url, | ||
title | ||
title, | ||
}: shieldsOptions): string { | ||
@@ -168,3 +168,3 @@ // Check | ||
npmPackageName, | ||
nodeicoQueryString | ||
nodeicoQueryString, | ||
}: nodeicoOptions): string { | ||
@@ -207,3 +207,3 @@ // Prepare | ||
saucelabsUsername, | ||
saucelabsAuthToken | ||
saucelabsAuthToken, | ||
}: saucelabsOptions): string { | ||
@@ -230,3 +230,3 @@ // Check | ||
saucelabsUsername, | ||
saucelabsAuthToken | ||
saucelabsAuthToken, | ||
}: saucelabsOptions): string { | ||
@@ -256,3 +256,3 @@ // Check | ||
githubSlug, | ||
travisTLD = 'org' | ||
travisTLD = 'org', | ||
}: travisOptions): string { | ||
@@ -267,5 +267,5 @@ // Check | ||
githubSlug, | ||
'master.svg' | ||
'master.svg', | ||
] | ||
.filter(i => Boolean(i)) | ||
.filter((i) => Boolean(i)) | ||
.join('/') | ||
@@ -288,3 +288,3 @@ const url = `http://travis-ci.${travisTLD}/${githubSlug}` | ||
codeshipProjectUUID, | ||
codeshipProjectID | ||
codeshipProjectID, | ||
}: codeshipOptions): string { | ||
@@ -377,3 +377,3 @@ // Check | ||
sixtydevstipsID, | ||
sixtydevstipsURL | ||
sixtydevstipsURL, | ||
}: sixtydevOptions): string { | ||
@@ -408,3 +408,3 @@ // Check | ||
githubSponsorsUsername, | ||
githubUsername | ||
githubUsername, | ||
}: githubsponsorsOptions): string { | ||
@@ -414,4 +414,5 @@ if (!githubSponsorsURL) { | ||
throw new Error('githubSponsorsUsername and githubUsername are missing') | ||
githubSponsorsURL = `https://github.com/sponsors/${githubSponsorsUsername || | ||
githubUsername}` | ||
githubSponsorsURL = `https://github.com/sponsors/${ | ||
githubSponsorsUsername || githubUsername | ||
}` | ||
} | ||
@@ -438,3 +439,3 @@ | ||
patreonUsername, | ||
patreonURL | ||
patreonURL, | ||
}: patreonOptions): string { | ||
@@ -466,3 +467,3 @@ // Check | ||
opencollectiveUsername, | ||
opencollectiveURL | ||
opencollectiveURL, | ||
}: opencollectiveOptions): string { | ||
@@ -496,3 +497,3 @@ // Check | ||
gratipayUsername, | ||
gratipayURL | ||
gratipayURL, | ||
}: gratipayOptions): string { | ||
@@ -527,3 +528,3 @@ // Check | ||
flattrUsername, | ||
flattrURL | ||
flattrURL, | ||
}: flattrOptions): string { | ||
@@ -564,3 +565,3 @@ // Check | ||
paypalButtonID, | ||
paypalUsername | ||
paypalUsername, | ||
}: paypalOptions): string { | ||
@@ -647,3 +648,3 @@ // Check | ||
buymeacoffeeUsername, | ||
buymeacoffeeURL | ||
buymeacoffeeURL, | ||
}: buymeacoffeeOptions): string { | ||
@@ -678,3 +679,3 @@ // Check | ||
liberapayUsername, | ||
liberapayURL | ||
liberapayURL, | ||
}: liberapayOptions): string { | ||
@@ -713,3 +714,3 @@ // Check | ||
thanksappUsername, | ||
thanksappURL | ||
thanksappURL, | ||
}: thanksappOptions): string { | ||
@@ -798,3 +799,3 @@ // Check | ||
gaTrackingID, | ||
githubSlug | ||
githubSlug, | ||
}: gabeaconOptions): string { | ||
@@ -854,3 +855,3 @@ // Check | ||
homepage, | ||
facebookApplicationID | ||
facebookApplicationID, | ||
}: facebooklikeOptions): string { | ||
@@ -883,3 +884,3 @@ // Prepare | ||
facebookUsername, | ||
facebookApplicationID | ||
facebookApplicationID, | ||
}: facebookfollowOptions): string { | ||
@@ -929,3 +930,3 @@ // Prepare | ||
export function githubfollow({ | ||
githubUsername | ||
githubUsername, | ||
}: githubUsernameOptions): string { | ||
@@ -975,3 +976,3 @@ // Prepare | ||
quoraRealname, | ||
quoraCode | ||
quoraCode, | ||
}: quoraOptions): string { | ||
@@ -978,0 +979,0 @@ // Prepare |
@@ -60,3 +60,3 @@ // Import | ||
// Render the badges | ||
list.forEach(function(badgeName) { | ||
list.forEach(function (badgeName) { | ||
let badgeConfig = config | ||
@@ -63,0 +63,0 @@ |
@@ -8,9 +8,6 @@ { | ||
"moduleResolution": "node", | ||
"noEmit": true, | ||
"strict": true, | ||
"target": "esnext" | ||
}, | ||
"include": [ | ||
"source" | ||
] | ||
"include": ["source"] | ||
} |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
15
297
115909
12
2433
1
1