Skip to content

Commit

Permalink
docs: update READMEs
Browse files Browse the repository at this point in the history
  • Loading branch information
getlarge committed Sep 13, 2024
1 parent 1a3ed41 commit 9e6da71
Show file tree
Hide file tree
Showing 10 changed files with 42 additions and 10 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ This repository contains several helpful packages for NestJS that I have develop
| [AMQP-Transport](./packages/amqp-transport/README.md) | A NestJS microservice adapter around [AMQPlib] supporting exchanges. | [![npm](https://img.shields.io/npm/v/@getlarge/nestjs-tools-amqp-transport.svg?style=flat)](https://npmjs.org/package/@getlarge/nestjs-tools-amqp-transport) |
| [Async-Local-Storage](./packages/async-local-storage/README.md) | A NestJS module to track context with [AsyncLocalStorage]. | [![npm](https://img.shields.io/npm/v/@getlarge/nestjs-tools-async-local-storage?style=flat)](https://npmjs.org/package/@getlarge/nestjs-tools-async-local-storage) |
| [Cluster](./packages/cluster/README.md) | A class to manage workers' lifecycle in a (Node.js) [cluster]. | [![npm](https://img.shields.io/npm/v/@getlarge/nestjs-tools-cluster?style=flat)](https://npmjs.org/package/@getlarge/nestjs-tools-cluster) |
| [ESLint-Rules](./packages/eslint-rules/README.md) | A set of ESLint rules for NestJS applications. | [![npm](https://img.shields.io/npm/v/@getlarge/nestjs-tools-eslint-rules?style=flat)](https://npmjs.org/package/@getlarge/nestjs-tools-eslint-rules) |
| [File-Storage](./packages/file-storage/README.md) | A NestJS module supporting [FS], [S3] and [GCP] strategies. | [![npm](https://img.shields.io/npm/v/@getlarge/nestjs-tools-file-storage?style=flat)](https://npmjs.org/package/@getlarge/nestjs-tools-file-storage) |
| [Lock](./packages/lock/README.md) | A NestJS module to provide a distributed lock for your application. | [![npm](https://img.shields.io/npm/v/@getlarge/nestjs-tools-lock?style=flat)](https://npmjs.org/package/@getlarge/nestjs-tools-lock) |
| [Fastify-Upload](./packages/fastify-upload/README.md) | A NestJS module to provide file upload support for Fastify. | [![npm](https://img.shields.io/npm/v/@getlarge/nestjs-tools-fastify-upload?style=flat)](https://npmjs.org/package/@getlarge/nestjs-tools-fastify-upload) |
Expand Down
6 changes: 6 additions & 0 deletions packages/amqp-transport/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ A custom AMQP strategy for Nest microservice transport, which extends NestJS AMQ

By enabling exchanges you can broadcast messages to multiple queues, and by asserting reply queue you can ensure that reply queue with static name exists.

## Installation

```bash
npm install --save @getlarge/nestjs-tools-amqp-transport
```

## Example

The integration tests contain an [example consumer](./test/dummy-consumer.controller.mock.ts) and [example producer](./test/dummy-producer.service.mock.ts) that demonstrate how to use this library.
2 changes: 1 addition & 1 deletion packages/async-local-storage/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
## Installation

```bash
$ npm install --save @getlarge/nestjs-tools-async-local-storage
npm install --save @getlarge/nestjs-tools-async-local-storage
```

## Usage
Expand Down
2 changes: 1 addition & 1 deletion packages/cluster/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ The `ClusterService` class is a wrapper around the native `cluster` module and p
## Installation

```bash
$ npm install --save @getlarge/nestjs-tools-cluster
npm install --save @getlarge/nestjs-tools-cluster
```

## Example
Expand Down
28 changes: 25 additions & 3 deletions packages/eslint-rules/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,29 @@
# eslint-rules

This library was generated with [Nx](https://nx.dev).
[![npm][npm-image]][npm-url]

## Running unit tests
[npm-image]: https://img.shields.io/npm/v/@getlarge/nestjs-tools-eslint-rules.svg?style=flat
[npm-url]: https://npmjs.org/package/@getlarge/nestjs-tools-eslint-rules

Run `nx test eslint-rules` to execute the unit tests via [Jest](https://jestjs.io).
This set of ESLint rules is provided to enforce a consistent patterns and practices across all NestJS projects.

## Installation

```bash
npm install --save @getlarge/nestjs-tools-eslint-rules
```

## Usage

### return-class-instance

This rule enforces that all public Service methods return a class instance of the same return type.
The purpose of this rule is to ensure you return class instances instead of plain objects, which is essentials when using the [`ClassSerializerInterceptor`](https://docs.nestjs.com/techniques/serialization#class-serializer-interceptor).

```json
{
"rules": {
"@getlarge/nestjs-tools-eslint-rules/return-class-instance": "error",
}
}
```
3 changes: 3 additions & 0 deletions packages/eslint-rules/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
"access": "public"
},
"dependencies": {},
"peerDependencies": {
"eslint": "7 || 8 || 9"
},
"type": "commonjs",
"main": "./src/index.js",
"typings": "./src/index.d.ts"
Expand Down
2 changes: 1 addition & 1 deletion packages/eslint-rules/src/lib/return-class-instance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import { ESLintUtils } from '@typescript-eslint/utils';

// NOTE: The rule will be available in ESLint configs as "@nx/workspace/return-class-instance"
export const RULE_NAME = 'return-class-instance';
export const RULE_NAME = '@getlarge/nestjs-tools-eslint-rules/return-class-instance';

const getTypeNameFromReturnType = (rawReturnType: string) => {
return rawReturnType.replaceAll(/Promise<([^<>]*)>/g, '$1').replace(': ', '');
Expand Down
2 changes: 1 addition & 1 deletion packages/fastify-upload/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Read [this issue](https://github.com/getlarge/nestjs-tools/issues/71) to underst
## Installation

```bash
$ npm install --save @getlarge/nestjs-tools-fastify-upload
npm install --save @getlarge/nestjs-tools-fastify-upload
```

## Usage
Expand Down
4 changes: 2 additions & 2 deletions packages/file-storage/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Supoorted backends:
## Installation

```bash
$ npm install --save @getlarge/nestjs-tools-file-storage
npm install --save @getlarge/nestjs-tools-file-storage
```

## Example
Expand Down Expand Up @@ -122,7 +122,7 @@ The recommended approach is to setup [Application Default Credentials](https://c

If, after upgrading, you get the following error:

```
```sh
/usr/local/bin/node[57897]: ../src/node_http_parser.cc:517:static void node::(anonymous namespace)::Parser::Execute(const FunctionCallbackInfo<v8::Value> &): Assertion `parser->current_buffer_.IsEmpty()' failed.
```
Expand Down
2 changes: 1 addition & 1 deletion packages/lock/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ It is based on [Redlock](https://www.npmjs.com/package/redlock) module.
## Installation

```bash
$ npm install --save @getlarge/nestjs-tools-lock
npm install --save @getlarge/nestjs-tools-lock
```

## Usage
Expand Down

0 comments on commit 9e6da71

Please sign in to comment.