Skip to content

Commit

Permalink
v6.4.8
Browse files Browse the repository at this point in the history
  • Loading branch information
andris9 committed May 28, 2020
1 parent 5874437 commit a0cab71
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 6 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "nodemailer",
"version": "6.4.7",
"version": "6.4.8",
"description": "Easy as cake e-mail sending from your Node.js applications",
"main": "lib/nodemailer.js",
"scripts": {
Expand Down
38 changes: 33 additions & 5 deletions postinstall.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,27 @@ const packageData = require('./package.json');
const isEnabled = value => !!value && value !== '0' && value !== 'false';
const canUseColor = isEnabled(process.env.npm_config_color);

const text = `=== Nodemailer ${packageData.version} ===
const title = `=== Nodemailer ${packageData.version} ===`;
const text = `
Thank you for using Nodemailer for your email sending needs! While Nodemailer itself is mostly meant to be a SMTP client there are other related projects in the Nodemailer project as well.
For example:
> IMAP API ( https://imapapi.com ) is a server application to easily access IMAP accounts via REST API
> ImapFlow ( https://imapflow.com/ ) is an async IMAP client library for Node.js
> NodemailerApp ( https://nodemailer.com/app/ ) is a cross platform GUI app to debug emails
> Project Pending ( https://projectpending.com/ ) allows you to park your project domains
> Ethereal Email ( https://ethereal.email/ ) is an email testing service that accepts all your test emails
`;

const secs = 4;

const formatCentered = (row, columns) => {
if (columns <= row.length) {
return row;
}

return ' '.repeat(Math.round(columns / 2 - row.length / 2)) + row;
};

const formatRow = (row, columns) => {
if (row.length <= columns) {
return [row];
Expand All @@ -27,10 +39,12 @@ const formatRow = (row, columns) => {
}
let slice = row.substr(0, columns);

let prefix = slice.charAt(0) === '>' ? ' ' : '';

let match = slice.match(/(\s+)[^\s]*$/);
if (match && match.index) {
let line = row.substr(0, match.index);
row = row.substr(line.length + match[1].length);
row = prefix + row.substr(line.length + match[1].length);
lines.push(line);
} else {
lines.push(row);
Expand All @@ -44,7 +58,7 @@ const wrapText = text => {
let columns = Number(process.stdout.columns) || 80;
columns = Math.min(columns, 80) - 1;

return text
return (formatCentered(title, columns) + '\n' + text)
.split('\n')
.flatMap(row => formatRow(row, columns))
.join('\n');
Expand All @@ -56,3 +70,17 @@ const banner = wrapText(text)
.replace(/(https:[^\s)]+)/g, '\u001B[94m $1 \u001B[96m');

console.log(canUseColor ? banner : banner.replace(/\u001B\[\d+m/g, ''));
if (canUseColor) {
process.stdout.write('\u001B[96m');
}

setInterval(() => {
process.stdout.write('.');
}, 500);

setTimeout(() => {
if (canUseColor) {
process.stdout.write('\u001B[0m\n');
}
process.exit(0);
}, secs * 1000 + 100);

3 comments on commit a0cab71

@FauxFaux
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This sleep, delaying npm install for five seconds for advertising purposes, for all users, for every single build on CI, which a human never sees, is disgusting, and you should be ashamed of yourself.

@andris9
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@FauxFaux I don't really see the problem here. Using Nodemailer is not mandatory in any way, it is my personal project that I have publicly and good willingly shared with anyone who wants to use it and that's about it, no liabilities involved. If you have any issues with current behaviour then either fork Nodemailer and remove the code you do not like or use an alternative like emailjs. It is from a different author, has more-or-less the same features and does not have any ads built in.

@FauxFaux
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I accept that you might want to put ads in, to try and benefit from the stuff you are providing, and we are using for free.

I do not accept that it is okay to delay our CI build by five seconds.

Please sign in to comment.