Skip to content

Commit e6877ab

Browse files
committed
chore: Some small license and readme updates
1 parent c2a1b0b commit e6877ab

File tree

6 files changed

+46
-33
lines changed

6 files changed

+46
-33
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
All notable changes to this project will be documented in this file.
44
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
55

6+
67
## [0.6.5](https://github.com/feathersjs/hooks/compare/v0.6.4...v0.6.5) (2021-04-20)
78

89

LICENSE

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
MIT License
1+
The MIT License (MIT)
22

3-
Copyright (c) 2020 Feathers
3+
Copyright (c) 2021 Feathers
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal
@@ -19,3 +19,4 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1919
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2020
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2121
SOFTWARE.
22+

lerna.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,13 @@
99
"hoist": true
1010
},
1111
"publish": {
12-
"allowBranch": "master",
12+
"allowBranch": "main",
1313
"message": "chore(release): publish %s",
1414
"conventionalCommits": true,
1515
"createRelease": "github"
1616
}
17-
}
17+
},
18+
"ignoreChanges": [
19+
"packages/*"
20+
]
1821
}

main/hooks/README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
# Hooks
22

3-
[![CI GitHub action](https://github.com/feathersjs/hooks/workflows/Node%20CI/badge.svg)](https://github.com/feathersjs/hooks/actions?query=workflow%3A%22Node+CI%22)
43
[![Deno CI](https://github.com/feathersjs/hooks/actions/workflows/deno.yml/badge.svg)](https://github.com/feathersjs/hooks/actions/workflows/deno.yml)
54
[![Download Status](https://img.shields.io/npm/dm/@feathersjs/hooks.svg?style=flat-square)](https://www.npmjs.com/package/@feathersjs/hooks)
65

makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@ npm:
1717
npx lerna bootstrap
1818

1919
publish: npm
20-
npx lerna publish
20+
npx lerna publish --no-granular-pathspec

readme.md

Lines changed: 36 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
<h1>@feathersjs/hooks</h1>
22

33
[![Node CI](https://github.com/feathersjs/hooks/workflows/Node%20CI/badge.svg)](https://github.com/feathersjs/hooks/actions?query=workflow%3A%22Node+CI%22)
4-
[![Deno CI](https://github.com/feathersjs/hooks/actions/workflows/deno.yml/badge.svg)](https://github.com/feathersjs/hooks/actions/workflows/deno.yml)
54

65
`@feathersjs/hooks` brings middleware-like functionality to any async JavaScript or TypeScript function. It allows creation of composable and reusable workflows to handle functionality like
76

@@ -16,7 +15,7 @@
1615
This functionality can be added without having to change the original function. The pattern also keeps everything cleanly separated and testable.
1716

1817
```ts
19-
import { hooks, middleware } from '@feathersjs/hooks')
18+
import { hooks } from '@feathersjs/hooks';
2019

2120
// We're going to wrap `sayHi` with hook middleware.
2221
class Hello {
@@ -32,11 +31,13 @@ const logRuntime = async (context, next) => {
3231
await next(); // In this example, `next` is `sayHi`.
3332

3433
const duration = new Date().getTime() - start;
35-
console.log(`Function '${context.method || '[no name]'}' returned '${context.result}' after ${duration}ms`);
34+
console.log(`Function '${context.method}' returned '${context.result}' after ${duration}ms`);
3635
}
3736

3837
// The `hooks` utility wraps `logRuntime` around `sayHi`.
39-
hooks(Hello, { sayHi: middleware([ logRuntime ]) });
38+
hooks(Hello, {
39+
sayHi: [ logRuntime ]
40+
});
4041

4142
// Calling `sayHi` will start by calling the `logRuntime` hook.
4243
(async () => {
@@ -50,27 +51,25 @@ The Hooks middleware pattern was originally implemented directly in [FeathersJS]
5051

5152
See the [⚓ release post for a quick overview](https://blog.feathersjs.com/async-middleware-for-javascript-and-typescript-31a0f74c0d30).
5253

53-
<!-- TOC -->
54-
5554
- [Installation](#installation)
5655
- [Node](#node)
5756
- [Deno](#deno)
5857
- [Browser](#browser)
5958
- [Documentation](#documentation)
6059
- [Intro to Async Hooks](#intro-to-async-hooks)
6160
- [The `hooks` Function](#the-hooks-function)
62-
- [with a Function](#example-with-a-function)
63-
- [with a Class or Object](#example-with-a-class)
64-
- [`@hooks` Decorator](#the-hooks-decorator)
61+
- [Example with a Function](#example-with-a-function)
62+
- [Example with a Class](#example-with-a-class)
63+
- [TypeScript with the `@hooks` Decorator](#typescript-with-the-hooks-decorator)
6564
- [The `middleware` Manager](#the-middleware-manager)
6665
- [params(...names)](#paramsnames)
6766
- [props(properties)](#propsproperties)
6867
- [defaults(callback)](#defaultscallback)
69-
- [Global hooks](#global-hooks)
70-
- [on an Object](#global-hooks-on-an-object)
71-
- [on a Class](#global-hooks-on-a-class)
72-
- [JavaScript Example](#global-hooks---javascript-example)
73-
- [TypeScript Example](#global-hooks---typescript-example)
68+
- [Global Hooks](#global-hooks)
69+
- [Global Hooks on an Object](#global-hooks-on-an-object)
70+
- [Global Hooks on a Class](#global-hooks-on-a-class)
71+
- [JavaScript Example](#javascript-example)
72+
- [TypeScript Example](#typescript-example)
7473
- [Hook Context](#hook-context)
7574
- [Context properties](#context-properties)
7675
- [Arguments](#arguments)
@@ -88,10 +87,9 @@ See the [⚓ release post for a quick overview](https://blog.feathersjs.com/asyn
8887
- [Cache](#cache)
8988
- [Permissions](#permissions)
9089
- [Cleaning up GraphQL resolvers](#cleaning-up-graphql-resolvers)
90+
- [Contributing](#contributing)
9191
- [License](#license)
9292

93-
<!-- /TOC -->
94-
9593
# Installation
9694

9795
## Node
@@ -103,21 +101,15 @@ yarn add @feathersjs/hooks
103101

104102
## Deno
105103

106-
feathersjs/hooks releases are published to [deno.land/x/hooks](https://deno.land/x/hooks):
104+
`@feathersjs/hooks` releases are published to [deno.land/x/hooks](https://deno.land/x/hooks):
107105

108106
```ts
109107
import { hooks } from 'https://deno.land/x/[email protected]/deno/index.ts';
110108
```
111109

112110
## Browser
113111

114-
`@feathersjs/hooks` is compatible with any module loader like Webpack and can be included in the browser directly via:
115-
116-
```html
117-
<script type="text/javascript" src="//unpkg.com/@feathersjs/hooks@^0.2.0/dist/hooks.js"></script>
118-
```
119-
120-
Which will make a `hooks` global variable available.
112+
The `@feathersjs/hooks` npm packages is compatible with any module loader like Webpack.
121113

122114
# Documentation
123115

@@ -207,7 +199,7 @@ hooks(Hello, { sayHi: [ logRuntime ] });
207199
})();
208200
```
209201

210-
### The `@hooks` Decorator
202+
### TypeScript with the `@hooks` Decorator
211203

212204
With TypeScript, you can use `hooks` the same was as shown in the above JavaScript example, or you can use decorators. Using decorators requires the `experimentalDecorators` option in `tsconfig.json` to be enabled.
213205

@@ -349,7 +341,7 @@ Similar to object hooks, class hooks modify the class (or class prototype). Just
349341

350342
> __Note:__ Object or class level global hooks will only run if the method itself has been enabled for hooks. This can be done by registering hooks with an empty array.
351343
352-
#### Global Hooks - JavaScript Example
344+
#### JavaScript Example
353345

354346
```js
355347
const { hooks } = require('@feathersjs/hooks');
@@ -397,7 +389,7 @@ hooks(HelloSayer, {
397389
})();
398390
```
399391

400-
#### Global Hooks - TypeScript Example
392+
#### TypeScript Example
401393

402394
Using decorators in TypeScript also respects inheritance:
403395

@@ -830,6 +822,23 @@ const resolvers = {
830822
}
831823
```
832824

825+
# Contributing
826+
827+
For general contribution information refer to the [Feathers contribution guideLINES](https://github.com/feathersjs/hooks/blob/master/.github/contributing.md).
828+
829+
`@feathersjs/hooks` modules are written in TypeScript using [Deno](https://deno.land/) as the runtime. With Deno 1.16 or later installed you can start contributing by cloning this repository or your own fork via:
830+
831+
```
832+
git clone [email protected]:feathersjs/hooks.git
833+
cd hooks/
834+
```
835+
836+
And then run the tests via:
837+
838+
```
839+
make test
840+
```
841+
833842
# License
834843

835844
Copyright (c) 2021

0 commit comments

Comments
 (0)