Skip to content

Commit

Permalink
drop support of nestjs<8 and node<16, update ci, deps, readme
Browse files Browse the repository at this point in the history
  • Loading branch information
iamolegga committed Aug 16, 2023
1 parent 25ae7d9 commit fbda0af
Show file tree
Hide file tree
Showing 31 changed files with 4,733 additions and 5,474 deletions.
99 changes: 99 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
module.exports = {
parser: '@typescript-eslint/parser',
parserOptions: {
project: 'tsconfig.json',
sourceType: 'module',
},
plugins: ['@typescript-eslint/eslint-plugin'],
extends: [
'plugin:@typescript-eslint/recommended',
'plugin:import/recommended',
'plugin:import/typescript',
'plugin:prettier/recommended',
],
root: true,
env: {
node: true,
jest: true,
},
ignorePatterns: ['.eslintrc.js'],
rules: {
'@typescript-eslint/no-explicit-any': [
'error',
{ fixToUnknown: true, ignoreRestArgs: false },
],
'@typescript-eslint/no-floating-promises': ['error', { ignoreIIFE: true }],
'@typescript-eslint/no-unused-vars': [
'error',
{ varsIgnorePattern: '^_', argsIgnorePattern: '^_', ignoreRestSiblings: true },
],
'@typescript-eslint/explicit-member-accessibility': [
'error',
{ accessibility: 'no-public' },
],
'@typescript-eslint/member-ordering': ['error', {
default: [
"public-static-field",
"public-static-get",
"public-static-set",
"public-static-method",
"protected-static-field",
"protected-static-get",
"protected-static-set",
"protected-static-method",
"private-static-field",
"private-static-get",
"private-static-set",
"private-static-method",

"signature",
"public-abstract-field",
"protected-abstract-field",
"public-decorated-field",
"public-instance-field",
"protected-decorated-field",
"protected-instance-field",
"private-decorated-field",
"private-instance-field",

"public-constructor",
"protected-constructor",
"private-constructor",

"public-abstract-get",
"public-abstract-set",
"public-abstract-method",
"public-decorated-get",
"public-instance-get",
"public-decorated-set",
"public-instance-set",
"public-decorated-method",
"public-instance-method",

"protected-abstract-get",
"protected-abstract-set",
"protected-abstract-method",
"protected-decorated-get",
"protected-instance-get",
"protected-decorated-set",
"protected-instance-set",
"protected-decorated-method",
"protected-instance-method",

"private-decorated-get",
"private-instance-get",
"private-decorated-set",
"private-instance-set",
"private-decorated-method",
"private-instance-method",
]
}],
'import/order': [
'error',
{
alphabetize: { order: 'asc', caseInsensitive: true },
'newlines-between': 'always',
},
]
},
};
36 changes: 0 additions & 36 deletions .eslintrc.json

This file was deleted.

3 changes: 3 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,6 @@ updates:
interval: daily
time: "02:00"
open-pull-requests-limit: 10
ignore:
- dependency-name: 'typescript'
versions: [">= 5.0.0"]
43 changes: 43 additions & 0 deletions .github/workflows/build-lint-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: build-lint-test

on:
workflow_call:

jobs:
build-lint-test:
strategy:
fail-fast: true
matrix:
nestjs-version:
- "8"
- "9"
- "10"
nodejs-version:
- 16
- 18
- 20

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.nodejs-version }}
- run: npm ci
- run: |
npm i @nestjs/core@${{ matrix.nestjs-version }} \
@nestjs/common@${{ matrix.nestjs-version }} \
@nestjs/platform-express@${{ matrix.nestjs-version }} \
@types/node@${{ matrix.nodejs-version }} \
-D
- run: npm run lint
- uses: actions/cache@v3
with:
path: coverage
key: ${{ github.sha }}-${{ matrix.nestjs-version }}-${{ matrix.nodejs-version }}
- run: npm t
- run: npm run build
55 changes: 0 additions & 55 deletions .github/workflows/ci.yaml

This file was deleted.

11 changes: 11 additions & 0 deletions .github/workflows/on-pr-master.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: on-pr-master

on:
pull_request:
branches:
- master

jobs:
build-lint-test:
uses: ./.github/workflows/build-lint-test.yml
secrets: inherit
24 changes: 24 additions & 0 deletions .github/workflows/on-push-master.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: on-push

on:
push:
branches:
- master

jobs:
build-lint-test:
uses: ./.github/workflows/build-lint-test.yml
secrets: inherit

publish-alpha:
if: github.actor != 'dependabot[bot]' && github.actor != 'mergify[bot]'
needs:
- build-lint-test
uses: ./.github/workflows/publish-alpha.yml
secrets: inherit

coverage:
needs:
- build-lint-test
uses: ./.github/workflows/publish-coverage.yml
secrets: inherit
10 changes: 10 additions & 0 deletions .github/workflows/on-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name: on-release

on:
release:
types: [created]

jobs:
publish-with-git-tag-version:
uses: ./.github/workflows/publish-with-git-tag-version.yml
secrets: inherit
16 changes: 0 additions & 16 deletions .github/workflows/pr-coverage.yaml

This file was deleted.

27 changes: 27 additions & 0 deletions .github/workflows/publish-alpha.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: publish-alpha

on:
workflow_call:

jobs:
publish-alpha:
if: github.ref == 'refs/heads/master' && github.actor != 'dependabot[bot]' && github.actor != 'mergify[bot]'
runs-on: ubuntu-latest
steps:

- uses: actions/checkout@v3
with:
fetch-depth: 0

- uses: actions/setup-node@v3
with:
node-version: 20
registry-url: 'https://registry.npmjs.org'

- run: npm ci

- run: npm version --no-git-tag-version $(git describe --abbrev=0 --tags)-alpha.$(git rev-parse --short=6 ${{ github.sha }}) || true

- run: npm publish --tag alpha || true
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
25 changes: 25 additions & 0 deletions .github/workflows/publish-coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: publish-coverage

on:
workflow_call:

jobs:
publish-coverage:
runs-on: ubuntu-latest
steps:

- uses: actions/checkout@v3
with:
fetch-depth: 0

- uses: actions/cache@v3
with:
path: coverage
# restore cache from build-lint-test wf with key=sha-(oneof nestjs version)-(oneof nodejs version)
key: ${{ github.sha }}-10-20

- uses: paambaati/codeclimate-action@v2.7.5
with:
coverageLocations: ${{github.workspace}}/coverage/lcov.info:lcov
env:
CC_TEST_REPORTER_ID: ${{ secrets.CODE_CLIMATE_REPORTER_ID }}
35 changes: 35 additions & 0 deletions .github/workflows/publish-with-git-tag-version.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: publish-with-git-tag-version

on:
workflow_call:

jobs:
publish-with-git-tag-version:
runs-on: ubuntu-latest
steps:

- uses: actions/checkout@v3
with:
fetch-depth: 0

- uses: actions/setup-node@v3
with:
node-version: 20
registry-url: 'https://registry.npmjs.org'

- run: npm ci

- run: npm version --no-git-tag-version $(git describe --abbrev=0 --tags)

- run: |
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git commit -m "update version" -a
- uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}

- run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
Loading

0 comments on commit fbda0af

Please sign in to comment.