Skip to content

Commit

Permalink
feat(mailer): integrate mailer in the nx monorepo
Browse files Browse the repository at this point in the history
* build: convert package into a Nx plugin
* build: fix tests
* build: update tsconfig and readme links
* build: remove old code and check changes
* build: add plugin to nx workspace
* build: fix dependencies
* build: restore package.json and default file directories
* build: update configuration
* build: little fix
* build: little fix
* build: restore nx.json
* build: fix version and dependencies
  • Loading branch information
josetomashl authored Feb 20, 2024
1 parent d77a918 commit 1c42266
Show file tree
Hide file tree
Showing 25 changed files with 3,002 additions and 546 deletions.
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
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
"typescript.preferences.importModuleSpecifier": "relative",
"typescript.preferences.quoteStyle": "single",
"editor.formatOnSave": true,
"asciidoc.antora.enableAntoraSupport": true
"asciidoc.antora.enableAntoraSupport": true,
"eslint.validate": ["json"]
}
5 changes: 5 additions & 0 deletions jest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { getJestProjects } from '@nx/jest';

export default {
projects: getJestProjects(),
};
3 changes: 3 additions & 0 deletions jest.preset.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
const nxPreset = require('@nx/jest/preset').default;

module.exports = { ...nxPreset };
61 changes: 29 additions & 32 deletions nx.json
Original file line number Diff line number Diff line change
@@ -1,63 +1,60 @@
{
"targetDefaults": {
"build": {
"dependsOn": [
"^build"
],
"outputs": [
"{projectRoot}/dist"
],
"dependsOn": ["^build"],
"outputs": ["{projectRoot}/dist"],
"cache": true
},
"prepublish:npm": {
"dependsOn": [
"^prepublish:npm"
]
"dependsOn": ["^prepublish:npm"]
},
"publish:npm": {
"dependsOn": [
"^publish:npm"
]
"dependsOn": ["^publish:npm"]
},
"test": {
"dependsOn": [
"^test"
],
"dependsOn": ["^test"],
"cache": true
},
"format": {
"dependsOn": [
"^format"
]
"dependsOn": ["^format"]
},
"lint": {
"dependsOn": [
"^lint"
],
"dependsOn": ["^lint"],
"cache": true
},
"prepublish": {
"dependsOn": [
"^prepublish"
]
"dependsOn": ["^prepublish"]
},
"prepare": {
"dependsOn": [
"^prepare"
]
"dependsOn": ["^prepare"]
},
"@nx/jest:jest": {
"cache": true,
"inputs": ["default", "^production", "{workspaceRoot}/jest.preset.js"],
"options": {
"passWithNoTests": true
},
"configurations": {
"ci": {
"ci": true,
"codeCoverage": true
}
}
}
},
"affected": {
"defaultBase": "develop"
},
"namedInputs": {
"default": [
"{projectRoot}/**/*",
"sharedGlobals"
],
"default": ["{projectRoot}/**/*", "sharedGlobals"],
"sharedGlobals": [],
"production": [
"default"
"default",
"!{projectRoot}/**/?(*.)+(spec|test).[jt]s?(x)?(.snap)",
"!{projectRoot}/tsconfig.spec.json",
"!{projectRoot}/jest.config.[jt]s",
"!{projectRoot}/src/test-setup.[jt]s",
"!{projectRoot}/test-setup.[jt]s"
]
}
}
22 changes: 17 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,14 @@
"dependencies": {
"@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",
"fs-extra": "^11.2.0",
"lodash": "^4.17.21",
"prettier": "^2.7.1",
"triple-beam": "^1.4.1",
"tslib": "^2.3.0",
"typescript": "^4.8.3"
},
"devDependencies": {
Expand All @@ -27,10 +32,15 @@
"@nestjs/common": "^9.1.2",
"@nestjs/core": "^9.1.2",
"@nestjs/testing": "^9.1.2",
"@types/jest": "^29.0.3",
"@nx/jest": "17.2.8",
"@nx/js": "17.2.8",
"@swc-node/register": "~1.6.7",
"@swc/cli": "~0.1.62",
"@swc/core": "~1.3.85",
"@types/jest": "^29.4.0",
"@types/js-yaml": "^4.0.5",
"@types/lodash": "^4.14.185",
"@types/node": "^18.7.21",
"@types/node": "18.16.9",
"@types/nodemailer": "^6.4.6",
"@types/pluralize": "^0.0.33",
"@types/prettier": "^2.7.1",
Expand All @@ -46,12 +56,14 @@
"eslint-plugin-prettier": "^4.0.0",
"handlebars": "^4.7.7",
"husky": "^8.0.1",
"jest": "^29.0.3",
"jest": "^29.4.1",
"jest-environment-jsdom": "^29.4.1",
"lerna": "^5.5.2",
"nx": "17.2.6",
"reflect-metadata": "^0.1.13",
"rxjs": "^7.5.7",
"ts-jest": "^29.0.2",
"ts-jest": "^29.1.0",
"ts-node": "10.9.1",
"typeorm": "^0.3.10",
"zx": "^7.0.8"
},
Expand All @@ -60,4 +72,4 @@
"path": "./node_modules/cz-conventional-changelog"
}
}
}
}
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.
Loading

0 comments on commit 1c42266

Please sign in to comment.