Skip to content

Commit

Permalink
build: merge from Nx-migration
Browse files Browse the repository at this point in the history
  • Loading branch information
Jose Tomas Hernandez Lopez committed Feb 21, 2024
2 parents 04ba506 + 1c42266 commit aed77e6
Show file tree
Hide file tree
Showing 20 changed files with 1,704 additions and 2,143 deletions.
14 changes: 4 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,25 +14,19 @@
"prepare": "husky install"
},
"dependencies": {
"@nestjs/cli": "^10.3.2",
"@nestjs/jwt": "^10.2.0",
"@nestjs/passport": "^10.0.3",
"@nestjs/swagger": "^7.3.0",
"@nestjs/typeorm": "^10.0.2",
"@angular-devkit/schematics-cli": "^14.2.3",
"@nestjs/cli": "^9.1.3",
"@nx/devkit": "17.2.8",
"@nx/plugin": "^17.2.8",
"@swc/helpers": "~0.5.2",
"bcrypt": "^5.1.1",
"convict": "^6.2.4",
"express": "^4.18.2",
"fs-extra": "^11.2.0",
"lodash": "^4.17.21",
"passport-jwt": "^4.0.1",
"prettier": "^2.8.8",
"triple-beam": "^1.4.1",
"tslib": "^2.6.2",
"type-fest": "^4.10.2",
"typescript": "^5.3.3",
"winston": "^3.11.0"
"typescript": "^5.3.3"
},
"devDependencies": {
"@commitlint/cli": "^17.1.2",
Expand Down
32 changes: 32 additions & 0 deletions packages/mailer/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"extends": ["../../.eslintrc.js"],
"ignorePatterns": ["!**/*"],
"overrides": [
{
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
"rules": {}
},
{
"files": ["*.ts", "*.tsx"],
"rules": {}
},
{
"files": ["*.js", "*.jsx"],
"rules": {}
},
{
"files": ["*.json"],
"parser": "jsonc-eslint-parser",
"rules": {
"@nx/dependency-checks": "error"
}
},
{
"files": ["./package.json"],
"parser": "jsonc-eslint-parser",
"rules": {
"@nx/nx-plugin-checks": "error"
}
}
]
}
74 changes: 37 additions & 37 deletions packages/mailer/README.md
Original file line number Diff line number Diff line change
@@ -1,37 +1,37 @@
# devon4ts_node

