Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jaywcjlove/coverage-badges-cli
Create coverage badges from coverage reports (no 3rd parties servers).
https://github.com/jaywcjlove/coverage-badges-cli
badges cli cli-app coverage coverage-badges coverage-badges-cli nodejs typescript
Last synced: 22 days ago
JSON representation
Create coverage badges from coverage reports (no 3rd parties servers).
- Host: GitHub
- URL: https://github.com/jaywcjlove/coverage-badges-cli
- Owner: jaywcjlove
- License: mit
- Created: 2021-09-19T20:44:06.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2024-02-23T07:14:51.000Z (9 months ago)
- Last Synced: 2024-04-14T03:46:10.023Z (7 months ago)
- Topics: badges, cli, cli-app, coverage, coverage-badges, coverage-badges-cli, nodejs, typescript
- Language: TypeScript
- Homepage: https://jaywcjlove.github.io/coverage-badges-cli/
- Size: 1.21 MB
- Stars: 12
- Watchers: 3
- Forks: 16
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
coverage-badges-cli
===[![Buy me a coffee](https://img.shields.io/badge/Buy%20me%20a%20coffee-048754?logo=buymeacoffee)](https://jaywcjlove.github.io/#/sponsor)
[![Build & Deploy](https://github.com/jaywcjlove/coverage-badges-cli/actions/workflows/ci.yml/badge.svg)](https://github.com/jaywcjlove/coverage-badges-cli/actions/workflows/ci.yml)
[![Coverage Status](https://jaywcjlove.github.io/coverage-badges-cli/badges.svg)](https://jaywcjlove.github.io/coverage-badges-cli/lcov-report/)
[![npm version](https://img.shields.io/npm/v/coverage-badges-cli.svg)](https://www.npmjs.com/package/coverage-badges-cli)
[![Download NPM](https://img.shields.io/npm/dm/coverage-badges-cli.svg?style=flat)](https://www.npmjs.com/package/coverage-badges-cli/)Create coverage badges from coverage reports. Using GitHub Actions and GitHub Workflow CPU time (no 3rd parties servers).
Don't worry about the [coverage.io](https://coveralls.io/) service is down.
## Install
```shell
$ npm i coverage-badges-cli
```## Example
```js
{
"scripts": {
"coverage": "jest --coverage"
"make-badges": "coverage-badges",
},
"jest": {
"collectCoverageFrom": [
"/packages/**/*.{tsx,ts}",
"!**/*.{js,d.ts}"
],
"coverageReporters": [
"lcov",
"json-summary"
],
}
}
```This config creates a coverage badge in a default directory ./badges.
You can add `![Coverage](./coverage/badges.svg)` to your README.md after the badge creation.
## Github Actions
### Input Parameters
![](https://jaywcjlove.github.io/coverage-badges-cli/badges-classic.svg)
![](https://jaywcjlove.github.io/coverage-badges-cli/badges-flat.svg)- `source` - The path of the target file "coverage-summary.json".
- `output` - Output image path.
- `label` - The left label of the badge, usually static (default `coverage`).
- `labelColor` - \ or \ (default: `555`).
- `color` - \ or \ (default: '')
- `scale` - Set badge scale (default: `1`).
- `style` - Badges style: `flat`, `classic` (default `classic`).
- ~~`type`~~ - (No longer supported after v1.2.0) Coverage report type: `lines`, `statements`, `functions`, `branches` (default `statements`)
- `jsonPath` - Path to the coverage percentage number to be used in the badge (default `total.statements.pct`)
- `icon` - Path to icon file```yml
- name: Create Coverage Badges
uses: jaywcjlove/coverage-badges-cli@main
with:
style: flat
source: coverage/coverage-summary.json
output: coverage/badges.svg
jsonPath: totals.percent_covered- name: Deploy
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./build
```### Output Parameters
svg svg image string: ` or (default: '555')
--color or (default: '')Example:
npm coverage-badges-cli --output coverage/badges.svg
npm coverage-badges-cli --style plastic
npm coverage-badges-cli --source coverage/coverage-summary.json
npm coverage-badges-cli --labelColor ADF
```## Development
```bash
$ npm i
$ npm run build
$ npm run watch
```## See also
- [Github Release Changelog](https://github.com/jaywcjlove/changelog-generator) Generator A GitHub Action that compares the commit differences between two branches
- [Create Tags From](https://github.com/jaywcjlove/create-tag-action) Auto create tags from commit or package.json.
- [Github Action Contributors](https://github.com/jaywcjlove/github-action-contributors) Github action generates dynamic image URL for contributor list to display it!
- [Create Coverage Badges](https://github.com/jaywcjlove/coverage-badges-cli) Create coverage badges from coverage reports. (no 3rd parties servers)
- [Generated Badges](https://github.com/jaywcjlove/generated-badges) Create a badge using GitHub Actions and GitHub Workflow CPU time (no 3rd parties servers)## Contributors
As always, thanks to our amazing contributors!
Made with [contributors](https://github.com/jaywcjlove/github-action-contributors).
## License
MIT © [Kenny Wong](https://wangchujiang.com/)