Skip to content

Commit

Permalink
feat!: introduce nestjs-sqs v3 (#85)
Browse files Browse the repository at this point in the history
* chore(ci)!: drop support for node v16, adding node v22

* chore(deps)!: bump sqs-consumer to v11, use vitest and biome

* chore(ci): enrich emq config

* feat(test): apply vitest

* refactor: apply Biome lint and format

* chore(ci): run tests on ubuntu 24.04

* docs: update install command

* chore(ci): run tests before publish
  • Loading branch information
ssut authored Jul 14, 2024
1 parent 956d052 commit dfc671e
Show file tree
Hide file tree
Showing 26 changed files with 2,546 additions and 4,632 deletions.
8 changes: 0 additions & 8 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -1,14 +1,6 @@
# http://editorconfig.org
root = true

[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

# Use 4 spaces for the Python files
[*.py]
indent_size = 4
Expand Down
1 change: 0 additions & 1 deletion .eslintignore

This file was deleted.

26 changes: 0 additions & 26 deletions .eslintrc.js

This file was deleted.

20 changes: 20 additions & 0 deletions .github/build/elasticmq.conf
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
include classpath("application.conf")

node-address {
protocol = http
host = localhost
port = 9324
context-path = ""
}

rest-sqs {
enabled = true
bind-port = 9324
bind-hostname = "0.0.0.0"
# Possible values: relaxed, strict
sqs-limits = strict
}

akka.http.server.request-timeout = 30 seconds

queues {
Expand All @@ -20,3 +35,8 @@ queues {
fifo = true
}
}

aws {
region = us-west-2
accountId = 000000000000
}
44 changes: 43 additions & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,50 @@ on:
types: [created]

jobs:
test:
runs-on: ubuntu-24.04
strategy:
matrix:
node-version:
- 18.x
- 20.x
- 22.x
services:
elasticmq:
image: softwaremill/elasticmq
options: -p 9324:9324 --name elasticmq
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: ElasticMQ Configuration
run: |
cp ${{ github.workspace }}/.github/build/elasticmq.conf /tmp/elasticmq.conf
docker cp /tmp/elasticmq.conf elasticmq:/opt/elasticmq.conf
docker restart elasticmq
- name: Setup pnpm
uses: pnpm/action-setup@v4

- uses: actions/setup-node@v4
name: Use Node.js ${{ matrix.node-version }}
with:
node-version: ${{ matrix.node-version }}
cache: 'pnpm'

- name: Install Dependencies
run: pnpm install

- name: Check lint
run: pnpm biome ci

- name: Run Tests
run: pnpm run test:e2e


publish-npm:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
needs: test
permissions:
contents: read
id-token: write
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ on: push

jobs:
test:
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04

strategy:
matrix:
node-version:
- 16.x
- 18.x
- 20.x
- 22.x

services:
elasticmq:
Expand All @@ -20,7 +20,7 @@ jobs:

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

- name: ElasticMQ Configuration
run: |
Expand All @@ -29,9 +29,9 @@ jobs:
docker restart elasticmq
- name: Setup pnpm
uses: pnpm/action-setup@v2
uses: pnpm/action-setup@v4

- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
name: Use Node.js ${{ matrix.node-version }}
with:
node-version: ${{ matrix.node-version }}
Expand All @@ -41,7 +41,7 @@ jobs:
run: pnpm install

- name: Check lint
run: pnpm run lint
run: pnpm biome ci

- name: Run Tests
run: pnpm run test:e2e
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -75,4 +75,5 @@ Temporary Items
dist/
node_modules/

*.tgz
*.tgz
tsconfig.vitest-temp.json
2 changes: 0 additions & 2 deletions .prettierignore

This file was deleted.

8 changes: 0 additions & 8 deletions .prettierrc

This file was deleted.

15 changes: 13 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
{
"typescript.tsdk": "node_modules/typescript/lib"
}
"typescript.tsdk": "node_modules/typescript/lib",
"eslint.enable": false,
"prettier.enable": false,
"biome.enabled": true,
"[json]": {
"editor.defaultFormatter": "biomejs.biome"
},
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "never",
"quickfix.biome": "always",
"source.organizeImports.biome": "always"
}
}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ This library internally uses [bbc/sqs-producer](https://github.com/bbc/sqs-produ
## Installation

```shell script
$ npm i --save @ssut/nestjs-sqs
npm i --save @ssut/nestjs-sqs @aws-sdk/client-sqs
```

## Quick Start
Expand Down
21 changes: 21 additions & 0 deletions auto-imports.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/* eslint-disable */
/* prettier-ignore */
// @ts-nocheck
// noinspection JSUnusedGlobalSymbols
// Generated by unplugin-auto-import
export {}
declare global {
const afterAll: typeof import('vitest')['afterAll']
const afterEach: typeof import('vitest')['afterEach']
const assert: typeof import('vitest')['assert']
const beforeAll: typeof import('vitest')['beforeAll']
const beforeEach: typeof import('vitest')['beforeEach']
const chai: typeof import('vitest')['chai']
const describe: typeof import('vitest')['describe']
const expect: typeof import('vitest')['expect']
const it: typeof import('vitest')['it']
const suite: typeof import('vitest')['suite']
const test: typeof import('vitest')['test']
const vi: typeof import('vitest')['vi']
const vitest: typeof import('vitest')['vitest']
}
60 changes: 60 additions & 0 deletions biome.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
{
"$schema": "./node_modules/@biomejs/biome/configuration_schema.json",
"files": {
"include": ["e2e/**/*.ts", "lib/**/*.ts"],
"ignore": ["dist/"]
},
"formatter": {
"enabled": true,
"indentStyle": "space",
"lineWidth": 120,
"formatWithErrors": false,
"lineEnding": "lf"
},
"organizeImports": {
"enabled": true
},
"javascript": {
"formatter": {
"lineWidth": 120,
"semicolons": "always",
"quoteStyle": "single",
"arrowParentheses": "always",
"jsxQuoteStyle": "double"
},
"parser": {
"unsafeParameterDecoratorsEnabled": true
}
},
"linter": {
"enabled": true,
"rules": {
"recommended": false,
"complexity": {
"noBannedTypes": "error",
"noUselessTypeConstraint": "error"
},
"correctness": {
"noPrecisionLoss": "error",
"noUnusedVariables": "warn",
"useArrayLiterals": "off"
},
"style": {
"noInferrableTypes": "off",
"noNamespace": "error",
"noNonNullAssertion": "warn",
"useAsConstAssertion": "error",
"useBlockStatements": "off",
"useConst": "warn"
},
"suspicious": {
"noAssignInExpressions": "warn",
"noExplicitAny": "off",
"noExtraNonNullAssertion": "error",
"noMisleadingInstantiator": "error",
"noUnsafeDeclarationMerging": "error",
"useGetterReturn": "off"
}
}
}
}
14 changes: 0 additions & 14 deletions e2e/jest-e2e.json

This file was deleted.

Loading

0 comments on commit dfc671e

Please sign in to comment.