Skip to content

Commit

Permalink
Merge branch 'main' of github.com:getlarge/nestjs-tools
Browse files Browse the repository at this point in the history
  • Loading branch information
getlarge committed Apr 16, 2024
2 parents 936f649 + 13151f9 commit d10492c
Show file tree
Hide file tree
Showing 138 changed files with 19,641 additions and 2,972 deletions.
3 changes: 3 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node_modules
dist
build
113 changes: 113 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
{
"root": true,
"ignorePatterns": ["**/*"],
"plugins": ["@nx"],
"overrides": [
{
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
"rules": {
"@nx/enforce-module-boundaries": [
"error",
{
"enforceBuildableLibDependency": true,
"allow": [],
"depConstraints": [
{
"sourceTag": "*",
"onlyDependOnLibsWithTags": ["*"]
}
]
}
]
}
},
{
"files": ["*.ts", "*.tsx"],
"extends": ["plugin:@nx/typescript", "eslint:recommended", "plugin:@typescript-eslint/recommended"],
"plugins": [
"@typescript-eslint/eslint-plugin",
"unused-imports",
"import",
"max-params-no-constructor",
"simple-import-sort"
],
"rules": {
"arrow-parens": "off",
"complexity": "error",
"interface-name": "off",
"max-depth": "error",
"max-lines": [
"error",
{
"max": 400
}
],
"max-lines-per-function": [
"error",
{
"max": 50
}
],
"max-nested-callbacks": [
"error",
{
"max": 3
}
],
"max-params": ["error", 10],
"max-params-no-constructor/max-params-no-constructor": ["error", 4],
"member-access": "off",
"no-console": [
"error",
{
"allow": ["error", "warn", "info", "table"]
}
],
"no-duplicate-imports": "error",
"no-empty": "error",
"no-fallthrough": "error",
"no-param-reassign": "error",
"no-unreachable": "error",
"no-unreachable-loop": "error",
"no-var": "error",
"object-literal-sort-keys": "off",
"prefer-const": "error",
"quotes": [
"warn",
"single",
{
"avoidEscape": true
}
],
"simple-import-sort/imports": [
"error",
{
"groups": [
// Side effects.
["^\\u0000"],
// 3rd party.
["^@?\\w"],
// Anything not fitting group above.
["^"],
// Relative imports.
["^\\."]
]
}
],
"simple-import-sort/exports": "error"
}
},
{
"files": ["*.js", "*.jsx"],
"extends": ["plugin:@nx/javascript"],
"rules": {}
},
{
"files": ["*.spec.ts", "*.spec.tsx", "*.spec.js", "*.spec.jsx"],
"env": {
"jest": true
},
"rules": {}
}
]
}
29 changes: 29 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Description

<!--
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.
Fixes # (issue)
-->

## Type of change

Please delete options that are not relevant.

- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
- [ ] Dependencies update
- [ ] Refactor (a code change that neither fixes a bug nor adds a feature)
- [ ] This change requires a documentation update

## Checklist:

- [ ] My code follows the style guidelines of this project
- [ ] I have performed a self-review of my own code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [ ] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my feature works
- [ ] New and existing unit tests pass locally with my changes
- [ ] Any dependent changes have been merged and published in downstream modules
139 changes: 139 additions & 0 deletions .github/workflows/node.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
name: NestJS Tools CI

on:
push:
paths-ignore:
- 'README.md'
- '**/package-lock.json'
branches:
- main
pull_request:
types:
- opened
- reopened
- synchronize
- ready_for_review
paths-ignore:
- 'README.md'
- '**/package-lock.json'
branches:
- main

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

env:
NX_CLOUD_DISTRIBUTED_EXECUTION: false
NX_DISTRIBUTED_TASK_EXECUTION: false
CI: true

jobs:
setup-and-test:
runs-on: ubuntu-latest
if: ${{ github.event_name == 'push' || !github.event.pull_request.draft }}
timeout-minutes: 10

strategy:
matrix:
node-version: [18.x, 20.x]

services:
rabbitmq:
image: rabbitmq:3.9-management-alpine
options: >-
--health-cmd "rabbitmq-diagnostics status"
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5672:5672

steps:
- name: Check out repository code
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.head_ref }}

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

- name: Derive appropriate SHAs for base and head for `nx affected` commands
id: set-sha
uses: nrwl/nx-set-shas@v4

- name: Install dependencies
run: npm ci

- uses: 8BitJonny/gh-get-current-pr@3.0.0
id: current-pr

- if: steps.current-pr.outputs.number != 'null' && github.ref_name != 'main'
# This line is needed for nx affected to work when CI is running on a PR
run: git branch --track main origin/main

# Boot package has issues with @asyncapi monorepo
# - name: Scan dependencies with Audit CI
# run: npm run scan:deps

- run: npx nx format:check

- name: Run checks
env:
CI: true
S3_ACCESS_KEY_ID: ${{ secrets.S3_ACCESS_KEY_ID }}
S3_BUCKET: ${{ secrets.S3_BUCKET }}
S3_REGION: ${{ secrets.S3_REGION }}
S3_ENDPOINT: ${{ secrets.S3_ENDPOINT }}
S3_SECRET_ACCESS_KEY: ${{ secrets.S3_SECRET_ACCESS_KEY }}
run: npx nx affected -t lint,test,build --parallel=3

- name: Upload coverage
uses: actions/upload-artifact@v4
with:
name: coverage-${{ matrix.node-version }}
path: ./coverage
retention-days: 2

scan:
needs: setup-and-test
runs-on: ubuntu-latest
timeout-minutes: 10

strategy:
matrix:
node-version: [18.x]

steps:
- name: Check out repository code
uses: actions/checkout@v4
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis

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

- name: Get current version
id: package-version
uses: martinbeentjes/npm-get-version-action@main

- name: Retrieve coverage
uses: actions/download-artifact@v4
with:
name: coverage-${{ matrix.node-version }}
path: ./coverage

- name: SonarCloud Scan
uses: sonarsource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
with:
args: >
-Dsonar.projectVersion=${{ steps.package-version.outputs.current-version }}
Loading

0 comments on commit d10492c

Please sign in to comment.