Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CHORE/REFACTOR] Turborepo #1173

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 27 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -28,7 +45,7 @@ speed-measure-plugin.json
!.vscode/launch.json
!.vscode/extensions.json

# misc
# Misc
/.sass-cache
/connect.lock
/coverage
Expand All @@ -49,4 +66,7 @@ website/translated_docs
website/build/
website/yarn.lock
website/node_modules
website/i18n/*
website/i18n/*

# Logs
*.log
14 changes: 14 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -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"
}
]
}
56 changes: 56 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -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"
]
}
34 changes: 27 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
<!-- markdownlint-disable no-inline-html -->
<!-- markdownlint-disable first-line-heading -->

<p align="center">
<a href="http://nestjs.com/" target="blank">
<img src="https://nestjs.com/img/logo_text.svg" width="320" alt="Nest Logo" />
Expand All @@ -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
Expand All @@ -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
Expand All @@ -39,6 +58,7 @@ npm install --save mjml
```

#### with yarn

```sh
yarn add handlebars
#or
Expand All @@ -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

Expand Down
52 changes: 52 additions & 0 deletions apps/01-basic-mailer/README.md
Original file line number Diff line number Diff line change
@@ -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.
30 changes: 30 additions & 0 deletions apps/01-basic-mailer/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"name": "@nestjs-modules/01-basic-mailer",
"version": "0.0.1",
"description": "Nestjs mailer module sample implementation",
"author": "Juandav <e.juandav@gmail.com>",
"types": "dist/index.d.ts",
"main": "index.ts",
"scripts": {
"tsc": "tsc -p tsconfig.json",
"build": "tsup",
"dev": "nest start --watch",
"debug": "nest start --debug --watch",
"start": "nest start"
},
"dependencies": {
"@nestjs-modules/mailer": "workspace:*",
"@nestjs/common": "10.3.8",
"@nestjs/core": "10.3.8",
"@nestjs/platform-express": "10.3.8",
"dotenv": "16.4.5",
"nodemailer": "6.9.13",
"reflect-metadata": "0.2.2",
"rimraf": "5.0.5",
"rxjs": "7.8.1"
},
"devDependencies": {
"@nestjs/cli": "10.3.2",
"tsup": "8.0.2"
}
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
require('dotenv').config();

import { Module } from '@nestjs/common';
import { MailerModule } from '@nestjs-modules/mailer';
import { HandlebarsAdapter } from '@nestjs-modules/mailer/adapters/handlebars.adapter';

import { AppController } from './app.controller';
import { AppService } from './app.service';
import { MailerModule } from '@nestjs-modules/mailer/';
import { HandlebarsAdapter } from '@nestjs-modules/mailer/adapters/handlebars.adapter';


@Module({
imports: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export class AppService {
.sendMail({
to: 'user@gmail.com', // List of receivers email address
from: 'user@outlook.com', // Senders email address
subject: 'Testing Nest Mailermodule with template ✔',
subject: 'Testing Nest Mailer Module with template ✔',
template: 'index', // The `.pug` or `.hbs` extension is appended automatically.
context: { // Data to be sent to template engine.
code: 'cf1a3f828287',
Expand All @@ -54,7 +54,7 @@ export class AppService {
.sendMail({
to: 'test@nestjs.com',
from: 'noreply@nestjs.com',
subject: 'Testing Nest Mailermodule with template ✔',
subject: 'Testing Nest Mailer Module with template ✔',
template: __dirname + '/welcome', // The `.pug` or `.hbs` extension is appended automatically.
context: { // Data to be sent to template engine.
code: 'cf1a3f828287',
Expand All @@ -68,5 +68,4 @@ export class AppService {
console.log(err)
});
}

}
3 changes: 3 additions & 0 deletions apps/01-basic-mailer/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import bootstrap from "./main";

bootstrap();
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ async function bootstrap() {
const app = await NestFactory.create(AppModule);
await app.listen(3000);
}
bootstrap();

export default bootstrap;
11 changes: 11 additions & 0 deletions apps/01-basic-mailer/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": "./dist",
"rootDir": "./src",
"declaration": true
},
"include": ["**/*.ts", "node_modules/**/*.d.ts"],
"exclude": ["node_modules", ".turbo", "dist", "**/*.spec.ts"],
"moduleResolution": "node"
}
10 changes: 10 additions & 0 deletions apps/01-basic-mailer/tsup.config.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/* eslint-disable import/no-extraneous-dependencies */
const { defineConfig } = require('tsup');

exports.default = defineConfig({
entry: ['index.ts'],
dts: true,
splitting: false,
sourcemap: true,
clean: true,
});
24 changes: 0 additions & 24 deletions lib/mailer-transport.factory.ts

This file was deleted.

Loading