diff --git a/HISTORY.md b/HISTORY.md index 8821823..d178edf 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -1,5 +1,10 @@ # History +## v4.35.0 2023 November 18 + +- Add `discord` and `twitch` badges +- Updated dependencies, [base files](https://github.com/bevry/base), and [editions](https://editions.bevry.me) using [boundation](https://github.com/bevry/boundation) + ## v4.34.0 2023 November 15 - Updated dependencies, [base files](https://github.com/bevry/base), and [editions](https://editions.bevry.me) using [boundation](https://github.com/bevry/boundation) diff --git a/README.md b/README.md index becb114..c8e6421 100644 --- a/README.md +++ b/README.md @@ -181,7 +181,7 @@ If you want to render badges inside your own project's readme files, check out t ``` html ``` @@ -189,7 +189,7 @@ If you want to render badges inside your own project's readme files, check out t ``` html ``` @@ -197,7 +197,7 @@ If you want to render badges inside your own project's readme files, check out t ``` html ``` diff --git a/SECURITY.md b/SECURITY.md index d9d3dd6..e27a0a8 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -2,15 +2,15 @@ ## Security Practices -This project meets standardized secure software development practices, including 2FA for all members, password managers with monitoring, secure secret retrieval instead of storage. [Learn more about our practices.](https://tidelift.com/funding/github/npm/badges) +This project meets standardized secure software development practices, including 2FA for all members, password managers with monitoring, secure secret retrieval instead of storage. [Learn about our practices.](https://tidelift.com/funding/github/npm/badges) ## Supported Versions This project uses [Bevry's automated tooling](https://github.com/bevry/boundation) to deliver the latest updates, fixes, and improvements inside the latest release while still maintaining widespread ecosystem compatibility. -[Refer to supported ecosystem versions: `Editions` section in `README.md`.](https://github.com/bevry/badges/blob/master/README.md#Editions) +[Refer to supported ecosystem versions: `Editions` section in `README.md`](https://github.com/bevry/badges/blob/master/README.md#Editions) -[Refer to automated support of ecosystem versions: `boundation` entries in `HISTORY.md`.](https://github.com/bevry/badges/blob/master/HISTORY.md) +[Refer to automated support of ecosystem versions: `boundation` entries in `HISTORY.md`](https://github.com/bevry/badges/blob/master/HISTORY.md) Besides testing and verification, out CI also [auto-merges](https://docs.github.com/en/code-security/dependabot/working-with-dependabot/automating-dependabot-with-github-actions) [Dependabot security updates](https://docs.github.com/en/code-security/dependabot/dependabot-security-updates/about-dependabot-security-updates) and [auto-publishes](https://github.com/bevry-actions/npm) successful builds of the [`master` branch](https://github.com/bevry/wait/actions?query=branch%3Amaster) to the [`next` version tag](https://www.npmjs.com/package/badges?activeTab=versions), offering immediate resolutions before scheduled maintenance releases. diff --git a/package-lock.json b/package-lock.json index c8e68db..e5330cd 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,31 +1,31 @@ { "name": "badges", - "version": "4.34.0", + "version": "4.35.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "badges", - "version": "4.34.0", + "version": "4.35.0", "license": "Artistic-2.0", "devDependencies": { "@bevry/update-contributors": "^1.23.0", - "@types/node": "^20.9.0", + "@types/node": "^20.9.1", "@typescript-eslint/eslint-plugin": "^6.11.0", "@typescript-eslint/parser": "^6.11.0", "assert-helpers": "^11.4.0", - "eslint": "^8.53.0", + "eslint": "^8.54.0", "eslint-config-bevry": "^4.0.0", "eslint-config-prettier": "^9.0.0", "eslint-plugin-prettier": "^5.0.1", "kava": "^7.2.0", "prettier": "^3.1.0", - "projectz": "^3.0.0", + "projectz": "^3.1.0", "surge": "^0.23.1", "typedoc": "^0.25.3", "typescript": "5.2.2", - "valid-directory": "^4.2.0", - "valid-module": "^2.2.0" + "valid-directory": "^4.4.0", + "valid-module": "^2.3.0" }, "engines": { "node": ">=10" @@ -44,12 +44,12 @@ } }, "node_modules/@bevry/ansi": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/@bevry/ansi/-/ansi-6.1.0.tgz", - "integrity": "sha512-xKY8zybxMVwJYSe0SJRCYceA0tLGMLWE78U/GVSOGYjzXzKFtKtJJXNsQ7uTofpwKEWI+s4eVvWyQXl4f0u70Q==", + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/@bevry/ansi/-/ansi-6.3.0.tgz", + "integrity": "sha512-4l7MexuIZuOj9FoBIbRD+nkMvZZASe1ukzanjrmfROlCzzd6ZiM0qmG3aa6sZdt45w4E3rUreGHaN6WhKc9Z9g==", "dev": true, "dependencies": { - "editions": "^6.10.0" + "editions": "^6.13.0" }, "engines": { "node": ">=4" @@ -59,13 +59,13 @@ } }, "node_modules/@bevry/file": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/@bevry/file/-/file-2.1.0.tgz", - "integrity": "sha512-QNTNe8M+QZpg7epw6iIpK3fSSheszM/RtS6s5cdHk1aAa1hXtsNIzooOiDdhKbWBe8jKdD6cZyc5GOUd/8YTRA==", + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/@bevry/file/-/file-2.2.0.tgz", + "integrity": "sha512-rImSWFJL0Gv5iM04AU9oHSx7HX1vlwGbk3jUXd2lBRNTeaFXgCs8jkCtJ+4kv7eIZNPEUSenEOtHlOFoAaK9QQ==", "dev": true, "dependencies": { - "editions": "^6.11.0", - "version-compare": "^3.1.0" + "editions": "^6.13.0", + "version-compare": "^3.2.0" }, "engines": { "node": ">=4" @@ -157,13 +157,13 @@ } }, "node_modules/@bevry/json": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/@bevry/json/-/json-1.7.0.tgz", - "integrity": "sha512-6sloPFqrsvXt4XViAta8UCdwnNhBAuwH3fWyqRvdkL3Fyu0DvOAHlskYytrIwGYdI1Euvj4+TVvb1Xi/nmT/oQ==", + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/@bevry/json/-/json-1.8.0.tgz", + "integrity": "sha512-TCljRl7mihYvlK2B6NISz7II0FQu0OuEG7R3Hw2lVxh/PDv7vCGlqdNrIiM5qnwuxxTj1xVD+epjm9IT5GBgzA==", "dev": true, "dependencies": { - "@bevry/file": "^2.1.0", - "errlop": "^7.1.0" + "@bevry/file": "^2.2.0", + "errlop": "^7.2.0" }, "engines": { "node": ">=10" @@ -204,9 +204,9 @@ } }, "node_modules/@bevry/valid-filename": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/@bevry/valid-filename/-/valid-filename-2.0.0.tgz", - "integrity": "sha512-YRK4spEHvSnZeyAb1It6OeuG2+zO1RjFdox39xnnVtwCuDIWvoIR5dHNgTLYp99k8pMzES8trzhroi5A7l0CwQ==", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/@bevry/valid-filename/-/valid-filename-2.1.0.tgz", + "integrity": "sha512-/8sDKmnrB6FTxkVMmNf0sCeP9jEi3HgcN1xcFxvCTyUY3WcV2R1UU/JGNz1lIYzO2wKE0OZf4qRRW9dCx/8/FQ==", "dev": true, "bin": { "valid-filename": "bin.cjs" @@ -219,9 +219,9 @@ } }, "node_modules/@bevry/wait": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/@bevry/wait/-/wait-2.0.0.tgz", - "integrity": "sha512-rHyxdCSe/NDXHtPUTArprp45ULTCbciS07Oc+EXC5QUunnMi14aVBHALoFQuEkpY3fS2WqDCzBlD+xLjLQpPyA==", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/@bevry/wait/-/wait-2.1.0.tgz", + "integrity": "sha512-AyDsTT08vapll+A4a42hi2mYLNfgalv3OQPrdRsabASomxYRttivvatcdxSeSjGRWlHTZJ2ygPUEkPGnas1ZBQ==", "dev": true, "engines": { "node": ">=4" @@ -278,9 +278,9 @@ } }, "node_modules/@eslint/js": { - "version": "8.53.0", - "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.53.0.tgz", - "integrity": "sha512-Kn7K8dx/5U6+cT1yEhpX1w4PCSg0M+XyRILPgvwcEBjerFWCwQj5sbr3/VmxqV0JGHCBCzyd6LxypEuehypY1w==", + "version": "8.54.0", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.54.0.tgz", + "integrity": "sha512-ut5V+D+fOoWPgGGNj83GGjnntO39xDy6DWxO0wb7Jp3DcMX0TfIqdzHF85VTQkerdyGmuuMD9AKAo5KiNlf/AQ==", "dev": true, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" @@ -387,9 +387,9 @@ "dev": true }, "node_modules/@types/node": { - "version": "20.9.0", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.9.0.tgz", - "integrity": "sha512-nekiGu2NDb1BcVofVcEKMIwzlx4NjHlcjhoxxKBNLtz15Y1z7MYf549DFvkHSId02Ax6kGwWntIBPC3l/JZcmw==", + "version": "20.9.1", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.9.1.tgz", + "integrity": "sha512-HhmzZh5LSJNS5O8jQKpJ/3ZcrrlG6L70hpGqMIAoM9YVD0YBRNWYsfwcXq8VnSjlNpCpgLzMXdiPo+dxcvSmiA==", "dev": true, "dependencies": { "undici-types": "~5.26.4" @@ -809,9 +809,9 @@ "dev": true }, "node_modules/badges": { - "version": "4.33.0", - "resolved": "https://registry.npmjs.org/badges/-/badges-4.33.0.tgz", - "integrity": "sha512-qP54oWiXlxg8UFo3T/Et7SBN1hbZZ8e6OzrHn1McqdKgXOwMJXMG0HPtYkR+wYRaXeNbNEkNzO3Wq5Ygjwb9tw==", + "version": "4.34.0", + "resolved": "https://registry.npmjs.org/badges/-/badges-4.34.0.tgz", + "integrity": "sha512-X4dmnTht9p5PEv5Us/W3nLNtDxIzUWJ24U5Jt93gUixGWV0N2dN9t10odTMj5X/wvsxSvoNo3yn6tmVkUDwXoA==", "dev": true, "engines": { "node": ">=10" @@ -921,15 +921,15 @@ "dev": true }, "node_modules/caterpillar": { - "version": "6.10.0", - "resolved": "https://registry.npmjs.org/caterpillar/-/caterpillar-6.10.0.tgz", - "integrity": "sha512-E2UOyr2LoDyxTW9Z7oG+e7dME8DT6jEQO2xZ0TUAl5Jx+4wgsj9LjhXmmhObP+2EWSTS/1Exri4Ff5uHFRfxtQ==", + "version": "6.11.0", + "resolved": "https://registry.npmjs.org/caterpillar/-/caterpillar-6.11.0.tgz", + "integrity": "sha512-FQn5U9LyJiPuREifDEIANecN1ydrwqYOQhUMX0VAwVhaodD71pTfHs7Yg9nOiQuIjYRUgfQyARZts7YQkOXdWw==", "dev": true, "dependencies": { - "@bevry/ansi": "^6.1.0", - "editions": "^6.11.0", - "get-current-line": "^6.8.0", - "rfc-log-levels": "^3.19.0" + "@bevry/ansi": "^6.2.0", + "editions": "^6.13.0", + "get-current-line": "^6.9.0", + "rfc-log-levels": "^3.20.0" }, "engines": { "node": ">=10" @@ -1239,15 +1239,15 @@ } }, "node_modules/eslint": { - "version": "8.53.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.53.0.tgz", - "integrity": "sha512-N4VuiPjXDUa4xVeV/GC/RV3hQW9Nw+Y463lkWaKKXKYMvmRiRDAtfpuPFLN+E1/6ZhyR8J2ig+eVREnYgUsiag==", + "version": "8.54.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.54.0.tgz", + "integrity": "sha512-NY0DfAkM8BIZDVl6PgSa1ttZbx3xHgJzSNJKYcQglem6CppHyMhRIQkBVSSMaSRnLhig3jsDbEzOjwCVt4AmmA==", "dev": true, "dependencies": { "@eslint-community/eslint-utils": "^4.2.0", "@eslint-community/regexpp": "^4.6.1", "@eslint/eslintrc": "^2.1.3", - "@eslint/js": "8.53.0", + "@eslint/js": "8.54.0", "@humanwhocodes/config-array": "^0.11.13", "@humanwhocodes/module-importer": "^1.0.1", "@nodelib/fs.walk": "^1.2.8", @@ -1759,12 +1759,12 @@ } }, "node_modules/get-cli-arg": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/get-cli-arg/-/get-cli-arg-8.0.0.tgz", - "integrity": "sha512-cR/Tt2Gnj7hF5CbkUOzXFZvmDWkDssqaTt7jeMSpZ+vKb/U0tAmfESYnwWprYJY81Jhvm2eXtSbNts5uqOaPCw==", + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/get-cli-arg/-/get-cli-arg-8.1.0.tgz", + "integrity": "sha512-KBs2vR7bULdHR2xdfPumLJDdKuEDyB8hofOGf7HXNml/0tNqOn3oU//seyWcjCVG4YDC5du8c/Kqz47RcNhyuA==", "dev": true, "dependencies": { - "normalify": "^2.26.0" + "normalify": "^2.27.0" }, "engines": { "node": ">=8" @@ -1774,9 +1774,9 @@ } }, "node_modules/get-current-line": { - "version": "6.8.0", - "resolved": "https://registry.npmjs.org/get-current-line/-/get-current-line-6.8.0.tgz", - "integrity": "sha512-X4JqocHKZEZRvFGdTzvPLYSZ16hol/9gzKF3bMGe53PWIkxlSv0U9xGxB4gXFqhN6jR1YNGMc6u1oMAFBrBqGw==", + "version": "6.9.0", + "resolved": "https://registry.npmjs.org/get-current-line/-/get-current-line-6.9.0.tgz", + "integrity": "sha512-jFRFeABDPUMkidcVK3OOWKCAts9Gpku1+dWDLTU7mHbdp6sRB2IM9EnE3io8gJhxCHyTgANj3N5Lg9yHyAxypA==", "dev": true, "engines": { "node": ">=10" @@ -1954,9 +1954,9 @@ } }, "node_modules/ignore": { - "version": "5.2.4", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.4.tgz", - "integrity": "sha512-MAb38BcSbH0eHNBxn7ql2NH/kX33OkB3lZ1BNdh7ENeRChHTYsTvWrMubiIAMNS2llXEEgZ1MUOBtXChP3kaFQ==", + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.0.tgz", + "integrity": "sha512-g7dmpshy+gD7mh88OC9NwSGTKoc3kyLAZQRU1mt53Aw/vnvfXnbC+F/7F7QoYVKbV+KNvJx8wArewKy1vXMtlg==", "dev": true, "engines": { "node": ">= 4" @@ -2547,12 +2547,12 @@ "dev": true }, "node_modules/native-promise-pool": { - "version": "3.22.0", - "resolved": "https://registry.npmjs.org/native-promise-pool/-/native-promise-pool-3.22.0.tgz", - "integrity": "sha512-tEFj/KMhIfuKi0umpWBWx0KQ8C0+a3dL0oV+Kor2tPKkzhMpkyou7jAyAy0D2OyloJ99MrLhtEX8LdhirdLlMQ==", + "version": "3.23.0", + "resolved": "https://registry.npmjs.org/native-promise-pool/-/native-promise-pool-3.23.0.tgz", + "integrity": "sha512-BIW+8lLmHQJBJegsZS7vAPG++d1gAcJ8wS15r6+4h7khKEJ31QR06BZYme6kfPVBi9fOKG0L/yEwXRD+3Qs1pg==", "dev": true, "dependencies": { - "editions": "^6.11.0" + "editions": "^6.13.0" }, "engines": { "node": ">=10" @@ -2594,9 +2594,9 @@ } }, "node_modules/normalify": { - "version": "2.26.0", - "resolved": "https://registry.npmjs.org/normalify/-/normalify-2.26.0.tgz", - "integrity": "sha512-G4oWM/03stGSeu/C7FXBiTj44Ei5ba4WKiTET3gH/QiTPEEoS8aqH0OPPP1qJamxikY1kztCnlvCVsyL22uqrA==", + "version": "2.27.0", + "resolved": "https://registry.npmjs.org/normalify/-/normalify-2.27.0.tgz", + "integrity": "sha512-4mK4oobeHuYpv6OQiZWd/ILUi1GFaTKPxiQ9tPvI/nWIoz6i7c6/qXPopmrw7opjGTCSDHt2HwzYWrIr+mWRTg==", "dev": true, "engines": { "node": ">=10" @@ -2863,20 +2863,20 @@ } }, "node_modules/projectz": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/projectz/-/projectz-3.0.0.tgz", - "integrity": "sha512-8DLhjLuGM8KWqvag/SL/vTZgqHIGqEmMyQXQAaiIMd3Zc/VevrM/38a4KYNlOFznzbDOCQkZpoGu/aQh723Kjw==", + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/projectz/-/projectz-3.1.0.tgz", + "integrity": "sha512-LkhMxSofAeuZ8wL+Lew07VIU8C616giJ3xU+pG6v12xHtKxyLyVvdp1bUQkC8V+nknxqukDB3KXoxzaeMr7f6Q==", "dev": true, "dependencies": { - "@bevry/file": "^2.1.0", - "@bevry/json": "^1.7.0", - "badges": "^4.32.0", - "caterpillar": "^6.9.0", + "@bevry/file": "^2.2.0", + "@bevry/json": "^1.8.0", + "badges": "^4.34.0", + "caterpillar": "^6.11.0", "fellow": "^6.25.0", - "get-cli-arg": "^8.0.0", + "get-cli-arg": "^8.1.0", "spdx-expression-parse": "^3.0.1", "spdx-license-list": "^6.8.0", - "typechecker": "^8.1.0" + "typechecker": "^8.2.0" }, "bin": { "projectz": "bin.cjs" @@ -3009,9 +3009,9 @@ } }, "node_modules/rfc-log-levels": { - "version": "3.19.0", - "resolved": "https://registry.npmjs.org/rfc-log-levels/-/rfc-log-levels-3.19.0.tgz", - "integrity": "sha512-4+EiBg1icaZ5jaz+4B2O15Xq4YcrCverWekGnJUqGlXgGJWjrjgMJ74cqCWMzvffeSph5g2HxyfOQcnQDSh40Q==", + "version": "3.20.0", + "resolved": "https://registry.npmjs.org/rfc-log-levels/-/rfc-log-levels-3.20.0.tgz", + "integrity": "sha512-fRvsAhOFIp0Ez6ooDFMpMM9Ma0FymjF9gOPHjE4b32XvvLZjEyHQbLpf1cs3Hd1G7Lg2mUL4fRJD53JoPokcWA==", "dev": true, "engines": { "node": ">=10" @@ -3785,12 +3785,12 @@ } }, "node_modules/valid-directory": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/valid-directory/-/valid-directory-4.2.0.tgz", - "integrity": "sha512-H48H7Jbw2zLZl4DA8QLkT9HsfgGHg+MJi1mOfj+eybe2VhElHsD/0WBaKMBDJAVFq+Pi8w1leiYITYAKZtg/FA==", + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/valid-directory/-/valid-directory-4.4.0.tgz", + "integrity": "sha512-RdV/rBBN6MZrksSUc2Eg6lorVJRaS0aN1JM7iXQj8jVRdWQizrb10l4okxDtBdzudB2EFaDUic75W09SLrFl6w==", "dev": true, "dependencies": { - "@bevry/valid-filename": "^2.0.0", + "@bevry/valid-filename": "^2.1.0", "fdir": "^6.1.1" }, "bin": { @@ -3832,12 +3832,12 @@ } }, "node_modules/valid-module": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/valid-module/-/valid-module-2.2.0.tgz", - "integrity": "sha512-wtCUxWrFHWbZUKYrDCcwSOUh3SRduj7K3pUecARAAb3n+m7A8H3bXsZ6bOT4GNMJ6coH/RrEvaw644Eh7GxrLA==", + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/valid-module/-/valid-module-2.3.0.tgz", + "integrity": "sha512-yE+ZqXgVD8vkMTmeeh6/KB2iLwjK9t6bhebUO9ZHjqAU5r2eDe7WyCXJ2uDcuogC86SbrGPIPUVqkZuEHHo5xA==", "dev": true, "dependencies": { - "errlop": "^7.1.0" + "errlop": "^7.2.0" }, "bin": { "valid-module": "bin.cjs" diff --git a/package.json b/package.json index a360844..82d4bf7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "badges", - "version": "4.34.0", + "version": "4.35.0", "description": "The definitive collection of badges for rendering", "homepage": "https://github.com/bevry/badges", "license": "Artistic-2.0", @@ -205,22 +205,22 @@ "module": "edition-browsers/index.js", "devDependencies": { "@bevry/update-contributors": "^1.23.0", - "@types/node": "^20.9.0", + "@types/node": "^20.9.1", "@typescript-eslint/eslint-plugin": "^6.11.0", "@typescript-eslint/parser": "^6.11.0", "assert-helpers": "^11.4.0", - "eslint": "^8.53.0", + "eslint": "^8.54.0", "eslint-config-bevry": "^4.0.0", "eslint-config-prettier": "^9.0.0", "eslint-plugin-prettier": "^5.0.1", "kava": "^7.2.0", "prettier": "^3.1.0", - "projectz": "^3.0.0", + "projectz": "^3.1.0", "surge": "^0.23.1", "typedoc": "^0.25.3", "typescript": "5.2.2", - "valid-directory": "^4.2.0", - "valid-module": "^2.2.0" + "valid-directory": "^4.4.0", + "valid-module": "^2.3.0" }, "scripts": { "our:clean": "rm -rf ./docs ./edition* ./es2015 ./es5 ./out ./.next", diff --git a/source/badges.ts b/source/badges.ts index 3d6dee1..0dd38ec 100644 --- a/source/badges.ts +++ b/source/badges.ts @@ -836,7 +836,53 @@ export function slackin({ slackinURL }: slackinOptions): string { const image = `${slackinURL}/badge.svg` const url = slackinURL const alt = 'Slack community badge' - const title = "Join this project's slack community" + const title = "Join this project's community on Slack" + return badge({ image, alt, url, title }) +} +slackin.badgeCategory = 'social' + +export interface discordOptions { + /** The discord server id */ + discordServerID: string + /** The discord server invite code or url */ + discordServerInvite?: string +} +/** Discord Badge */ +export function discord({ + discordServerID, + discordServerInvite, +}: discordOptions): string { + // Check + if (!discordServerID) throw new Error('discordServerID is missing') + discordServerInvite = (discordServerInvite || '') + .replace('https://discord.com/invite/', '') + .replace('https://discord.gg/', '') + + // Create + const image = `https://img.shields.io/discord/${discordServerID}?logo=discord&label=discord` + const url = discordServerInvite + ? `https://discord.gg/${discordServerInvite}` + : `https://discord.com/channels/${discordServerID}` + const alt = 'Discord server badge' + const title = "Join this project's community on Discord" + return badge({ image, alt, url, title }) +} +slackin.badgeCategory = 'social' + +export interface TwitchOptions { + /** The Twitch username */ + twitchUsername: string +} +/** Twitch Badge */ +export function twitch({ twitchUsername }: TwitchOptions): string { + // Check + if (!twitchUsername) throw new Error('twitchUsername is missing') + + // Create + const image = `https://img.shields.io/twitch/status/${twitchUsername}?logo=twitch` + const url = `https://www.twitch.tv/${twitchUsername}` + const alt = 'Twitch community badge' + const title = "Join this project's community on Twitch" return badge({ image, alt, url, title }) } slackin.badgeCategory = 'social' diff --git a/source/test.ts b/source/test.ts index 2ebd837..e627cf2 100644 --- a/source/test.ts +++ b/source/test.ts @@ -83,6 +83,8 @@ kava.suite('badges', function (suite, test) { // Social Badges 'slackinscript', 'slackin', + 'discord', + 'twitch', 'gabeacon', 'googleplusone', 'redditsubmit', @@ -123,6 +125,9 @@ kava.suite('badges', function (suite, test) { liberapayUsername: 'balupton', slackinURL: 'https://slack.bevry.me', + discordServerID: '1147436445783560193', + discordServerInvite: 'nQuXddV7VP', + twitchUsername: 'balupton', gaTrackingID: 'UA-XXXXX-XX', homepage: 'http://bevry.me', facebookApplicationID: '123123', @@ -179,7 +184,9 @@ kava.suite('badges', function (suite, test) { 'ThanksDev donate button', `
`, ``, - `Slack community badge`, + `Slack community badge`, + `Discord server badge`, + `Twitch community badge`, `Google Analytics beacon image`, ``, ``,