From 367670735247126c0bf4a3c9df45969652968371 Mon Sep 17 00:00:00 2001 From: Luke Abbott Date: Wed, 6 Jun 2018 15:45:38 +1000 Subject: [PATCH 1/5] Add setting to silence "Add route: _____" messages They are output every time Meteor restarts, which can get annoying in development. So it's nice to have an option to disable them while still getting info messages about other things. --- lib/mailer.js | 1 + lib/routing.js | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/mailer.js b/lib/mailer.js index 5e4853a..856e9ba 100644 --- a/lib/mailer.js +++ b/lib/mailer.js @@ -25,6 +25,7 @@ const TAG = 'mailer'; export const Mailer = { settings: { silent: false, + silentRouteAdd: false, routePrefix: 'emails', baseUrl: process.env.ROOT_URL, testEmail: null, diff --git a/lib/routing.js b/lib/routing.js index 3897678..c7b6a15 100644 --- a/lib/routing.js +++ b/lib/routing.js @@ -148,7 +148,9 @@ export default function Routing(template, settings, render, compile) { const name = Utils.capitalizeFirstChar(template.name); const routeName = String(type + name); - Utils.Logger.info(`Add route: [${routeName}] at path ${path}`); + if (!settings.silentRouteAdd) { + Utils.Logger.info(`Add route: [${routeName}] at path ${path}`); + } Picker.route(path, (params, req, res) => action(req, res, params, template)); }); From 1a4e37f7283a3b358d6d79969f67698bd839274c Mon Sep 17 00:00:00 2001 From: Luke Abbott Date: Wed, 6 Jun 2018 15:46:34 +1000 Subject: [PATCH 2/5] Support a couple more forks of FlowRouter --- lib/template-helpers.js | 4 ++++ package.js | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/template-helpers.js b/lib/template-helpers.js index 90329fb..edca9ae 100644 --- a/lib/template-helpers.js +++ b/lib/template-helpers.js @@ -1,5 +1,9 @@ import Utils from './utils'; +if (Package['ostrio:flow-router-extra']) { + FlowRouter = require('meteor/ostrio:flow-router-extra').FlowRouter; // this fork doesn't use a global scope +} + // # Template helpers // // Built-in template helpers. diff --git a/package.js b/package.js index 65c215b..405304d 100644 --- a/package.js +++ b/package.js @@ -15,7 +15,9 @@ Package.onUse(function(api) { api.use([ 'chrisbutler:node-sass@3.2.0', 'iron:router@1.0.7', - 'kadira:flow-router@2.9.0' + 'kadira:flow-router@2.9.0', + 'staringatlights:flow-router', + 'ostrio:flow-router-extra' ], where, { weak: true }); api.use([ From 4c41e2068d0cbc014c9e26ffc559767521706556 Mon Sep 17 00:00:00 2001 From: Luke Abbott Date: Wed, 6 Jun 2018 15:47:13 +1000 Subject: [PATCH 3/5] Future-proofing for Meteor 2.0+ --- lib/utils.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/utils.js b/lib/utils.js index 48e4402..8a77f1e 100644 --- a/lib/utils.js +++ b/lib/utils.js @@ -5,9 +5,10 @@ import Path from 'path'; import { htmlToText } from 'meteor/lookback:html-to-text'; const isDevEnv = process.env.NODE_ENV === 'development'; +const majorVersion = parseInt(Meteor.release.split('.')[0], 10); const minorVersion = parseInt(Meteor.release.split('.')[1], 10); -const isModernMeteor = minorVersion >= 3; +const isModernMeteor = majorVersion > 1 || minorVersion >= 3; // since meteor 1.3 we no longer need meteor hacks just use the npm version const sass = (function() { From 7e67451f011306564ebafd70269a16680c427c8c Mon Sep 17 00:00:00 2001 From: Luke Abbott Date: Wed, 6 Jun 2018 15:48:13 +1000 Subject: [PATCH 4/5] Import juice and html-to-text directly from npm (instead of Meteor packages) --- lib/utils.js | 3 ++- package.js | 9 ++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/lib/utils.js b/lib/utils.js index 8a77f1e..c716a0f 100644 --- a/lib/utils.js +++ b/lib/utils.js @@ -2,7 +2,8 @@ import fs from 'fs'; import Path from 'path'; -import { htmlToText } from 'meteor/lookback:html-to-text'; +var htmlToText = Npm.require('html-to-text'); +var juice = Npm.require('juice'); const isDevEnv = process.env.NODE_ENV === 'development'; const majorVersion = parseInt(Meteor.release.split('.')[0], 10); diff --git a/package.js b/package.js index 405304d..a915a6e 100644 --- a/package.js +++ b/package.js @@ -8,6 +8,11 @@ Package.describe({ git: 'https://github.com/lookback/meteor-emails.git' }); +Npm.depends({ + 'html-to-text': '4.0.0', + 'juice': '4.3.1' +}); + Package.onUse(function(api) { api.versionsFrom('1.0.4'); @@ -25,10 +30,8 @@ Package.onUse(function(api) { 'check', 'underscore', 'email', - 'sacha:juice@0.1.3', 'meteorhacks:ssr@2.2.0', - 'meteorhacks:picker@1.0.3', - 'lookback:html-to-text@2.1.3_2' + 'meteorhacks:picker@1.0.3' ], where); api.addFiles([ From bd67bd6ff1e62fc68dafcbc0069b826ff7396c05 Mon Sep 17 00:00:00 2001 From: Luke Abbott Date: Wed, 6 Jun 2018 15:48:30 +1000 Subject: [PATCH 5/5] Bump version to 0.7.8 --- package.js | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package.js b/package.js index a915a6e..8b81bb0 100644 --- a/package.js +++ b/package.js @@ -3,8 +3,8 @@ var where = 'server'; Package.describe({ name: 'lookback:emails', - summary: 'Send HTML emails with server side Blaze templates. Preview and debug in the browser.', - version: '0.7.7', + summary: 'Send HTML emails with server-side Blaze templates. Preview and debug in the browser.', + version: '0.7.8', git: 'https://github.com/lookback/meteor-emails.git' }); diff --git a/package.json b/package.json index 36cee74..6e2f2e5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "lookback-emails", - "version": "0.7.7", + "version": "0.7.8", "description": "`lookback:emails` is a Meteor package that makes it easier to build, test and debug rich HTML emails.", "repository": { "type": "git",