[devonfw](https://www.devonfw.com/) is a platform which provides solutions to building business applications which combine best-in-class frameworks and libraries as well as industry proven practices and code conventions. devonfw is 100% Open Source (Apache License version 2.0) since the beginning of 2018.

devon4ts_node is the NodeJS stack of devonfw. It allows you to build business applications (backends) using NodeJS technology in standardized way based on established best-practices.

![License](https://img.shields.io/npm/l/@devon4ts_node/mailer)
![License](https://img.shields.io/npm/v/@devon4ts_node/mailer)
![License](https://img.shields.io/librariesio/release/npm/@devon4ts_node/mailer)
![License](https://img.shields.io/npm/dt/@devon4ts_node/mailer)

## devon4ts_node mailer

This package contains the devon4ts_node mailer module. This module allows you to send emails in your devon4ts_node application in a easy way.

## Documentation

You can find all documentation in our [wiki](https://github.com/devonfw/devon4ts_node/wiki).

## Code of conduct

Visit [code of conduct document](https://github.com/devonfw/.github/blob/master/CODE_OF_CONDUCT.md).

## Contributing guide

Visit [contributing guide document](https://github.com/devonfw/.github/blob/master/CONTRIBUTING.asciidoc).

## Key Principles

Visit [key principles document](https://github.com/devonfw/.github/blob/master/key-principles.asciidoc).

## Samples

- [Employee example](https://github.com/devonfw-sample/devon4ts_node-samples/tree/develop/employee): simple backend example for a employee management application.
- [Components example](https://github.com/devonfw-sample/devon4ts_node/tree/develop/components-example): simple backend example which will show you the execution order of the devon4ts_node components.
- [GraphQL example](https://github.com/devonfw-sample/devon4ts_node/tree/develop/graphql): simple GraphQL example with starter configuration.
- [My Thai Star](https://github.com/devonfw/my-thai-star/tree/develop/node): realistic example about the management of a restaurant. This example has also a frontend and it is compatible with other devonfw stacks.
# devon4ts_node

[devonfw](https://www.devonfw.com/) is a platform which provides solutions to building business applications which combine best-in-class frameworks and libraries as well as industry proven practices and code conventions. devonfw is 100% Open Source (Apache License version 2.0) since the beginning of 2018.

devon4ts_node is the NodeJS stack of devonfw. It allows you to build business applications (backends) using NodeJS technology in a standardized way based on established best-practices.

![License](https://img.shields.io/npm/l/@devon4ts_node/mailer)
![License](https://img.shields.io/npm/v/@devon4ts_node/mailer)
![License](https://img.shields.io/librariesio/release/npm/@devon4ts_node/mailer)
![License](https://img.shields.io/npm/dt/@devon4ts_node/mailer)

## devon4ts_node mailer

This package contains the devon4ts_node mailer module. This module allows you to send emails in your devon4ts_node application in a easy way.

## Documentation

You can find all documentation in our [wiki](https://github.com/devonfw/devon4ts_node/wiki).

## Code of conduct

Visit [code of conduct document](https://github.com/devonfw/.github/blob/master/CODE_OF_CONDUCT.md).

## Contributing guide

Visit [contributing guide document](https://github.com/devonfw/.github/blob/master/CONTRIBUTING.asciidoc).

## Key Principles

Visit [key principles document](https://github.com/devonfw/.github/blob/master/key-principles.asciidoc).

## Samples

- [Employee example](https://devon.s2-eu.capgemini.com/gitlab/devonfw/devon4ts-samples/-/tree/master/apps/nest-employee): simple backend example for a employee management application.
- [Components example](https://devon.s2-eu.capgemini.com/gitlab/devonfw/devon4ts-samples/-/tree/master/apps/nest-components): simple backend example which will show you the execution order of the devon4ts_node components.
- [GraphQL example](https://devon.s2-eu.capgemini.com/gitlab/devonfw/devon4ts-samples/-/tree/master/apps/nest-graphql): simple GraphQL example with starter configuration.
- [My Thai Star](https://devon.s2-eu.capgemini.com/gitlab/devonfw/my-thai-star/-/tree/develop/node): realistic example about the management of a restaurant. This example has also a frontend and it is compatible with other devonfw stacks.
10 changes: 10 additions & 0 deletions packages/mailer/jest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/* eslint-disable */
export default {
displayName: 'mailer',
preset: '../../jest.preset.js',
transform: {
'^.+\\.[tj]s$': ['ts-jest', { tsconfig: '<rootDir>/tsconfig.spec.json' }],
},
moduleFileExtensions: ['ts', 'js', 'html'],
coverageDirectory: '../../coverage/packages/mailer',
};
26 changes: 16 additions & 10 deletions packages/mailer/package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"name": "@devon4ts_node/mailer",
"version": "5.0.1",
"description": "devon4ts_node module that allows you to send emails in a easy way.",
"main": "dist/index.js",
"description": "devon4ts_node module that allows you to send emails in an easy way.",
"main": "./src/lib/index.js",
"scripts": {
"build": "rm -rf dist && tsc -p tsconfig.build.json",
"prepublish:npm": "npm run build",
Expand All @@ -27,15 +27,19 @@
],
"license": "Apache-2.0",
"dependencies": {
"fs-extra": "^10.1.0",
"nodemailer": "^6.7.5"
"fs-extra": "^11.2.0",
"nodemailer": "^6.9.8",
"tslib": "^2.6.2"
},
"devDependencies": {
"@types/fs-extra": "^11.0.4"
},
"peerDependencies": {
"@nestjs/common": "^9.0.0",
"@nestjs/core": "^9.0.0",
"handlebars": "^4.0.0",
"reflect-metadata": "^0.1.13",
"rxjs": "^7.0.0"
"@nestjs/common": "^10.3.3",
"@nestjs/core": "^10.3.3",
"handlebars": "^4.7.8",
"reflect-metadata": "^0.1.14",
"rxjs": "^7.8.1"
},
"repository": {
"type": "git",
Expand All @@ -62,5 +66,7 @@
"coverageDirectory": "./coverage",
"testEnvironment": "node"
},
"type": "commonjs",
"typings": "./src/lib/index.d.ts",
"gitHead": "1f351bcc0fbad70f9c25fa73a398a538ca0c8e55"
}
}
52 changes: 52 additions & 0 deletions packages/mailer/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
{
"name": "mailer",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "packages/mailer/src",
"projectType": "library",
"targets": {
"build": {
"executor": "@nx/js:tsc",
"outputs": ["{options.outputPath}"],
"options": {
"outputPath": "dist/packages/mailer",
"main": "packages/mailer/src/lib/index.ts",
"tsConfig": "packages/mailer/tsconfig.lib.json",
"assets": [
"packages/mailer/*.md",
{
"input": "./packages/mailer/src",
"glob": "**/!(*.ts)",
"output": "./src"
},
{
"input": "./packages/mailer/src",
"glob": "**/*.d.ts",
"output": "./src"
},
{
"input": "./packages/mailer",
"glob": "generators.json",
"output": "."
},
{
"input": "./packages/mailer",
"glob": "executors.json",
"output": "."
}
]
}
},
"lint": {
"executor": "@nx/eslint:lint",
"outputs": ["{options.outputFile}"]
},
"test": {
"executor": "@nx/jest:jest",
"outputs": ["{workspaceRoot}/coverage/{projectRoot}"],
"options": {
"jestConfig": "packages/mailer/jest.config.ts"
}
}
},
"tags": []
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ describe('MailerService', () => {
const expected = { ...input, from: 'someone@whatever.com' };

service.sendPlainMail(input);
expect(transporter.sendMail).toBeCalledWith(expected);
expect(transporter.sendMail).toHaveBeenCalledWith(expected);
});

it('should send a plain text email using the provided transporter providing all params', () => {
Expand All @@ -68,7 +68,7 @@ describe('MailerService', () => {
const expected = { ...input, from: 'someone@whatever.com' };

service.sendPlainMail(input.to, input.subject, input.html);
expect(transporter.sendMail).toBeCalledWith(expected);
expect(transporter.sendMail).toHaveBeenCalledWith(expected);
});

it('should send email from a handlebars template by using the provided transporter providing emailOptions object', () => {
Expand Down Expand Up @@ -99,7 +99,7 @@ describe('MailerService', () => {
};

service.sendTemplateMail(input, 'test', { title: 'my title' });
expect(transporter.sendMail).toBeCalledWith(expected);
expect(transporter.sendMail).toHaveBeenCalledWith(expected);
});

it('should register a template and should be ready to use', () => {
Expand All @@ -116,7 +116,7 @@ describe('MailerService', () => {

service.addTemplate('my-view', `My view`);
service.sendTemplateMail(input, 'my-view', {});
expect(transporter.sendMail).toBeCalledWith(expected);
expect(transporter.sendMail).toHaveBeenCalledWith(expected);
});

it('should register a partial and should be ready to use', () => {
Expand All @@ -134,7 +134,7 @@ describe('MailerService', () => {
service.addTemplate('my-view', `{{#> my-partial }}My view{{/my-partial}}`);
service.registerPartial('my-partial', `this is my partial: {{> @partial-block }}`);
service.sendTemplateMail(input, 'my-view', {});
expect(transporter.sendMail).toBeCalledWith(expected);
expect(transporter.sendMail).toHaveBeenCalledWith(expected);
});

it('should register a helper and should be ready to use', () => {
Expand All @@ -149,11 +149,11 @@ describe('MailerService', () => {
html: `<b>My view</b>`,
};

service.registerHelper('bold', function (options) {
service.registerHelper('bold', options => {
return '<b>' + options.fn(this) + '</b>';
});
service.addTemplate('my-view', `{{#bold}}My view{{/bold}}`);
service.sendTemplateMail(input, 'my-view', {});
expect(transporter.sendMail).toBeCalledWith(expected);
expect(transporter.sendMail).toHaveBeenCalledWith(expected);
});
});
9 changes: 2 additions & 7 deletions packages/mailer/tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
{
"compilerOptions": {
"noImplicitThis": true,
"noImplicitThis": true
},
"extends": "./tsconfig.json",
"exclude": [
"node_modules",
"dist",
"./**/*.spec.ts",
"test"
]
"exclude": ["node_modules", "dist", "./**/*.spec.ts", "test"]
}
38 changes: 19 additions & 19 deletions packages/mailer/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"noImplicitAny": false,
"sourceMap": false,
"outDir": "./dist",
"baseUrl": "./",
"incremental": false,
"noImplicitThis": false,
"types": [
"node",
"jest"
]
},
"include": [
"./lib/**/*",
"./test/**/*"
]
}
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"module": "CommonJS",
"noImplicitAny": true,
"sourceMap": false,
"noImplicitThis": false,
"types": ["node", "jest"]
},
"include": ["./lib/**/*", "./test/**/*"],
"references": [
{
"path": "./tsconfig.lib.json"
},
{
"path": "./tsconfig.spec.json"
}
]
}
10 changes: 10 additions & 0 deletions packages/mailer/tsconfig.lib.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "../../dist/out-tsc",
"declaration": true,
"types": ["node"]
},
"include": ["src/**/*.ts"],
"exclude": ["jest.config.ts", "src/**/*.spec.ts", "src/**/*.test.ts"]
}
9 changes: 9 additions & 0 deletions packages/mailer/tsconfig.spec.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "../../dist/out-tsc",
"module": "commonjs",
"types": ["jest", "node"]
},
"include": ["jest.config.ts", "src/**/*.test.ts", "src/**/*.spec.ts", "src/**/*.d.ts"]
}
Loading

0 comments on commit aed77e6

Please sign in to comment.