Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: adjust readme #42

Merged
merged 1 commit into from
Jun 10, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 35 additions & 33 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,46 +12,27 @@

## Table of Contents

- [Markup example](<#markup-example-(paste-it-anywhere-in-your-README.md)>)
- [Running example](#running-example)
- [Requirements](#requirements)
- [Installation](#installation)
- [Usage](#usage)
- [Simple Usage](#simple-usage)
- [Advanced Usage](#advanced-usage)
- [Usage as a part of your githooks](#usage-as-a-part-of-your-githooks)
- [See more examples](#see-more-examples)
- [Contributors](#contributors)
- [License](#license)

---

## Markup example (paste it anywhere in your README.md)

```markdown
| Statements | Branches | Functions | Lines |
| --------------------------- | ----------------------- | ------------------------- | ----------------- |
| ![Statements](#statements#) | ![Branches](#branches#) | ![Functions](#functions#) | ![Lines](#lines#) |
```

- The table is **optional**, the only markup that matters are the following:

1. `![Statements](#statements#)`
1. `![Branches](#branches#)`
1. `![Functions](#functions#)`
1. `![Lines](#lines#)`

---

## Running example

![Example](./assets/readme-gif.gif)

---

### Requirements
## Requirements

- **Must** have at least one of the [before mentioned markup items](<#example-markup-(paste-it-anywhere-in-your-README.md)>);
- First, of course, you **must** have a test runner such as Jest and Mocha;
- You **must** have **json-summary** as a **coverageReporter** in your tests configuration;
- For example, if you are using Jest, configuration should either be within `package.json` or inside your jest config file i.e. `jest.config.js` or `jestconfig.json` as shown below:
- For example, if you are using Jest, configuration should either be within `package.json` or inside your jest config file i.e. `jest.config.js` or `jestconfig.json` as written below:

```json
"coverageReporters": ["json-summary"]
Expand All @@ -63,20 +44,49 @@

## Installation

- Install the library in your project as a devDependency:

```bash
npm i -D istanbul-badges-readme
```

- Add **at least one** of the below coverage hashes in your README file:

- `![Statements](#statements#)`
- `![Branches](#branches#)`
- `![Functions](#functions#)`
- `![Lines](#lines#)`

- A simple example of all hashes being used in a table fashion markup:

```markdown
| Statements | Branches | Functions | Lines |
| --------------------------- | ----------------------- | ------------------------- | ----------------- |
| ![Statements](#statements#) | ![Branches](#branches#) | ![Functions](#functions#) | ![Lines](#lines#) |
```

---

## Usage
## Simple Usage

- Simply run it from the CLI as follows:

```bash
npm run istanbul-badges-readme
```

- Or add it to your **package.json** scripts as follows:

```json
"scripts": {
"make-badges": "istanbul-badges-readme",
}
```

---

## Advanced Usage

- Custom coverage directory? Use **--coverageDir** argument:

```bash
Expand All @@ -101,14 +111,6 @@
npm run istanbul-badges-readme --functionsLabel='Mis funciones!' --branchesLabel='Branches are troublesome!'
```

- Or add it to your **package.json** scripts as follows:

```json
"scripts": {
"make-badges": "istanbul-badges-readme",
}
```

---

## Usage as a part of your githooks
Expand Down