Skip to content

fix: Improve codebase,readme,ci #3

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

Merged
merged 5 commits into from
Jul 14, 2025
Merged
Show file tree
Hide file tree
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
31 changes: 31 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Check CI

on:
pull_request:
types: [opened, edited, synchronize]

permissions:
pull-requests: read
contents: read

jobs:
ci:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: 23

- name: Install dependencies
run: yarn

- name: Build project
run: yarn build

- name: Run CI
run: yarn ci
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
/node_modules
/build

yarn.lock
package-lock.json
# Logs
logs
*.log
Expand Down
18 changes: 12 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@nestjstools/messaging-redis-extension",
"version": "1.2.1",
"version": "1.2.2",
"description": "Extension to handle messages and dispatch them over Redis",
"author": "Sebastian Iwanczyszyn",
"private": false,
Expand Down Expand Up @@ -35,22 +35,22 @@
],
"scripts": {
"build": "nest build",
"format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
"prettier": "prettier --check \"src/**/*.ts\"",
"prettier:fix": "prettier --write \"src/**/*.ts\"",
"start": "nest start",
"start:dev": "nest start --watch",
"start:debug": "nest start --debug --watch",
"start:prod": "node dist/main",
"lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix",
"ci": "yarn prettier",
"test": "jest",
"test:watch": "jest --watch",
"test:cov": "jest --coverage",
"test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand",
"test:e2e": "jest --config ./test/jest-e2e.json"
},
"dependencies": {
"@semantic-release/github": "^11.0.3",
"bullmq": "^5.52.2",
"semantic-release": "^24.2.5"
"bullmq": "^5.52.2"
},
"peerDependencies": {
"@nestjs/common": "^10.x||^11.x",
Expand All @@ -60,10 +60,16 @@
"rxjs": "^7.x"
},
"devDependencies": {
"reflect-metadata": "^0.2.0",
"rxjs": "^7.x",
"@nestjs/common": "^10.0.0",
"@nestjs/core": "^10.0.0",
"semantic-release": "^24.2.5",
"@semantic-release/github": "^11.0.3",
"@nestjs/cli": "^10.0.0",
"@nestjs/schematics": "^10.0.0",
"@nestjs/testing": "^10.0.0",
"@nestjstools/messaging": "^2.16.0",
"@nestjstools/messaging": "^2.20.2",
"@types/express": "^5.0.0",
"@types/jest": "^29.5.2",
"@types/node": "^20.3.1",
Expand Down
5 changes: 5 additions & 0 deletions src/channel/redis.channel-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ import { ChannelConfig } from '@nestjstools/messaging';
export class RedisChannelConfig extends ChannelConfig {
public readonly connection: Connection;
public readonly queue: string;
/**
* @description
* This prefix is not used as RedisOptions keyPrefix, it is used as prefix for BullMQ
* Read more: https://github.com/taskforcesh/bullmq/issues/1219#issuecomment-1113903785
*/
public readonly keyPrefix?: string;

constructor({
Expand Down
3 changes: 3 additions & 0 deletions src/consumer/redis-messaging.consumer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,13 @@ export class RedisMessagingConsumer
errored: ConsumerDispatchedMessageError,
channel: RedisChannel,
): Promise<void> {
void errored;
void channel;
return Promise.resolve();
}

async onApplicationShutdown(signal?: string): Promise<any> {
void signal;
if (this.channel) {
await this.worker.close();
await this.channel.queue.close();
Expand Down
5 changes: 4 additions & 1 deletion src/message-bus/redis-message.bus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ export class RedisMessageBus implements IMessageBus {
constructor(private readonly redisChannel: RedisChannel) {}

async dispatch(message: RoutingMessage): Promise<void> {
await this.redisChannel.queue.add(message.messageRoutingKey, message.message);
await this.redisChannel.queue.add(
message.messageRoutingKey,
message.message,
);
}
}
24 changes: 0 additions & 24 deletions test/app.e2e-spec.ts

This file was deleted.

9 changes: 0 additions & 9 deletions test/jest-e2e.json

This file was deleted.

2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"compilerOptions": {
"module": "commonjs",
"declaration": true,
"removeComments": true,
"removeComments": false,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"allowSyntheticDefaultImports": true,
Expand Down
Loading