Skip to content

Commit

Permalink
Merge branch 'feat/github-workflow-testing' of https://github.com/Men…
Browse files Browse the repository at this point in the history
…torMate/node-project-cli into feat/github-workflow-testing
  • Loading branch information
TsvetomirPenchev committed Feb 9, 2024
2 parents b320c30 + 24111ec commit 71cf780
Show file tree
Hide file tree
Showing 56 changed files with 384 additions and 280 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,5 @@ build
.vscode
.eslintcache
.prettiercache
.env
.env.test
2 changes: 1 addition & 1 deletion express-pg-auth0/.secrets.baseline
Original file line number Diff line number Diff line change
Expand Up @@ -112,5 +112,5 @@
}
],
"results": {},
"generated_at": "2024-01-06T18:45:22Z"
"generated_at": "2024-01-20T21:29:38Z"
}
2 changes: 1 addition & 1 deletion express-pg-auth0/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# mocha
# express-pg-auth0

## Setup

Expand Down
2 changes: 1 addition & 1 deletion express-pg-auth0/jest.setup.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
import '@extensions/zod/register';
import '@extensions/knex/register';
import '@extensions/knex/register';
13 changes: 10 additions & 3 deletions express-pg-auth0/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
{
"name": "@mentormate/express-pg-auth0",
"name": "express-pg-auth0",
"version": "1.0.0",
"private": true,
"description": "",
"keywords": [],
"license": "ISC",
"author": "",
"main": "index.js",
"scripts": {
"build": "npm run clean && tsc -p tsconfig.build.json && tsc-alias",
"clean": "rimraf dist",
Expand All @@ -14,15 +20,16 @@
"db:migrate:up": "ts-node node_modules/.bin/knex migrate:up --migrations-directory ./migrations --client pg --migrations-table-name knex_migrations --connection $(ts-node scripts/db-connection)",
"db:migrate:version": "ts-node node_modules/.bin/knex migrate:currentVersion --migrations-directory ./migrations --client pg --migrations-table-name knex_migrations --connection $(ts-node scripts/db-connection)",
"format": "prettier \"**/*.{js,cjs,mjs,ts,md}\" --write --cache --cache-strategy metadata --cache-location .prettiercache",
"image:build": "DOCKER_BUILDKIT=1 docker build -t mocha .",
"image:run": "docker run --rm --net host -e NODE_ENV=production --env-file .env mocha",
"image:build": "DOCKER_BUILDKIT=1 docker build -t express-pg-auth0 .",
"image:run": "docker run --rm --net host -e NODE_ENV=production --env-file .env express-pg-auth0",
"license:check": "license-checker --summary --excludePrivatePackages --onlyAllow $(node ./licenses-allowed.js ';') > /dev/null",
"license:for-review": "license-checker --summary --excludePrivatePackages --exclude $(node ./licenses-allowed.js ',')",
"license:summary": "license-checker --summary",
"lint": "eslint . --ext .js,.cjs,.mjs,.ts --fix --cache",
"lint:dockerfile": "docker run --rm -i hadolint/hadolint < Dockerfile",
"lint:markdown": "markdownlint **/*.md --ignore node_modules",
"openapi:g": "ts-node scripts/generate-openapi",
"prepare": "husky install",
"start": "npx ts-node src/index",
"start:debug": "tsc --sourceMap -p tsconfig.build.json && tsc-alias && node --inspect -r dotenv/config dist/index",
"start:dev": "nodemon",
Expand Down
4 changes: 2 additions & 2 deletions express-pg-auth0/src/api/auth/services/auth0.service.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Axios } from 'axios';
import { AxiosStatic } from 'axios';
import { Logger } from 'pino';
import { Auth0User } from '../interfaces';
import { Environment } from '@utils/environment';
Expand All @@ -12,7 +12,7 @@ export class Auth0Service {

constructor(
private logger: Logger,
private axios: Axios,
private axios: AxiosStatic,
private env: Environment,
) {
this.getAuth0AccessToken()
Expand Down
6 changes: 3 additions & 3 deletions express-pg-auth0/test/todos/create.spec-e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ describe('POST /v1/todos', () => {

authMock.mockImplementation(
(
req: Request & { auth: { payload: { sub: string } } },
res: Response,
req: { auth: { payload: { sub: string } } },
res,
next: () => true
) => {
req.auth = {
Expand Down Expand Up @@ -82,7 +82,7 @@ describe('POST /v1/todos', () => {
});

it('should return 401 error when the user is not authenticated', async () => {
authMock.mockImplementation((request: Request, response: Response, next) => {
authMock.mockImplementation((request, response, next) => {
next(createError(401, 'No authorization token was found'))
});

Expand Down
6 changes: 3 additions & 3 deletions express-pg-auth0/test/todos/delete.spec-e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ describe('DELETE /v1/todos/:id', () => {

authMock.mockImplementation(
(
req: Request & { auth: { payload: { sub: string } } },
res: Response,
req: { auth: { payload: { sub: string } } },
res,
next: () => true
) => {
req.auth = {
Expand Down Expand Up @@ -75,7 +75,7 @@ describe('DELETE /v1/todos/:id', () => {
});

it('should return 401 error when user is not authenticated', async () => {
authMock.mockImplementation((request: Request, response: Response, next) => {
authMock.mockImplementation((request, response, next) => {
next(createError(401, 'No authorization token was found'))
});

Expand Down
6 changes: 3 additions & 3 deletions express-pg-auth0/test/todos/get.spec-e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ describe('GET /v1/todos/:id', () => {

authMock.mockImplementation(
(
req: Request & { auth: { payload: { sub: string } } },
res: Response,
req: { auth: { payload: { sub: string } } },
res,
next: () => true
) => {
req.auth = {
Expand Down Expand Up @@ -102,7 +102,7 @@ describe('GET /v1/todos/:id', () => {

describe('when user is not authenticated', () => {
it('should return 401 error', async () => {
authMock.mockImplementation((request: Request, response: Response, next) => {
authMock.mockImplementation((request, response, next) => {
next(createError(401, 'No authorization token was found'))
});

Expand Down
6 changes: 3 additions & 3 deletions express-pg-auth0/test/todos/list.spec-e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ describe('GET /v1/todos', () => {

authMock.mockImplementation(
(
req: Request & { auth: { payload: { sub: string } } },
res: Response,
req: { auth: { payload: { sub: string } } },
res,
next: () => true
) => {
req.auth = {
Expand Down Expand Up @@ -221,7 +221,7 @@ describe('GET /v1/todos', () => {

describe('when user is not authenticated', () => {
it('should return 401 error', async () => {
authMock.mockImplementation((request: Request, response: Response, next) => {
authMock.mockImplementation((request, response, next) => {
next(createError(401, 'No authorization token was found'))
});

Expand Down
6 changes: 3 additions & 3 deletions express-pg-auth0/test/todos/update.spec-e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ describe('POST /v1/todos/:id', () => {

authMock.mockImplementation(
(
req: Request & { auth: { payload: { sub: string } } },
res: Response,
req: { auth: { payload: { sub: string } } },
res,
next: () => true
) => {
req.auth = {
Expand Down Expand Up @@ -122,7 +122,7 @@ describe('POST /v1/todos/:id', () => {

describe('when user is not authenticated', () => {
it('should return 401 error', async () => {
authMock.mockImplementation((request: Request, response: Response, next) => {
authMock.mockImplementation((request, response, next) => {
next(createError(401, 'No authorization token was found'))
});

Expand Down
2 changes: 1 addition & 1 deletion express-pg-jwt/.secrets.baseline
Original file line number Diff line number Diff line change
Expand Up @@ -112,5 +112,5 @@
}
],
"results": {},
"generated_at": "2024-01-06T18:35:33Z"
"generated_at": "2024-01-20T21:29:49Z"
}
2 changes: 1 addition & 1 deletion express-pg-jwt/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# mocha
# express-pg-jwt

## Setup

Expand Down
13 changes: 10 additions & 3 deletions express-pg-jwt/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
{
"name": "@mentormate/express-pg-jwt",
"name": "express-pg-jwt",
"version": "1.0.0",
"private": true,
"description": "",
"keywords": [],
"license": "ISC",
"author": "",
"main": "index.js",
"scripts": {
"build": "npm run clean && tsc -p tsconfig.build.json && tsc-alias",
"clean": "rimraf dist",
Expand All @@ -14,15 +20,16 @@
"db:migrate:up": "ts-node node_modules/.bin/knex migrate:up --migrations-directory ./migrations --client pg --migrations-table-name knex_migrations --connection $(ts-node scripts/db-connection)",
"db:migrate:version": "ts-node node_modules/.bin/knex migrate:currentVersion --migrations-directory ./migrations --client pg --migrations-table-name knex_migrations --connection $(ts-node scripts/db-connection)",
"format": "prettier \"**/*.{js,cjs,mjs,ts,md}\" --write --cache --cache-strategy metadata --cache-location .prettiercache",
"image:build": "DOCKER_BUILDKIT=1 docker build -t mocha .",
"image:run": "docker run --rm --net host -e NODE_ENV=production --env-file .env mocha",
"image:build": "DOCKER_BUILDKIT=1 docker build -t express-pg-jwt .",
"image:run": "docker run --rm --net host -e NODE_ENV=production --env-file .env express-pg-jwt",
"license:check": "license-checker --summary --excludePrivatePackages --onlyAllow $(node ./licenses-allowed.js ';') > /dev/null",
"license:for-review": "license-checker --summary --excludePrivatePackages --exclude $(node ./licenses-allowed.js ',')",
"license:summary": "license-checker --summary",
"lint": "eslint . --ext .js,.cjs,.mjs,.ts --fix --cache",
"lint:dockerfile": "docker run --rm -i hadolint/hadolint < Dockerfile",
"lint:markdown": "markdownlint **/*.md --ignore node_modules",
"openapi:g": "ts-node scripts/generate-openapi",
"prepare": "husky install",
"start": "npx ts-node src/index",
"start:debug": "tsc --sourceMap -p tsconfig.build.json && tsc-alias && node --inspect -r dotenv/config dist/index",
"start:dev": "nodemon",
Expand Down
2 changes: 1 addition & 1 deletion nest-mongo-auth0/.secrets.baseline
Original file line number Diff line number Diff line change
Expand Up @@ -112,5 +112,5 @@
}
],
"results": {},
"generated_at": "2024-01-06T15:52:40Z"
"generated_at": "2024-01-20T21:30:47Z"
}
2 changes: 1 addition & 1 deletion nest-mongo-auth0/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# mocha
# nest-mongo-auth0

## Setup

Expand Down
20 changes: 7 additions & 13 deletions nest-mongo-auth0/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@
* @type {import('@jest/types').Config.InitialOptions}
*/
module.exports = {
collectCoverageFrom: [
'<rootDir>/src/**/*.(t|j)s'
],
collectCoverageFrom: ['<rootDir>/src/**/*.(t|j)s'],
coverageDirectory: './coverage',
coveragePathIgnorePatterns: [
'<rootDir>/src/main.ts$',
Expand All @@ -22,19 +20,15 @@ module.exports = {
branches: 85,
functions: 85,
lines: 85,
statements: 85
}
statements: 85,
},
},
moduleFileExtensions: [
'js',
'json',
'ts'
],
moduleFileExtensions: ['js', 'json', 'ts'],
rootDir: '.',
testEnvironment: 'node',
testRegex: '.*\\.spec\\.ts$',
transform: {
'^.+\\.(t|j)s$': 'ts-jest'
'^.+\\.(t|j)s$': 'ts-jest',
},
// path aliases from tsconfig.json
moduleNameMapper: {
Expand All @@ -45,5 +39,5 @@ module.exports = {
'^@middleware$': '<rootDir>/src/middleware',
'^@utils/(.*)$': '<rootDir>/src/utils/$1',
'^@test/(.*)$': '<rootDir>/test/$1',
}
}
},
};
7 changes: 4 additions & 3 deletions nest-mongo-auth0/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "@mentormate/nest-mongo-auth0",
"name": "nest-mongo-auth0",
"version": "0.0.1",
"private": true,
"description": "",
Expand All @@ -8,14 +8,15 @@
"scripts": {
"build": "nest build",
"format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
"image:build": "DOCKER_BUILDKIT=1 docker build -t mocha .",
"image:run": "docker run --rm --net host -e NODE_ENV=production --env-file .env mocha",
"image:build": "DOCKER_BUILDKIT=1 docker build -t nest-mongo-auth0 .",
"image:run": "docker run --rm --net host -e NODE_ENV=production --env-file .env nest-mongo-auth0",
"license:check": "license-checker --summary --excludePrivatePackages --onlyAllow $(node ./licenses-allowed.js ';') > /dev/null",
"license:for-review": "license-checker --summary --excludePrivatePackages --exclude $(node ./licenses-allowed.js ',')",
"license:summary": "license-checker --summary",
"lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix",
"lint:dockerfile": "docker run --rm -i hadolint/hadolint < Dockerfile",
"lint:markdown": "markdownlint **/*.md --ignore node_modules",
"prepare": "husky install",
"start": "node -r dotenv/config ./node_modules/@nestjs/cli/bin/nest.js start",
"start:debug": "node -r dotenv/config ./node_modules/@nestjs/cli/bin/nest.js start --debug --watch",
"start:dev": "node -r dotenv/config ./node_modules/@nestjs/cli/bin/nest.js start --watch",
Expand Down
1 change: 0 additions & 1 deletion nest-mongo-auth0/test/jest-e2e.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ module.exports = {
'<rootDir>/src/.*entity.ts$',
'<rootDir>/src/.*repository.ts$',
'<rootDir>/src/.*guard.ts$',
'<rootDir>/src/api/auth/.*.ts$',
],
coverageThreshold: {
global: {
Expand Down
2 changes: 1 addition & 1 deletion nest-mongo-jwt/.secrets.baseline
Original file line number Diff line number Diff line change
Expand Up @@ -112,5 +112,5 @@
}
],
"results": {},
"generated_at": "2024-01-06T18:16:09Z"
"generated_at": "2024-01-20T21:30:59Z"
}
2 changes: 1 addition & 1 deletion nest-mongo-jwt/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# mocha
# nest-mongo-jwt

## Setup

Expand Down
7 changes: 4 additions & 3 deletions nest-mongo-jwt/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "@mentormate/nest-mongo-jwt",
"name": "nest-mongo-jwt",
"version": "0.0.1",
"private": true,
"description": "",
Expand All @@ -8,14 +8,15 @@
"scripts": {
"build": "nest build",
"format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
"image:build": "DOCKER_BUILDKIT=1 docker build -t mocha .",
"image:run": "docker run --rm --net host -e NODE_ENV=production --env-file .env mocha",
"image:build": "DOCKER_BUILDKIT=1 docker build -t nest-mongo-jwt .",
"image:run": "docker run --rm --net host -e NODE_ENV=production --env-file .env nest-mongo-jwt",
"license:check": "license-checker --summary --excludePrivatePackages --onlyAllow $(node ./licenses-allowed.js ';') > /dev/null",
"license:for-review": "license-checker --summary --excludePrivatePackages --exclude $(node ./licenses-allowed.js ',')",
"license:summary": "license-checker --summary",
"lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix",
"lint:dockerfile": "docker run --rm -i hadolint/hadolint < Dockerfile",
"lint:markdown": "markdownlint **/*.md --ignore node_modules",
"prepare": "husky install",
"start": "node -r dotenv/config ./node_modules/@nestjs/cli/bin/nest.js start",
"start:debug": "node -r dotenv/config ./node_modules/@nestjs/cli/bin/nest.js start --debug --watch",
"start:dev": "node -r dotenv/config ./node_modules/@nestjs/cli/bin/nest.js start --watch",
Expand Down
2 changes: 1 addition & 1 deletion nest-pg-auth0/.secrets.baseline
Original file line number Diff line number Diff line change
Expand Up @@ -112,5 +112,5 @@
}
],
"results": {},
"generated_at": "2024-01-06T15:33:16Z"
"generated_at": "2024-01-20T21:30:08Z"
}
2 changes: 1 addition & 1 deletion nest-pg-auth0/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# mocha
# nest-pg-auth0

## Setup

Expand Down
Loading

0 comments on commit 71cf780

Please sign in to comment.