Skip to content

Commit

Permalink
Merge branch 'master' into fix-global-prefix-middleware
Browse files Browse the repository at this point in the history
  • Loading branch information
CodyTseng committed Mar 6, 2024
2 parents 16106e0 + 7f00840 commit 8769a9d
Show file tree
Hide file tree
Showing 262 changed files with 109,180 additions and 78,148 deletions.
162 changes: 104 additions & 58 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,31 @@
version: 2
version: 2.1

parameters:
check-legacy-node-version:
type: boolean
default: false
legacy-node-version:
type: string
default: '14.21.3'
maintenance-node-version:
type: string
default: '16.20'
active-node-version:
type: string
default: '18.17'
current-node-version:
type: string
default: '20.5'

aliases:
- &restore-cache
restore_cache:
key: dependency-cache-{{ checksum "package.json" }}
- &save-cache
save_cache:
key: dependency-cache-{{ checksum "package.json" }}
paths:
- ./node_modules
- &install-deps
run:
name: Install dependencies
Expand All @@ -17,70 +39,89 @@ aliases:
name: Test
command: npm run test

unit-tests-template: &unit-tests-template
working_directory: ~/nest
steps:
- checkout
- *restore-cache
- *install-deps
- *build-packages
- *run-unit-tests

jobs:
build:
working_directory: ~/nest
docker:
- image: cimg/node:16.20
- image: cimg/node:<< pipeline.parameters.maintenance-node-version >>
steps:
- checkout
- run:
name: Update NPM version
command: 'sudo npm install -g npm@^8'
- restore_cache:
key: dependency-cache-{{ checksum "package.json" }}
- run:
name: Install dependencies
command: npm ci --legacy-peer-deps
- save_cache:
key: dependency-cache-{{ checksum "package.json" }}
paths:
- ./node_modules
- run:
name: Build
command: npm run build

test_node_16:
working_directory: ~/nest
docker:
- image: cimg/node:16.20
steps:
- checkout
command: 'sudo npm install -g npm@^9'
- *restore-cache
- *install-deps
- *save-cache
- *build-packages
- run:
name: Test (coverage)
command: npm run test:cov
- run:
name: Collect coverage
command: npm run coverage
- store_artifacts:
path: coverage

test_node_18:
<<: *unit-tests-template
docker:
- image: cimg/node:18.16

test_node_19:
<<: *unit-tests-template
test:
parameters:
node-version:
type: string
working_directory: ~/nest
docker:
- image: cimg/node:19.9
- image: cimg/node:<< parameters.node-version >>
steps:
- when:
condition:
and:
- equal:
[
'<< parameters.node-version >>',
'<< pipeline.parameters.legacy-node-version >>',
]
- not: << pipeline.parameters.check-legacy-node-version >>
steps:
- run:
name: Skip
command: |
echo Skipping
- when:
condition:
or:
- not:
equal:
[
'<< parameters.node-version >>',
'<< pipeline.parameters.legacy-node-version >>',
]
- << pipeline.parameters.check-legacy-node-version >>
steps:
- checkout
- *restore-cache
- *install-deps
- *build-packages
- when:
condition:
equal:
[
'<< parameters.node-version >>',
'<< pipeline.parameters.maintenance-node-version >>',
]
steps:
- run:
name: Test (coverage)
command: npm run test:cov
- run:
name: Collect coverage
command: npm run coverage
- store_artifacts:
path: coverage
- when:
condition:
not:
equal:
[
'<< parameters.node-version >>',
'<< pipeline.parameters.maintenance-node-version >>',
]
steps:
- *run-unit-tests

