Skip to content

Commit

Permalink
Merge pull request #68 from getlarge/67-chore-move-to-nx-workspace
Browse files Browse the repository at this point in the history
chore: move to nx workspace
  • Loading branch information
getlarge authored Apr 16, 2024
2 parents 2b95a1b + 8644024 commit 13151f9
Show file tree
Hide file tree
Showing 190 changed files with 13,137 additions and 52,509 deletions.
75 changes: 0 additions & 75 deletions .eslintrc.js

This file was deleted.

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": {}
}
]
}
49 changes: 22 additions & 27 deletions .github/workflows/node.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ on:
push:
paths-ignore:
- 'README.md'
- 'renovate.json'
- '**/package-lock.json'
branches:
- main
Expand All @@ -16,7 +15,6 @@ on:
- ready_for_review
paths-ignore:
- 'README.md'
- 'renovate.json'
- '**/package-lock.json'
branches:
- main
Expand All @@ -38,7 +36,7 @@ jobs:

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

services:
rabbitmq:
Expand All @@ -53,51 +51,49 @@ jobs:

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

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

- name: Cache Node.js modules
uses: actions/cache@v3
with:
path: ~/.npm
key: ${{ runner.OS }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.OS }}-node-
${{ runner.OS }}-
cache: 'npm'

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

- name: Install dependencies
run: npm run bootstrap
run: npm ci

- uses: 8BitJonny/[email protected]
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: npm run scan:deps

- name: Build packages
run: npm run build:affected
- run: npx nx format:check

- name: Run Jest tests
run: npm run test:cov:affected
- 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@v3
uses: actions/upload-artifact@v4
with:
name: coverage-${{ matrix.node-version }}
path: ./coverage
Expand All @@ -110,16 +106,16 @@ jobs:

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

steps:
- name: Check out repository code
uses: actions/checkout@v3
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@v3
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}

Expand All @@ -128,7 +124,7 @@ jobs:
uses: martinbeentjes/npm-get-version-action@main

- name: Retrieve coverage
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: coverage-${{ matrix.node-version }}
path: ./coverage
Expand All @@ -137,7 +133,6 @@ jobs:
uses: sonarsource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_URL: ${{ secrets.SONAR_URL }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
with:
args: >
Expand Down
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -109,4 +109,8 @@ dist
# Sonar scanner
.scannerwork

junit.xml
junit.xml

#Nx
.tmp/
.nx/cache
4 changes: 4 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Add files here to ignore them from prettier formatting
/dist
/coverage
/.nx/cache
11 changes: 11 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"singleQuote": true,
"arrowParens": "always",
"bracketSpacing": true,
"endOfLine": "auto",
"useTabs": false,
"semi": true,
"trailingComma": "all",
"tabWidth": 2,
"printWidth": 120
}
11 changes: 0 additions & 11 deletions .prettierrc.js

This file was deleted.

3 changes: 3 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"recommendations": ["nrwl.angular-console", "esbenp.prettier-vscode", "firsttris.vscode-jest-runner"]
}
Loading

0 comments on commit 13151f9

Please sign in to comment.