Skip to content

Commit d10492c

Browse files
committed
Merge branch 'main' of github.com:getlarge/nestjs-tools
2 parents 936f649 + 13151f9 commit d10492c

File tree

138 files changed

+19641
-2972
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

138 files changed

+19641
-2972
lines changed

.eslintignore

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
node_modules
2+
dist
3+
build

.eslintrc.json

+113
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
{
2+
"root": true,
3+
"ignorePatterns": ["**/*"],
4+
"plugins": ["@nx"],
5+
"overrides": [
6+
{
7+
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
8+
"rules": {
9+
"@nx/enforce-module-boundaries": [
10+
"error",
11+
{
12+
"enforceBuildableLibDependency": true,
13+
"allow": [],
14+
"depConstraints": [
15+
{
16+
"sourceTag": "*",
17+
"onlyDependOnLibsWithTags": ["*"]
18+
}
19+
]
20+
}
21+
]
22+
}
23+
},
24+
{
25+
"files": ["*.ts", "*.tsx"],
26+
"extends": ["plugin:@nx/typescript", "eslint:recommended", "plugin:@typescript-eslint/recommended"],
27+
"plugins": [
28+
"@typescript-eslint/eslint-plugin",
29+
"unused-imports",
30+
"import",
31+
"max-params-no-constructor",
32+
"simple-import-sort"
33+
],
34+
"rules": {
35+
"arrow-parens": "off",
36+
"complexity": "error",
37+
"interface-name": "off",
38+
"max-depth": "error",
39+
"max-lines": [
40+
"error",
41+
{
42+
"max": 400
43+
}
44+
],
45+
"max-lines-per-function": [
46+
"error",
47+
{
48+
"max": 50
49+
}
50+
],
51+
"max-nested-callbacks": [
52+
"error",
53+
{
54+
"max": 3
55+
}
56+
],
57+
"max-params": ["error", 10],
58+
"max-params-no-constructor/max-params-no-constructor": ["error", 4],
59+
"member-access": "off",
60+
"no-console": [
61+
"error",
62+
{
63+
"allow": ["error", "warn", "info", "table"]
64+
}
65+
],
66+
"no-duplicate-imports": "error",
67+
"no-empty": "error",
68+
"no-fallthrough": "error",
69+
"no-param-reassign": "error",
70+
"no-unreachable": "error",
71+
"no-unreachable-loop": "error",
72+
"no-var": "error",
73+
"object-literal-sort-keys": "off",
74+
"prefer-const": "error",
75+
"quotes": [
76+
"warn",
77+
"single",
78+
{
79+
"avoidEscape": true
80+
}
81+
],
82+
"simple-import-sort/imports": [
83+
"error",
84+
{
85+
"groups": [
86+
// Side effects.
87+
["^\\u0000"],
88+
// 3rd party.
89+
["^@?\\w"],
90+
// Anything not fitting group above.
91+
["^"],
92+
// Relative imports.
93+
["^\\."]
94+
]
95+
}
96+
],
97+
"simple-import-sort/exports": "error"
98+
}
99+
},
100+
{
101+
"files": ["*.js", "*.jsx"],
102+
"extends": ["plugin:@nx/javascript"],
103+
"rules": {}
104+
},
105+
{
106+
"files": ["*.spec.ts", "*.spec.tsx", "*.spec.js", "*.spec.jsx"],
107+
"env": {
108+
"jest": true
109+
},
110+
"rules": {}
111+
}
112+
]
113+
}

.github/PULL_REQUEST_TEMPLATE.md

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Description
2+
3+
<!--
4+
Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.
5+
6+
Fixes # (issue)
7+
-->
8+
9+
## Type of change
10+
11+
Please delete options that are not relevant.
12+
13+
- [ ] Bug fix (non-breaking change which fixes an issue)
14+
- [ ] New feature (non-breaking change which adds functionality)
15+
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
16+
- [ ] Dependencies update
17+
- [ ] Refactor (a code change that neither fixes a bug nor adds a feature)
18+
- [ ] This change requires a documentation update
19+
20+
## Checklist:
21+
22+
- [ ] My code follows the style guidelines of this project
23+
- [ ] I have performed a self-review of my own code
24+
- [ ] I have commented my code, particularly in hard-to-understand areas
25+
- [ ] I have made corresponding changes to the documentation
26+
- [ ] My changes generate no new warnings
27+
- [ ] I have added tests that prove my fix is effective or that my feature works
28+
- [ ] New and existing unit tests pass locally with my changes
29+
- [ ] Any dependent changes have been merged and published in downstream modules

