Skip to content

Commit

Permalink
chore: format markdown files
Browse files Browse the repository at this point in the history
  • Loading branch information
thetutlage committed Sep 21, 2020
1 parent 1a10e12 commit 1439c93
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 22 deletions.
10 changes: 7 additions & 3 deletions .github/COMMIT_CONVENTION.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@
Using conventional commit messages, we can automate the process of generating the CHANGELOG file. All commits messages will automatically be validated against the following regex.

``` js
/^(revert: )?(feat|fix|docs|style|refactor|perf|test|workflow|ci|chore|types|build|improvement)((.+))?: .{1,50}/
```js
;/^(revert: )?(feat|fix|docs|style|refactor|perf|test|workflow|ci|chore|types|build|improvement)((.+))?: .{1,50}/
```
## Commit Message Format
A commit message consists of a **header**, **body** and **footer**. The header has a **type**, **scope** and **subject**:
> The **scope** is optional
Expand All @@ -26,6 +27,7 @@ Prefix makes it easier to append a path to a group of routes
5. The optional **footer** can be added after the body, followed by a blank line.

## Types

Only one type can be used at a time and only following types are allowed.

- feat
Expand All @@ -44,12 +46,15 @@ Only one type can be used at a time and only following types are allowed.
If a type is `feat`, `fix` or `perf`, then the commit will appear in the CHANGELOG.md file. However if there is any BREAKING CHANGE, the commit will always appear in the changelog.

### Revert

If the commit reverts a previous commit, it should begin with `revert:`, followed by the header of the reverted commit. In the body it should say: `This reverts commit <hash>`., where the hash is the SHA of the commit being reverted.

## Scope

The scope could be anything specifying place of the commit change. For example: `router`, `view`, `querybuilder`, `database`, `model` and so on.

## Subject

The subject contains succinct description of the change:

- use the imperative, present tense: "change" not "changed" nor "changes".
Expand All @@ -67,4 +72,3 @@ The footer should contain any information about **Breaking Changes** and is also
reference GitHub issues that this commit **Closes**.

**Breaking Changes** should start with the word `BREAKING CHANGE:` with a space or two newlines. The rest of the commit message is then used for this.

5 changes: 3 additions & 2 deletions .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,16 @@ We do our best to reply to all the issues on time. If you will follow the given
- Ensure the issue isn't already reported.
- Ensure you are reporting the bug in the correct repo.

*Delete the above section and the instructions in the sections below before submitting*
_Delete the above section and the instructions in the sections below before submitting_

## Description

If this is a feature request, explain why it should be added. Specific use-cases are best.

For bug reports, please provide as much *relevant* info as possible.
For bug reports, please provide as much _relevant_ info as possible.

## Package version

<!-- YOUR ANSWER -->

## Error Message & Stack Trace
Expand Down
2 changes: 0 additions & 2 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
build
README.md
docs
*.md
config.json
.eslintrc.json
package.json
Expand Down
10 changes: 9 additions & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,13 @@
"quoteProps": "consistent",
"bracketSpacing": true,
"arrowParens": "always",
"printWidth": 100
"printWidth": 100,
"overrides": [
{
"files": "*.md",
"options": {
"useTabs": false
}
}
]
}
25 changes: 12 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
poppinss_iftxlt.jpg" width="600px"></div>

# Hooks

> A no brainer module to execute lifecycle hooks in sequence.
[![circleci-image]][circleci-url] [![typescript-image]][typescript-url] [![npm-image]][npm-url] [![license-image]][license-url] [![audit-report-image]][audit-report-url]
Expand All @@ -25,13 +26,15 @@ I find myself re-writing the code for hooks in multiple packages, so decided to
<!-- END doctoc generated TOC please keep comment here to allow auto update -->

## How it works?

The hooks class exposes the API to `register`, `remove` and `exec` lifecycle hooks for any number of actions or events. The class API is meant to be used internally and not by the user facing code and this gives you the chance to improve the hooks DX.

For example: The Lucid models uses this class internally and expose `before` and `after` methods on the model itself. Doing this, Lucid can control the autocomplete, type checking for the `before` and `after` methods itself, without relying on this package to expose the generics API.

> Also generics increases the number of types Typescript has to generate and it's better to avoid them whenever possible.
## Installation

Install the package from npm registry as follows:

```sh
Expand All @@ -42,14 +45,14 @@ yarn add @poppinss/hooks
```

## Usage

Use it as follows

```ts
import { Hooks } from '@poppinss/hooks'
const hooks = new Hooks()

hooks.add('before', 'save', function () {
})
hooks.add('before', 'save', function () {})

// Later invoke before save hooks
await hooks.exec('before', 'save', { id: 1 })
Expand Down Expand Up @@ -83,7 +86,6 @@ hooks.add('before', 'save', (data) => {
})
```


#### exec(lifecycle: 'before' | 'after', action: string, ...data: any[])

Execute a given hook for a selected lifecycle.
Expand All @@ -97,7 +99,7 @@ hooks.exec('before', 'save', { username: 'virk' })
Remove an earlier registered hook. If you are using the IoC container bindings, then passing the binding string is enough, otherwise you need to store the reference of the function.

```ts
function onSave () {}
function onSave() {}

hooks.add('before', 'save', onSave)

Expand All @@ -117,6 +119,7 @@ hooks.clear('before', 'save')
```

#### merge (hooks: Hooks): void

Merge hooks from an existing hooks instance. Useful during class inheritance.

```ts
Expand All @@ -130,16 +133,12 @@ await hooks1.exec('before', 'save', [])
```

[circleci-image]: https://img.shields.io/circleci/project/github/poppinss/hooks/master.svg?style=for-the-badge&logo=circleci
[circleci-url]: https://circleci.com/gh/poppinss/hooks "circleci"

[circleci-url]: https://circleci.com/gh/poppinss/hooks 'circleci'
[typescript-image]: https://img.shields.io/badge/Typescript-294E80.svg?style=for-the-badge&logo=typescript
[typescript-url]: "typescript"

[typescript-url]: "typescript"
[npm-image]: https://img.shields.io/npm/v/@poppinss/hooks.svg?style=for-the-badge&logo=npm
[npm-url]: https://npmjs.org/package/@poppinss/hooks "npm"

[npm-url]: https://npmjs.org/package/@poppinss/hooks 'npm'
[license-image]: https://img.shields.io/npm/l/@poppinss/hooks?color=blueviolet&style=for-the-badge
[license-url]: LICENSE.md "license"

[license-url]: LICENSE.md 'license'
[audit-report-image]: https://img.shields.io/badge/-Audit%20Report-blueviolet?style=for-the-badge
[audit-report-url]: https://htmlpreview.github.io/?https://github.com/poppinss/hooks/blob/develop/npm-audit.html "audit-report"
[audit-report-url]: https://htmlpreview.github.io/?https://github.com/poppinss/hooks/blob/develop/npm-audit.html 'audit-report'
2 changes: 1 addition & 1 deletion npm-audit.html
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ <h5 class="card-title">
<div class="card">
<div class="card-body">
<h5 class="card-title">
September 21st 2020, 7:24:02 am
September 21st 2020, 7:25:26 am
</h5>
<p class="card-text">Last updated</p>
</div>
Expand Down

0 comments on commit 1439c93

Please sign in to comment.