lint:
working_directory: ~/nest
docker:
- image: circleci/node:16
- image: cimg/node:<< pipeline.parameters.maintenance-node-version >>
steps:
- checkout
- *restore-cache
Expand All @@ -105,9 +146,9 @@ jobs:
- run:
name: Upgrade Node.js
command: |
nvm install v16
nvm install << pipeline.parameters.maintenance-node-version >>
node -v
nvm alias default v16
nvm alias default << pipeline.parameters.maintenance-node-version >>
- run:
name: Install Docker Compose
command: |
Expand All @@ -130,7 +171,7 @@ jobs:
codechecks_benchmarks:
working_directory: ~/nest
docker:
- image: cimg/node:16.20
- image: cimg/node:<< pipeline.parameters.maintenance-node-version >>
steps:
- checkout
- *restore-cache
Expand All @@ -146,9 +187,9 @@ jobs:
samples:
working_directory: ~/nest
docker:
- image: cimg/node:16.20
- image: cimg/node:<< pipeline.parameters.maintenance-node-version >>
environment:
- DISABLE_OPENCOLLECTIVE: true
DISABLE_OPENCOLLECTIVE: 'true'
steps:
- checkout
- *restore-cache
Expand All @@ -158,16 +199,21 @@ jobs:
command: npm run build:samples

workflows:
version: 2
build-and-test:
jobs:
- build
- test_node_16:
requires:
- build
- test_node_18:
- test:
requires:
- build
matrix:
parameters:
node-version:
[
'<< pipeline.parameters.legacy-node-version >>',
'<< pipeline.parameters.maintenance-node-version >>',
'<< pipeline.parameters.active-node-version >>',
'<< pipeline.parameters.current-node-version >>',
]
- lint:
requires:
- build
Expand Down
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ module.exports = {
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/no-unused-vars': 'off',
'@typescript-eslint/ban-types': 'off',
'@typescript-eslint/no-array-constructor': 'off',
},
},
{
Expand Down
6 changes: 4 additions & 2 deletions .github/ISSUE_TEMPLATE/Bug_report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,17 @@ body:
required: true
attributes:
label: "Minimum reproduction code"
description: "An URL to some Git repository/[StackBlitz](https://stackblitz.com/fork/github/nestjs/typescript-starter)/[CodeSandbox](https://codesandbox.io/s/github/nestjs/typescript-starter/tree/master) project that reproduces your issue. [Wtf is a minimum reproduction?](https://jmcdo29.github.io/wtf-is-a-minimum-reproduction)"
description: |
An URL to some Git repository/[StackBlitz](https://stackblitz.com/fork/github/nestjs/typescript-starter)/[CodeSandbox](https://codesandbox.io/s/github/nestjs/typescript-starter/tree/master) project that reproduces your issue. [What is a minimum reproduction?](https://jmcdo29.github.io/wtf-is-a-minimum-reproduction)
:warning: **NOTE:** We can close this issue if we don't manage to reproduce your potential bug. [Here](https://antfu.me/posts/why-reproductions-are-required) is why.
placeholder: "https://github.com/..."

- type: textarea
attributes:
label: "Steps to reproduce"
description: |
How the issue manifests?
You could leave this blank if you alread write this in your reproduction code
You could leave this blank if you already write this in your reproduction code
placeholder: |
1. `npm ci`
2. `npm start:dev`
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
# We must fetch at least the immediate parents so that if this is
# a pull request then we can checkout the head.
Expand All @@ -34,7 +34,7 @@ jobs:

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
uses: github/codeql-action/init@v3
with:
queries: +security-extended
# Override language selection by uncommenting this and choosing your languages
Expand All @@ -44,7 +44,7 @@ jobs:
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v2
uses: github/codeql-action/autobuild@v3

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl
Expand All @@ -58,4 +58,4 @@ jobs:
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
uses: github/codeql-action/analyze@v3
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ node_modules/
/.awcache
/.vscode
/.devcontainer
/.classpath
/.project
/.settings
*.code-workspace

# Vim
Expand Down
3 changes: 0 additions & 3 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npx --no-install commitlint --edit $1
3 changes: 0 additions & 3 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npx lint-staged
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ You will need [Node.js](https://nodejs.org) version >= 10.13.0 (except for v13).
1. After cloning the repo, run:
```bash
$ npm ci # (or yarn install)
$ npm ci --legacy-peer-deps # (or yarn install)
```
2. In order to prepare your environment run `prepare.sh` shell script:
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
(The MIT License)

Copyright (c) 2017-2023 Kamil Mysliwiec <https://kamilmysliwiec.com>
Copyright (c) 2017-2024 Kamil Mysliwiec <https://kamilmysliwiec.com>

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
Expand Down
Loading

0 comments on commit 8769a9d

Please sign in to comment.