diff --git a/CHANGELOG.md b/CHANGELOG.md
index d859182..f6803e6 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,14 @@
+# v1.1.0 (May 16, 2020)
+* Support: fury.io
+* Support: snyk.io
+* Support: badgen.net
+* Fix: Replace "space" with `%20`
+* Fix: Replace `-` with `--`
+* Feature: `custom` attribute. Now you can set any badge string on image url of badge services.
+
+[](https://www.paypal.me/ptkdev) [](https://www.patreon.com/ptkdev) [](https://github.com/sponsors/ptkdev/) [](https://ko-fi.com/ptkdev)
+
+
# v1.0.1 (May 16, 2020)
* Docs: 🔑 Liquid variables
diff --git a/README.md b/README.md
index cc09a23..bd95316 100755
--- a/README.md
+++ b/README.md
@@ -1,10 +1,10 @@
-[](https://www.npmjs.com/package/@ptkdev/all-shields-cli)
+[](https://www.npmjs.com/package/@ptkdev/all-shields-cli)
-# 🦌 Badge generator of shields.io from .all-shieldsrc dotfile
+# 🦌 Badges generator from dotfiles for any markdown
-[](https://github.com/ptkdev/all-shields-cli/releases) [](https://www.npmjs.com/package/@ptkdev/all-shields-cli) [](https://github.com/ptkdev/all-shields-cli/blob/master/LICENSE.md) [](https://wikipedia.org/wiki/ECMAScript) [](https://snyk.io/test/github/ptkdev/all-shields-cli) [](http://discord.ptkdev.io)
+[](https://github.com/ptkdev/all-shields-cli/releases) [](https://www.npmjs.com/package/@ptkdev/all-shields-cli) [](https://github.com/ptkdev/all-shields-cli/blob/master/LICENSE.md) [](https://wikipedia.org/wiki/ECMAScript) [](https://snyk.io/test/github/ptkdev/all-shields-cli) [](http://discord.ptkdev.io)
-Tool to help automate your badges of shields.io from a dotfile for your markdown files. You can use Liquid variables like `{{name}}` or `{{version}}` which refer to your `package.json`. Inspired by [all-contributors-cli](https://www.npmjs.com/package/all-contributors-cli)
+Tool to help automate your badges of shields.io, badgen.net, fury.io and snyk.io from `.all-shieldsrc` dotfile for your markdown files. You can use Liquid variables like `{{name}}` or `{{version}}` which refer to your `package.json`. Inspired by [all-contributors-cli](https://www.npmjs.com/package/all-contributors-cli)
## 🎁 Support: Donate
> This project is **free**, **open source** and I try to provide excellent **free support**. Why donate? I work on this project several hours in my spare time and try to keep it up to date and working. **THANK YOU!**
@@ -30,10 +30,17 @@ Tool to help automate your badges of shields.io from a dotfile for your markdown
## 💡 Features
* [✔️] Easy to use
* [✔️] MIT License
-* [✔️] Tool to help automate your badges of shields.io from a dotfile for your markdown files. Inspired by all-contributors-cli
+* [✔️] Support: shields.io
+* [✔️] Support: fury.io
+* [✔️] Support: snyk.io
+* [✔️] Support: badgen.net
+* [✔️] Full customizations!
+* [✔️] Liquid Variables
+* [✔️] Tool to help automate your badges on markdown.
+* [✔️] Badges generator from dotfiles for any markdown
## 👔 Screenshot
-[](https://raw.githubusercontent.com/ptkdev/all-shields-cli/nightly/.github/assets/screenshot/ptkdev-all-shields-cli-screen1.png)
+[](https://raw.githubusercontent.com/ptkdev/all-shields-cli/nightly/.github/assets/screenshot/ptkdev-all-shields-cli-screen1.png)
## 🚀 Installation
1. In your node project run: `npm install @ptkdev/all-shields-cli --save-dev`
@@ -62,7 +69,8 @@ Tool to help automate your badges of shields.io from a dotfile for your markdown
"title": "package name",
"message": "{{name}}",
"style": "flat",
- "logo": ""
+ "logo": "",
+ "platform": "shields"
}
]
}
@@ -98,17 +106,18 @@ In your `.all-shieldsrc` dotfile you can use liquid variables like {{name}} or {
## 🧰 Options: Badges Array
-| Parameter | Description | Values | Default value | Available since |
-| --- | --- | --- | --- | --- |
-| url | If you click on badge open this url | `string` | empty | **v1.0.0** |
-| color | Badge hexcode color (right side) | `string` / `hexcode` | `lightgray` | **v1.0.0** |
-| label | Badge text (left side) | `string` | empty | **v1.0.0** |
-| title | Mouse hover alt text | `string` | empty | **v1.0.0** |
-| message | Badge text (right side) | `string` | empty | **v1.0.0** |
-| style | Look of badge | `plastic` / `flat` / `flat-square` / `for-the-badge` / `social` | `flat` | **v1.0.0** |
-| logo | Show logo (left side) | `bitcoin` / `dependabot` / `discord` / `gitlab` / `npm` / `paypal` / `serverfault` / `stackexchange` / `superuser` / `telegram` / `travis` | empty | **v1.0.0** |
-| platform | Switch platform | `discord` / `shields` | `shields` | **v1.0.0** |
-| server_id | if platform is discord, set your discord server_id | `DISCORD_SERVER_ID` | empty | **v1.0.0** |
+| Parameter | Description | Values | Default value | Available on platforms | Available since |
+| --- | --- | --- | --- | --- | --- |
+| platform | Define platform | `discord` / `shields` / `fury` / `snyk` / `badgen` | `shields` | | **v1.0.0** |
+| custom | Set custom string of image url (appended after domain url of badge service) | `string` | empty | `discord`, `shields`, `fury`, `snyk`, `badgen` | **v1.1.0** |
+| url | If you click on badge open this url | `URI` | empty | `discord`, `shields`, `fury`, `snyk`, `badgen` | **v1.0.0** |
+| color | Badge hexcode color (right side). NOTE: Overwrited if `custom` is set. | `string` / `hexcode` | `lightgray` | `shields`, `badgen` | **v1.0.0** |
+| label | Badge text (left side). NOTE: Overwrited if `custom` is set. | `string` | empty | `shields`, `badgen` | **v1.0.0** |
+| title | Mouse hover alt text | `string` | empty | `discord`, `shields`, `fury`, `snyk`, `badgen` | **v1.0.0** |
+| message | Badge text (right side). NOTE: Overwrited if `custom` is set. | `string` | empty | `discord`, `shields`, `fury`, `snyk`, `badgen` | **v1.0.0** |
+| style | Look of badge. NOTE: Overwrited if `custom` is set. | `plastic` / `flat` / `flat-square` / `for-the-badge` / `social` | `flat` | `shields` | **v1.0.0** |
+| logo | Show logo (left side). NOTE: Overwrited if `custom` is set. | shields: `bitcoin` , `dependabot` , `discord` , `gitlab` , `npm` , `paypal` , `serverfault` , `stackexchange` , `superuser` , `telegram` , `travis` and more on [docs](https://shields.io/).
badgen: `airbnb`, `apple`, `appveyor`, `atom`, `awesome`, `azure`, `azurepipelines`, `bitcoin`, `buymeacoffee`, `chrome`, `circleci`, `cocoapods`, `codacy`, `codebeat`, `codeclimate`, `codecov`, `codeship`, `commonwl`, `deepscan`, `dependabot`, `discord`, `dockbit`, `docker`, `eclipse`, `firefox`, `flow`, `git`, `github`, `gitlab`, `gitter`, `googleplay`, `graphql`, `haskell`, `jsdelivr` and more on [docs](https://badgen.net/) | empty | `shields`, `badgen` | **v1.0.0** |
+| server_id | if platform is discord, set your discord server_id | `DISCORD_SERVER_ID` | empty | `discord` | **v1.0.0** |
## 🔨 Developer Mode
1. Download [stable](https://github.com/ptkdev/all-shields-cli/archive/master.zip), [beta](https://github.com/ptkdev/all-shields-cli/archive/beta.zip) or [nightly](https://github.com/ptkdev/all-shields-cli/archive/nightly.zip) and extract it.
diff --git a/cli/generate.js b/cli/generate.js
index 709f12d..28bff59 100755
--- a/cli/generate.js
+++ b/cli/generate.js
@@ -2,7 +2,7 @@
/**
* CLI: all-shields-cli
* =====================
- * Tool to help automate your badges of shields.io from a dotfile for your markdown files
+ * Tool to help automate your badges from dotfiles for your markdown.
*
* @contributors: Patryk Rzucidło [@ptkdev] (https://ptk.dev)
*
@@ -36,8 +36,9 @@ for (let j = 0; j < json.files.length; j++) {
for (let i = 0; i < json.shields[z].badges.length; i++) {
let badge = {
+ "custom": json.shields[z].badges[i].custom === undefined || json.shields[z].badges[i].custom === null ? "" : json.shields[z].badges[i].custom,
"url": json.shields[z].badges[i].url === undefined || json.shields[z].badges[i].url === null ? "" : json.shields[z].badges[i].url,
- "color": json.shields[z].badges[i].color === undefined || json.shields[z].badges[i].color === null ? "" : json.shields[z].badges[i].color,
+ "color": json.shields[z].badges[i].color === undefined || json.shields[z].badges[i].color === null ? "lightgray" : json.shields[z].badges[i].color,
"label": json.shields[z].badges[i].label === undefined || json.shields[z].badges[i].label === null ? "" : json.shields[z].badges[i].label,
"title": json.shields[z].badges[i].title === undefined || json.shields[z].badges[i].title === null ? "" : json.shields[z].badges[i].title,
"message": json.shields[z].badges[i].message === undefined || json.shields[z].badges[i].message === null ? "" : json.shields[z].badges[i].message,
@@ -49,10 +50,40 @@ for (let j = 0; j < json.files.length; j++) {
switch (badge.platform) {
case "discord":
- replacement = `${replacement}[](${badge.url}) `;
+ if (badge.custom !== "") {
+ replacement = `${replacement}[](${badge.url}) `;
+ } else {
+ replacement = `${replacement}[](${badge.url}) `;
+ }
+ break;
+ case "fury":
+ if (badge.custom !== "") {
+ replacement = `${replacement}[](${badge.url}) `;
+ } else {
+ replacement = `${replacement}[, "%20").replace(new RegExp("-", "g"), "--")}.svg)](${badge.url}) `;
+ }
+ break;
+ case "snyk":
+ if (badge.custom !== "") {
+ replacement = `${replacement}[](${badge.url}) `;
+ } else {
+ replacement = `${replacement}[, "%20").replace(new RegExp("-", "g"), "--")}.svg)](${badge.url}) `;
+ }
+ break;
+ case "badgen":
+ if (badge.custom !== "") {
+ replacement = `${replacement}[](${badge.url}) `;
+ } else {
+ replacement = `${replacement}[, "%20")}/${badge.message.replace(new RegExp("\\s", "g"), "%20")}/${badge.color.replace("#", "")}/?icon=${badge.logo})](${badge.url}) `;
+ }
break;
default:
- replacement = `${replacement}[}-${badge.message.replace(" ", "%20")}-${badge.color.replace("#", "")}.svg?style=${badge.style}&logo=${badge.logo})](${badge.url}) `;
+ if (badge.custom !== "") {
+ replacement = `${replacement}[](${badge.url}) `;
+ } else {
+ replacement = `${replacement}[, "%20").replace(new RegExp("-", "g"), "--")}-${badge.message.replace(new RegExp("\\s", "g"), "%20").replace(new RegExp("-", "g"), "--")}-${badge.color.replace("#", "")}.svg?style=${badge.style}&logo=${badge.logo})](${badge.url}) `;
+ }
+
}
}
diff --git a/examples/.all-shieldsrc b/examples/.all-shieldsrc
index be4b16d..c672728 100644
--- a/examples/.all-shieldsrc
+++ b/examples/.all-shieldsrc
@@ -1,59 +1,150 @@
{
- "files": [
- "README.md"
- ],
- "shields": [
- {
- "id": "badge-top",
- "badges": [
- {
- "url": "https://www.npmjs.com/package/@ptkdev/all-shields-cli",
- "color": "lightgray",
- "label": "package name",
- "title": "package name",
- "message": "{{name}}",
- "style": "flat",
- "logo": ""
- },
- {
- "url": "https://www.npmjs.com/package/@ptkdev/all-shields-cli",
- "color": "#c0392b",
- "label": "version",
- "title": "npm version",
- "message": "current: {{version}}",
- "style": "flat",
- "logo": "npm"
- },
- {
- "url": "https://discord.ptkdev.io",
- "server_id": "383373985666301975",
- "title": "discord server",
- "platform": "discord"
- }
- ]
- },
- {
- "id": "badge-bottom",
- "badges": [
- {
- "url": "https://www.ptk.dev",
- "color": "#8e44ad",
- "label": "website",
- "title": "my website",
- "message": "ptkdev",
- "style": "plastic",
- "logo": ""
- },
- {
- "url": "https://patreon.com/ptkdev",
- "color": "#f96854",
- "label": "donate",
- "title": "donate on patreon",
- "message": "patreon",
- "style": "plastic",
- "logo": "patreon"
- }
- ]
- }
- ]
+ "files": [
+ "README.md"
+ ],
+ "shields": [
+ {
+ "id": "shields-badge",
+ "badges": [
+ {
+ "url": "https://www.npmjs.com/package/@ptkdev/all-shields-cli",
+ "color": "lightgray",
+ "label": "package name",
+ "title": "package name",
+ "message": "{{name}}",
+ "style": "flat",
+ "logo": "",
+ "platform": "shields"
+ },
+ {
+ "url": "https://www.npmjs.com/package/@ptkdev/all-shields-cli",
+ "color": "#c0392b",
+ "label": "version",
+ "title": "npm version",
+ "message": "current: {{version}}",
+ "style": "flat",
+ "logo": "npm",
+ "platform": "shields"
+ },
+ {
+ "url": "https://www.ptk.dev",
+ "color": "#8e44ad",
+ "label": "website",
+ "title": "my website",
+ "message": "ptkdev",
+ "style": "plastic",
+ "logo": "",
+ "platform": "shields"
+ },
+ {
+ "url": "https://patreon.com/ptkdev",
+ "color": "#f96854",
+ "label": "donate",
+ "title": "donate on patreon",
+ "message": "patreon",
+ "style": "plastic",
+ "logo": "patreon",
+ "platform": "shields"
+ },
+ {
+ "custom": "/github/followers/ptkdev?label=Follow",
+ "platform": "shields"
+ },
+ {
+ "custom": "/npm/v/@ptkdev/all-shields-cli",
+ "platform": "shields"
+ }
+ ]
+ },
+ {
+ "id": "badgen-badge",
+ "badges": [
+ {
+ "url": "https://www.npmjs.com/package/@ptkdev/all-shields-cli",
+ "color": "#ae22cc",
+ "label": "package name",
+ "title": "package name",
+ "message": "{{name}}",
+ "platform": "badgen"
+ },
+ {
+ "url": "https://www.npmjs.com/package/@ptkdev/all-shields-cli",
+ "color": "#c0392b",
+ "label": "version",
+ "title": "npm version",
+ "message": "current: {{version}}",
+ "logo": "npm",
+ "platform": "badgen"
+ },
+ {
+ "url": "https://www.ptk.dev",
+ "color": "#8e44ad",
+ "label": "website",
+ "title": "my website",
+ "message": "ptkdev",
+ "platform": "badgen"
+ },
+ {
+ "url": "https://patreon.com/ptkdev",
+ "color": "#f96854",
+ "label": "donate",
+ "title": "donate on patreon",
+ "message": "patreon",
+ "logo": "patreon",
+ "platform": "badgen"
+ },
+ {
+ "custom": "/github/assets-dl/ptkdev/all-shields-cli",
+ "platform": "badgen"
+ },
+ {
+ "custom": "/github/last-commit/ptkdev/all-shields-cli",
+ "platform": "badgen"
+ },
+ {
+ "custom": "/github/status/micromatch/micromatch/f4809eb6df80b",
+ "platform": "badgen"
+ }
+ ]
+ },
+ {
+ "id": "fury-badge",
+ "badges": [
+ {
+ "url": "https://github.com/ptkdev/all-shields-cli/",
+ "title": "version",
+ "custom": "/js/%40ptkdev%2Flogger.svg",
+ "platform": "fury"
+ },
+ {
+ "url": "https://github.com/ptkdev/all-shields-cli/",
+ "title": "version",
+ "message": "%40ptkdev%2Flogger",
+ "platform": "fury"
+ }
+ ]
+ },
+ {
+ "id": "snyk-badge",
+ "badges": [
+ {
+ "url": "https://github.com/ptkdev/all-shields-cli/",
+ "title": "snyk vuln checks",
+ "custom": "/test/github/ptkdev/all-shields-cli/badge.svg",
+ "platform": "snyk"
+ }
+ ]
+ },
+ {
+ "id": "discord-badge",
+ "badges": [
+ {
+ "url": "https://discord.ptkdev.io",
+ "server_id": "383373985666301975",
+ "title": "discord server",
+ "platform": "discord"
+ }
+ ]
+ }
+ ]
}
\ No newline at end of file
diff --git a/examples/README.md b/examples/README.md
index 918e79c..3dc1cbc 100644
--- a/examples/README.md
+++ b/examples/README.md
@@ -1,14 +1,39 @@
-# My badges
-`badge-top` is 1° id from `.all-shieldsrc` array, show version badge and npm badge
+# Example of shields.io platform
+`shields-badge` is 1° id from `.all-shieldsrc` array
Open and close html comment with this id after `all-shields/` tag, badges will appear in the middle after you run command
-
-
+
+
-`badge-bottom` is 2° id from `.all-shieldsrc` array, show patreon badge and discord button
+# Example of badgen.net platform
+`badgen-badge` is 2° id from `.all-shieldsrc` array
Open and close html comment with this id after `all-shields/` tag, badges will appear in the middle after you run command
-
-
\ No newline at end of file
+
+
+
+# Example of snyk.io platform
+`snyk-badge` is 3° id from `.all-shieldsrc` array
+
+Open and close html comment with this id after `all-shields/` tag, badges will appear in the middle after you run command
+
+
+
+
+# Example of fury.io platform
+`fury-badge` is 4° id from `.all-shieldsrc` array
+
+Open and close html comment with this id after `all-shields/` tag, badges will appear in the middle after you run command
+
+
+
+
+# Example of discord platform
+`discord-badge` is 5° id from `.all-shieldsrc` array
+
+Open and close html comment with this id after `all-shields/` tag, badges will appear in the middle after you run command
+
+
+
\ No newline at end of file
diff --git a/examples/package.json b/examples/package.json
index 3e33b84..b22a378 100644
--- a/examples/package.json
+++ b/examples/package.json
@@ -1,5 +1,5 @@
{
- "name": "example",
- "description": "Run example",
+ "name": "all-shields-cli-examples",
+ "description": "Examples of all-shields-cli usage",
"version": "1.0.0"
}
\ No newline at end of file
diff --git a/package-lock.json b/package-lock.json
index 6f878a3..5b6c97f 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,6 +1,6 @@
{
"name": "@ptkdev/all-shields-cli",
- "version": "1.0.1",
+ "version": "1.1.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
@@ -6499,13 +6499,14 @@
"dev": true
},
"minimist-options": {
- "version": "4.0.2",
- "resolved": "https://registry.npmjs.org/minimist-options/-/minimist-options-4.0.2.tgz",
- "integrity": "sha512-seq4hpWkYSUh1y7NXxzucwAN9yVlBc3Upgdjz8vLCP97jG8kaOmzYrVH/m7tQ1NYD1wdtZbSLfdy4zFmRWuc/w==",
+ "version": "4.1.0",
+ "resolved": "https://registry.npmjs.org/minimist-options/-/minimist-options-4.1.0.tgz",
+ "integrity": "sha512-Q4r8ghd80yhO/0j1O3B2BjweX3fiHg9cdOwjJd2J76Q135c+NDxGCqdYKQ1SKBuFfgWbAUzBfvYjPUEeNgqN1A==",
"dev": true,
"requires": {
"arrify": "^1.0.1",
- "is-plain-obj": "^1.1.0"
+ "is-plain-obj": "^1.1.0",
+ "kind-of": "^6.0.3"
}
},
"mixin-deep": {
@@ -6836,9 +6837,9 @@
"dev": true
},
"moment-timezone": {
- "version": "0.5.28",
- "resolved": "https://registry.npmjs.org/moment-timezone/-/moment-timezone-0.5.28.tgz",
- "integrity": "sha512-TDJkZvAyKIVWg5EtVqRzU97w0Rb0YVbfpqyjgu6GwXCAohVRqwZjf4fOzDE6p1Ch98Sro/8hQQi65WDXW5STPw==",
+ "version": "0.5.29",
+ "resolved": "https://registry.npmjs.org/moment-timezone/-/moment-timezone-0.5.29.tgz",
+ "integrity": "sha512-qWtUhRIk29zviEFAhttY0fDbM/zsu/OlCRoeQG8vxuH6XcTTuji9ILJkOdxjr+vzIv0J39RsO/SPTuMvzm90wA==",
"dev": true,
"requires": {
"moment": ">= 2.9.0"
diff --git a/package.json b/package.json
index e40007c..ea8d23e 100755
--- a/package.json
+++ b/package.json
@@ -1,7 +1,7 @@
{
"name": "@ptkdev/all-shields-cli",
- "description": "Tool to help automate your badges of shields.io from a dotfile for your markdown files. Inspired by all-contributors-cli",
- "version": "1.0.1",
+ "description": "Tool to help automate your badges from dotfiles for your markdown. Inspired by all-contributors-cli",
+ "version": "1.1.0",
"bin": {
"all-shields-generate": "cli/generate.js",
"all-badges-generate": "cli/generate.js",
@@ -47,12 +47,22 @@
},
"keywords": [
"ptkdev",
+ "all-shields-cli",
+ "all-shields-generate",
"badges",
"badge",
"shield",
"shields",
"shieldsio",
- "all-shields-cli",
+ "badgen",
+ "badgens",
+ "badgenio",
+ "snyk",
+ "snyks",
+ "snykio",
+ "fury",
+ "furys",
+ "furyio",
"all-contributors-cli"
],
"engines": {