.github/workflows/node.yml

+139
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
name: NestJS Tools CI
2+
3+
on:
4+
push:
5+
paths-ignore:
6+
- 'README.md'
7+
- '**/package-lock.json'
8+
branches:
9+
- main
10+
pull_request:
11+
types:
12+
- opened
13+
- reopened
14+
- synchronize
15+
- ready_for_review
16+
paths-ignore:
17+
- 'README.md'
18+
- '**/package-lock.json'
19+
branches:
20+
- main
21+
22+
concurrency:
23+
group: ${{ github.workflow }}-${{ github.ref }}
24+
cancel-in-progress: true
25+
26+
env:
27+
NX_CLOUD_DISTRIBUTED_EXECUTION: false
28+
NX_DISTRIBUTED_TASK_EXECUTION: false
29+
CI: true
30+
31+
jobs:
32+
setup-and-test:
33+
runs-on: ubuntu-latest
34+
if: ${{ github.event_name == 'push' || !github.event.pull_request.draft }}
35+
timeout-minutes: 10
36+
37+
strategy:
38+
matrix:
39+
node-version: [18.x, 20.x]
40+
41+
services:
42+
rabbitmq:
43+
image: rabbitmq:3.9-management-alpine
44+
options: >-
45+
--health-cmd "rabbitmq-diagnostics status"
46+
--health-interval 10s
47+
--health-timeout 5s
48+
--health-retries 5
49+
ports:
50+
- 5672:5672
51+
52+
steps:
53+
- name: Check out repository code
54+
uses: actions/checkout@v4
55+
with:
56+
fetch-depth: 0
57+
ref: ${{ github.head_ref }}
58+
59+
- name: Use Node.js ${{ matrix.node-version }}
60+
uses: actions/setup-node@v4
61+
with:
62+
node-version: ${{ matrix.node-version }}
63+
cache: 'npm'
64+
65+
- name: Derive appropriate SHAs for base and head for `nx affected` commands
66+
id: set-sha
67+
uses: nrwl/nx-set-shas@v4
68+
69+
- name: Install dependencies
70+
run: npm ci
71+
72+
- uses: 8BitJonny/[email protected]
73+
id: current-pr
74+
75+
- if: steps.current-pr.outputs.number != 'null' && github.ref_name != 'main'
76+
# This line is needed for nx affected to work when CI is running on a PR
77+
run: git branch --track main origin/main
78+
79+
# Boot package has issues with @asyncapi monorepo
80+
# - name: Scan dependencies with Audit CI
81+
# run: npm run scan:deps
82+
83+
- run: npx nx format:check
84+
85+
- name: Run checks
86+
env:
87+
CI: true
88+
S3_ACCESS_KEY_ID: ${{ secrets.S3_ACCESS_KEY_ID }}
89+
S3_BUCKET: ${{ secrets.S3_BUCKET }}
90+
S3_REGION: ${{ secrets.S3_REGION }}
91+
S3_ENDPOINT: ${{ secrets.S3_ENDPOINT }}
92+
S3_SECRET_ACCESS_KEY: ${{ secrets.S3_SECRET_ACCESS_KEY }}
93+
run: npx nx affected -t lint,test,build --parallel=3
94+
95+
- name: Upload coverage
96+
uses: actions/upload-artifact@v4
97+
with:
98+
name: coverage-${{ matrix.node-version }}
99+
path: ./coverage
100+
retention-days: 2
101+
102+
scan:
103+
needs: setup-and-test
104+
runs-on: ubuntu-latest
105+
timeout-minutes: 10
106+
107+
strategy:
108+
matrix:
109+
node-version: [18.x]
110+
111+
steps:
112+
- name: Check out repository code
113+
uses: actions/checkout@v4
114+
with:
115+
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
116+
117+
- name: Use Node.js ${{ matrix.node-version }}
118+
uses: actions/setup-node@v4
119+
with:
120+
node-version: ${{ matrix.node-version }}
121+
122+
- name: Get current version
123+
id: package-version
124+
uses: martinbeentjes/npm-get-version-action@main
125+
126+
- name: Retrieve coverage
127+
uses: actions/download-artifact@v4
128+
with:
129+
name: coverage-${{ matrix.node-version }}
130+
path: ./coverage
131+
132+
- name: SonarCloud Scan
133+
uses: sonarsource/sonarcloud-github-action@master
134+
env:
135+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
136+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
137+
with:
138+
args: >
139+
-Dsonar.projectVersion=${{ steps.package-version.outputs.current-version }}

0 commit comments

Comments
 (0)