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

migrate to typescript & node.js-compatible es modules #241

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 0 additions & 7 deletions email.esm.js

This file was deleted.

5 changes: 0 additions & 5 deletions email.js

This file was deleted.

5 changes: 5 additions & 0 deletions email.ts
@@ -0,0 +1,5 @@
export * as client from './smtp/client';
export * as message from './smtp/message';
export * as date from './smtp/date';
export * as SMTP from './smtp/smtp';
export * as error from './smtp/error';
120 changes: 69 additions & 51 deletions package.json
@@ -1,55 +1,73 @@
{
"name": "emailjs",
"description": "send text/html emails and attachments (files, streams and strings) from node.js to any smtp server",
"version": "2.2.0",
"author": "eleith",
"contributors": [
"izuzak",
"Hiverness",
"mscdex",
"jimmybergman",
"zackschuster"
],
"repository": {
"type": "git",
"url": "http://github.com/eleith/emailjs.git"
},
"dependencies": {
"addressparser": "^0.3.2",
"emailjs-mime-codec": "^2.0.7"
},
"devDependencies": {
"chai": "^4.1.2",
"eslint": "^5.1.0",
"eslint-config-prettier": "^2.9.0",
"eslint-plugin-mocha": "^5.1.0",
"eslint-plugin-prettier": "^2.6.2",
"mailparser": "^2.2.0",
"mocha": "^5.2.0",
"prettier": "^1.13.7",
"rollup": "^0.62.0",
"rollup-plugin-commonjs": "^9.1.3",
"rollup-plugin-node-resolve": "^3.3.0",
"smtp-server": "^3.4.6"
},
"engine": [
"node >= 6"
],
"main": "email.js",
"scripts": {
"name": "emailjs",
"description": "send text/html emails and attachments (files, streams and strings) from node.js to any smtp server",
"version": "2.2.0",
"author": "eleith",
"contributors": [
"izuzak",
"Hiverness",
"mscdex",
"jimmybergman",
"zackschuster"
],
"repository": {
"type": "git",
"url": "http://github.com/eleith/emailjs.git"
},
"dependencies": {
"addressparser": "^0.3.2",
"emailjs-mime-codec": "^2.0.7"
},
"devDependencies": {
"@ledge/configs": "22.0.2",
"@ledge/types": "6.1.0",
"@types/addressparser": "2.7.2",
"@types/mailparser": "2.7.2",
"@types/smtp-server": "3.5.4",
"ava": "3.7.1",
"eslint": "^5.1.0",
"eslint-config-prettier": "^2.9.0",
"eslint-plugin-mocha": "^5.1.0",
"eslint-plugin-prettier": "^2.6.2",
"mailparser": "^2.2.0",
"prettier": "^1.13.7",
"rollup": "^0.62.0",
"rollup-plugin-commonjs": "^9.1.3",
"rollup-plugin-node-resolve": "^3.3.0",
"smtp-server": "^3.4.6",
"typescript": "3.8.3",
"ts-node": "8.9.0"
},
"engine": [
"node >= 10"
],
"main": "email.js",
"type": "module",
"scripts": {
"rollup": "rollup -c rollup.config.js && npm run rollup:test",
"rollup:test": "npm run test -- --file rollup/email.bundle.test.js",
"test": "mocha"
},
"license": "MIT",
"eslintIgnore": [
"rollup.config.js",
"rollup/email.bundle.js",
"email.esm.js"
],
"prettier": {
"singleQuote": true,
"trailingComma": "es5",
"useTabs": true
}
"test": "ava"
},
"license": "MIT",
"ava": {
"files": [
"test/*.ts"
],
"extensions": [
"ts"
],
"require": [
"ts-node/register/transpile-only"
]
},
"eslintIgnore": [
"rollup.config.js",
"rollup/email.bundle.js",
"email.esm.js"
],
"prettier": {
"singleQuote": true,
"trailingComma": "es5",
"useTabs": true
}
}
5 changes: 3 additions & 2 deletions rollup.config.js
@@ -1,15 +1,16 @@
import { builtinModules as external } from 'module';
import commonjs from 'rollup-plugin-commonjs';
import resolve from 'rollup-plugin-node-resolve';

export default {
input: 'email.esm.js',
input: 'email.js',
output: {
file: 'rollup/email.bundle.js',
format: 'cjs',
interop: false,
freeze: false,
},
external: require('module').builtinModules,
external,
plugins: [
resolve(),
commonjs(),
Expand Down