-
|
-
diff --git a/.gitignore b/.gitignore index e310ca924..192e8693f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,14 +1,31 @@ # See http://help.github.com/ignore-files/ for more about ignoring files. -# compiled output -/dist +# Environments +.env +.env.local +.env.development +.env.test +.env.staging +.env.production +.env.local.* +.env.development.* +.env.test.* +.env.staging.* +.env.production.* + +# Compiled output +**/dist /tmp /out-tsc -# dependencies -/node_modules +# Dependencies +**/node_modules +.pnpm + +# TurboRepo +.turbo -# profiling files +# Profiling files chrome-profiler-events.json speed-measure-plugin.json @@ -28,7 +45,7 @@ speed-measure-plugin.json !.vscode/launch.json !.vscode/extensions.json -# misc +# Misc /.sass-cache /connect.lock /coverage @@ -49,4 +66,7 @@ website/translated_docs website/build/ website/yarn.lock website/node_modules -website/i18n/* \ No newline at end of file +website/i18n/* + +# Logs +*.log diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 000000000..9c1caf154 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,14 @@ +{ + "version": "0.2.0", + "configurations": [ + { + "type": "node", + "request": "launch", + "name": "NestJS Tests", + "program": "${workspaceFolder}/node_modules/jest/bin/jest.js", + "args": ["--runInBand"], + "console": "integratedTerminal", + "internalConsoleOptions": "neverOpen" + } + ] +} diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 000000000..9f6b83455 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,56 @@ +{ + "files.exclude": { + "**/.git": false, + "**/.svn": true, + "**/.hg": true, + "**/CVS": true, + "**/.DS_Store": true, + "**/Thumbs.db": true, + "**/.classpath": true, + "**/.factorypath": true, + "**/.project": true, + "**/.settings": true, + "dist/": false, + "lib/": true, + "node_modules/": false, + "coverage/": true, + "**/node_modules/": false, + "**/.turbo": true, + "**/dist": false, + ".turbo-cache": true, + "pruned": true, + "**/node_modules": true, + "node_modules": true + }, + "explorer.fileNesting.enabled": true, + "explorer.fileNesting.patterns": { + "*.js": "$(capture).js.map, $(capture).min.js, $(capture).d.ts", + "*.ts": "$(capture).js, $(capture).*.ts", + "package.json": "package-lock.json, yarn.lock, pnpm-lock.yaml, pnpm-workspace.yaml, prettier.config.*,.eslintrc.*,.lintstagedrc.*,.eslintignore, .gitattributes, .editorconfig, .commitlintrc.*, .eslintcache,.gitignore,.npmrc,.prettierignore,.yarnrc.yml, turbo.json, jest.config.*, CODEOWNERS, .prettierrc, .nvmrc, publish.sh, renovate.json", + }, + "explorerExclude.backup": {}, + "yaml.schemas": { + "https://raw.githubusercontent.com/jsonresume/resume-schema/v1.0.0/schema.json": "untitled:Untitled-1" + }, + "cSpell.words": [ + "Alexandre", + "commitlint", + "commitlintrc", + "Cristiam", + "Díaz", + "Echeverry", + "Frezyn", + "Joao", + "Kitijerapat", + "liquidjs", + "mjml", + "nestjs", + "Partyka", + "Paweł", + "Titeux", + "tsup", + "vitor", + "Wasutan", + "Yanarp" + ] +} diff --git a/README.md b/README.md index d0d3cf0bd..efb08a577 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,6 @@ + + +
Handlebars test template. by Nest-modules TM
-
-
- Demo implementation on the mailer modules for Nest framework (node.js) using Nodemailer library
- Hi there, Context Code : {{code}} Context Username: {{username}} This is a really simple email template. Its sole purpose is to get the
- recipient to click the button with no distractions. Good luck! Hope it works.
-
-
- Demo implementation on the mailer modules for Nest framework (node.js) using Nodemailer library
- Hi there, Context Code : {{code}} Context Username: {{username}} This is a really simple email template. Its sole purpose is to get the
- recipient to click the button with no distractions. Good luck! Hope it works.
@@ -18,6 +21,9 @@
### Installation
```sh
+pnpm add @nestjs-modules/mailer nodemailer
+pnpm add -D @types/nodemailer
+#or
npm install --save @nestjs-modules/mailer nodemailer
npm install --save-dev @types/nodemailer
#or
@@ -27,7 +33,20 @@ yarn add -D @types/nodemailer
**Hint:** handlebars and pug is an optional dependency, if you want to use the template, you must install it.
+#### with pnpm
+
+```sh
+pnpm i handlebars
+#or
+pnpm i pug
+#or
+pnpm i ejs
+#or
+pnpm i mjml
+```
+
#### with npm
+
```sh
npm install --save handlebars
#or
@@ -39,6 +58,7 @@ npm install --save mjml
```
#### with yarn
+
```sh
yarn add handlebars
#or
@@ -59,13 +79,13 @@ you can find all the documentation [here](https://nest-modules.github.io/mailer/
### Contributing
-* [Cristiam Diaz](https://github.com/cdiaz)
-* [Eduardo Leal](https://github.com/eduardoleal)
-* [Juan Echeverry](https://github.com/juandav)
-* [Pat McGowan](https://github.com/p-mcgowan)
-* [Paweł Partyka](https://github.com/partyka95)
-* [Wasutan Kitijerapat](https://github.com/kitimark)
-* [Alexandre Titeux](https://github.com/GFoniX)
+- [Cristiam Diaz](https://github.com/cdiaz)
+- [Eduardo Leal](https://github.com/eduardoleal)
+- [Juan Echeverry](https://github.com/juandav)
+- [Pat McGowan](https://github.com/p-mcgowan)
+- [Paweł Partyka](https://github.com/partyka95)
+- [Wasutan Kitijerapat](https://github.com/kitimark)
+- [Alexandre Titeux](https://github.com/GFoniX)
### License
diff --git a/apps/01-basic-mailer/README.md b/apps/01-basic-mailer/README.md
new file mode 100644
index 000000000..a11475cc1
--- /dev/null
+++ b/apps/01-basic-mailer/README.md
@@ -0,0 +1,52 @@
+# 01 Basic Mailer
+
+This is a basic mailer application built with NestJS and the `@nestjs-modules/mailer` package.
+
+## Getting Started
+
+These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.
+
+### Prerequisites
+
+- Node.js
+- pnpm
+
+### Installing
+
+1. Clone the repository: `git clone https://github.com/nest-modules/mailer.git`
+2. Navigate to the `01-basic-mailer` directory.
+3. Install the dependencies: `pnpm install`
+
+## Running the Application
+
+- Run `pnpm run dev` for a dev server. The app will automatically reload if you change any of the source files.
+
+## Running the Tests
+
+- Run `pnpm test` to execute the unit tests via [Jest](https://jestjs.io/).
+- Run `pnpm run test:e2e` to execute the end-to-end tests via [Jest](https://jestjs.io/).
+
+## Environment Variables
+
+The following environment variables are used in this application:
+
+| Variable | Description | Example Value |
+|-------------|-----------------------------------|------------------------------|
+| `EMAIL_ID` | The email ID for the mailer | `example@example.com` |
+| `EMAIL_PASS`| The password for the email ID | `your-email-password` |
+
+You can set these environment variables in a `.env` file in the root of your project. For example:
+
+```env
+EMAIL_ID=example@example.com
+EMAIL_PASS=your-email-password
+```
+
+## Built With
+
+- [NestJS](https://nestjs.com/) - A progressive Node.js framework for building efficient, reliable and scalable server-side applications.
+- [@nestjs-modules/mailer](https://github.com/nest-modules/mailer) - A NestJS module for sending emails.
+
+## License
+
+This project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details.
diff --git a/apps/01-basic-mailer/package.json b/apps/01-basic-mailer/package.json
new file mode 100644
index 000000000..aa6445f2c
--- /dev/null
+++ b/apps/01-basic-mailer/package.json
@@ -0,0 +1,30 @@
+{
+ "name": "@nestjs-modules/01-basic-mailer",
+ "version": "0.0.1",
+ "description": "Nestjs mailer module sample implementation",
+ "author": "Juandav
-
-
-
-
-
-
\ No newline at end of file
diff --git a/sample/01-basic/test/app.e2e-spec.ts b/sample/01-basic/test/app.e2e-spec.ts
deleted file mode 100644
index 50cda6233..000000000
--- a/sample/01-basic/test/app.e2e-spec.ts
+++ /dev/null
@@ -1,24 +0,0 @@
-import { Test, TestingModule } from '@nestjs/testing';
-import { INestApplication } from '@nestjs/common';
-import * as request from 'supertest';
-import { AppModule } from './../src/app.module';
-
-describe('AppController (e2e)', () => {
- let app: INestApplication;
-
- beforeEach(async () => {
- const moduleFixture: TestingModule = await Test.createTestingModule({
- imports: [AppModule],
- }).compile();
-
- app = moduleFixture.createNestApplication();
- await app.init();
- });
-
- it('/ (GET)', () => {
- return request(app.getHttpServer())
- .get('/')
- .expect(200)
- .expect('Hello World!');
- });
-});
diff --git a/sample/01-basic/test/jest-e2e.json b/sample/01-basic/test/jest-e2e.json
deleted file mode 100644
index e9d912f3e..000000000
--- a/sample/01-basic/test/jest-e2e.json
+++ /dev/null
@@ -1,9 +0,0 @@
-{
- "moduleFileExtensions": ["js", "json", "ts"],
- "rootDir": ".",
- "testEnvironment": "node",
- "testRegex": ".e2e-spec.ts$",
- "transform": {
- "^.+\\.(t|j)s$": "ts-jest"
- }
-}
diff --git a/sample/01-basic/tsconfig.build.json b/sample/01-basic/tsconfig.build.json
deleted file mode 100644
index 64f86c6bd..000000000
--- a/sample/01-basic/tsconfig.build.json
+++ /dev/null
@@ -1,4 +0,0 @@
-{
- "extends": "./tsconfig.json",
- "exclude": ["node_modules", "test", "dist", "**/*spec.ts"]
-}
diff --git a/sample/01-basic/tsconfig.json b/sample/01-basic/tsconfig.json
deleted file mode 100644
index 69f185fd9..000000000
--- a/sample/01-basic/tsconfig.json
+++ /dev/null
@@ -1,15 +0,0 @@
-{
- "compilerOptions": {
- "module": "commonjs",
- "declaration": true,
- "removeComments": true,
- "emitDecoratorMetadata": true,
- "experimentalDecorators": true,
- "target": "es2017",
- "sourceMap": true,
- "outDir": "./dist",
- "baseUrl": "./",
- "incremental": true
- },
- "exclude": ["node_modules", "dist"]
-}
diff --git a/sample/02-custom-template-adapter/.eslintrc.js b/sample/02-custom-template-adapter/.eslintrc.js
deleted file mode 100644
index 0ae17cac2..000000000
--- a/sample/02-custom-template-adapter/.eslintrc.js
+++ /dev/null
@@ -1,24 +0,0 @@
-module.exports = {
- parser: '@typescript-eslint/parser',
- parserOptions: {
- project: 'tsconfig.json',
- sourceType: 'module',
- },
- plugins: ['@typescript-eslint/eslint-plugin'],
- extends: [
- 'plugin:@typescript-eslint/eslint-recommended',
- 'plugin:@typescript-eslint/recommended',
- 'prettier',
- 'prettier/@typescript-eslint',
- ],
- root: true,
- env: {
- node: true,
- jest: true,
- },
- rules: {
- '@typescript-eslint/interface-name-prefix': 'off',
- '@typescript-eslint/explicit-function-return-type': 'off',
- '@typescript-eslint/no-explicit-any': 'off',
- },
-};
diff --git a/sample/02-custom-template-adapter/.gitignore b/sample/02-custom-template-adapter/.gitignore
deleted file mode 100644
index 72712415d..000000000
--- a/sample/02-custom-template-adapter/.gitignore
+++ /dev/null
@@ -1,37 +0,0 @@
-# compiled output
-/dist
-/node_modules
-
-# Logs
-logs
-*.log
-npm-debug.log*
-yarn-debug.log*
-yarn-error.log*
-lerna-debug.log*
-
-# OS
-.DS_Store
-
-# Tests
-/coverage
-/.nyc_output
-
-# IDEs and editors
-/.idea
-.project
-.classpath
-.c9/
-*.launch
-.settings/
-*.sublime-workspace
-
-# IDE - VSCode
-.vscode/*
-!.vscode/settings.json
-!.vscode/tasks.json
-!.vscode/launch.json
-!.vscode/extensions.json
-
-#Lock files
-yarn.lock
\ No newline at end of file
diff --git a/sample/02-custom-template-adapter/.prettierrc b/sample/02-custom-template-adapter/.prettierrc
deleted file mode 100644
index dcb72794f..000000000
--- a/sample/02-custom-template-adapter/.prettierrc
+++ /dev/null
@@ -1,4 +0,0 @@
-{
- "singleQuote": true,
- "trailingComma": "all"
-}
\ No newline at end of file
diff --git a/sample/02-custom-template-adapter/README.md b/sample/02-custom-template-adapter/README.md
deleted file mode 100644
index fff42836c..000000000
--- a/sample/02-custom-template-adapter/README.md
+++ /dev/null
@@ -1,155 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Call To Action
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/sample/02-custom-template-adapter/test/app.e2e-spec.ts b/sample/02-custom-template-adapter/test/app.e2e-spec.ts
deleted file mode 100644
index 92e3bb18f..000000000
--- a/sample/02-custom-template-adapter/test/app.e2e-spec.ts
+++ /dev/null
@@ -1,35 +0,0 @@
-import { HttpStatus, INestApplication } from '@nestjs/common';
-import { Test, TestingModule } from '@nestjs/testing';
-import * as request from 'supertest';
-import { AppModule } from '../src/app.module';
-
-describe('AppController (e2e)', () => {
- let app: INestApplication;
-
- beforeEach(async () => {
- const moduleFixture: TestingModule = await Test.createTestingModule({
- imports: [AppModule],
- }).compile();
-
- app = moduleFixture.createNestApplication();
- await app.init();
- });
-
- afterEach(async () => {
- await app.close();
- });
-
- it('/ (GET)', async () => {
- await request(app.getHttpServer())
- .get('/')
- .expect(HttpStatus.OK)
- .expect('Hello World!');
- });
-
- it('/email (GET)', async () => {
- await request(app.getHttpServer())
- .get('/email')
- .expect(HttpStatus.OK)
- .expect((resp) => expect(resp.body).toBeDefined());
- });
-});
diff --git a/sample/02-custom-template-adapter/test/jest-e2e.json b/sample/02-custom-template-adapter/test/jest-e2e.json
deleted file mode 100644
index e9d912f3e..000000000
--- a/sample/02-custom-template-adapter/test/jest-e2e.json
+++ /dev/null
@@ -1,9 +0,0 @@
-{
- "moduleFileExtensions": ["js", "json", "ts"],
- "rootDir": ".",
- "testEnvironment": "node",
- "testRegex": ".e2e-spec.ts$",
- "transform": {
- "^.+\\.(t|j)s$": "ts-jest"
- }
-}
diff --git a/sample/02-custom-template-adapter/tsconfig.build.json b/sample/02-custom-template-adapter/tsconfig.build.json
deleted file mode 100644
index 64f86c6bd..000000000
--- a/sample/02-custom-template-adapter/tsconfig.build.json
+++ /dev/null
@@ -1,4 +0,0 @@
-{
- "extends": "./tsconfig.json",
- "exclude": ["node_modules", "test", "dist", "**/*spec.ts"]
-}
diff --git a/sample/02-custom-template-adapter/tsconfig.json b/sample/02-custom-template-adapter/tsconfig.json
deleted file mode 100644
index 69f185fd9..000000000
--- a/sample/02-custom-template-adapter/tsconfig.json
+++ /dev/null
@@ -1,15 +0,0 @@
-{
- "compilerOptions": {
- "module": "commonjs",
- "declaration": true,
- "removeComments": true,
- "emitDecoratorMetadata": true,
- "experimentalDecorators": true,
- "target": "es2017",
- "sourceMap": true,
- "outDir": "./dist",
- "baseUrl": "./",
- "incremental": true
- },
- "exclude": ["node_modules", "dist"]
-}
diff --git a/tests/.gitkeep b/tests/.gitkeep
deleted file mode 100644
index e69de29bb..000000000
diff --git a/tsconfig.json b/tsconfig.json
index ba120591b..e35a3b1c3 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -1,21 +1,21 @@
{
"compilerOptions": {
- "module": "commonjs",
- "allowSyntheticDefaultImports": true,
+ "target": "ES2017",
+ "module": "CommonJS",
+ "lib": ["ESNext"],
"declaration": true,
- "noImplicitAny": false,
- "noUnusedLocals": false,
- "importHelpers": true,
- "removeComments": true,
- "noLib": false,
- "emitDecoratorMetadata": true,
- "experimentalDecorators": true,
- "target": "es6",
- "sourceMap": false,
"outDir": "./dist",
- "rootDir": "./lib",
- "lib": ["es7", "DOM"]
+ "rootDir": ".",
+ "strict": true,
+ "esModuleInterop": true,
+ "experimentalDecorators": true,
+ "emitDecoratorMetadata": true,
+ "skipLibCheck": true,
+ "forceConsistentCasingInFileNames": true,
+ "moduleResolution": "Node",
+ "resolveJsonModule": true,
+ "isolatedModules": true,
+ "noEmit": true
},
- "include": ["lib/**/*"],
"exclude": ["node_modules", "**/*.spec.ts"]
}
diff --git a/turbo.json b/turbo.json
new file mode 100644
index 000000000..a926eaf86
--- /dev/null
+++ b/turbo.json
@@ -0,0 +1,22 @@
+{
+ "$schema": "https://turbo.build/schema.json",
+ "pipeline": {
+ "build": {
+ "outputs": ["dist/**", "public/dist/**"],
+ "dependsOn": ["^build"]
+ },
+ "lint": {
+ "dependsOn": ["^build"]
+ },
+ "test": {
+ "dependsOn": ["^build"]
+ },
+ "dev": {
+ "cache": false,
+ "persistent": true
+ },
+ "clean": {
+ "cache": false
+ }
+ }
+}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Call To Action
-
-