Skip to content
This repository was archived by the owner on Apr 3, 2019. It is now read-only.

fix(project): move mailer files into proper directories#1676

Merged
vladikoff merged 1 commit intomasterfrom
phil/mailer-tidy
Feb 24, 2017
Merged

fix(project): move mailer files into proper directories#1676
vladikoff merged 1 commit intomasterfrom
phil/mailer-tidy

Conversation

@philbooth
Copy link
Copy Markdown
Contributor

What have we here?

An attempt to impose a saner directory structure on the merged auth mailer files. Instead of everything living under a standalone mailer directory, the source files are in lib, the test files are in test, the scripts are in scripts and so on. Additionally, the dependencies and grunt tasks are merged in with the auth server's, so there's only one place for everything.

Is this just to satisfy your OCD?

No! There are tangible benefits too:

  • All of the tests are now run by mocha! tap is is dead!
  • There's only one package.json and only one npm-shrinkwrap.json and only one Gruntfile.js!
  • Source code in lib doesn't have to .. back up to the root when importing mailer modules!
  • The weirdness of some mailer source being in lib and some not is eradicated!
  • The mailer code is linted the same way as the auth server code now!
  • We're now running nsp against mailer deps!

What hasn't moved?

The notable thing I haven't tried to do is merge the config files, so mailer/config.js still exists and is referenced in a few places. This is partly because I'm wary of messing up ops-related stuff but mostly because they duplicate lots of things using different names, and updating all of those references makes the diff even more of a mess. I figure it's better to try and get this in first, then deal with the config afterwards.

Are you sure you didn't break anything?

Fairly sure. Obviously the code lints and the tests all pass. grunt templates still works. The send-sms script still sends SMS messages and the write-emails-to-disk script writes identical emails to the ones generated before this change. However, the machine I'm working on isn't properly set up like my old one so I haven't managed to deploy this branch via fxa-dev yet. If anyone else wants to check out this branch and give it a spin, that would be grand.

Anything else?

On the whole, I've tried to make the changes touch as few lines as possible, out of consideration for you the reviewer. So please bear that in mind before you pile in with your bike-sheddy comment about const, => or indentation. 😄

@mozilla/fxa-devs r?

* Gruntfile causes an error and should contain no strings
* bin/server.js extracts "/", so it is excluded.
*/
exclude: /(node_modules|test|Gruntfile|grunttasks|bin|scripts|\.git|config)/,
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Losing these excludes was another nice side-effect. None of these things pollute the same space as the mailer source any more.

apiSecret: smsConfig.apiSecret
})
var sendSms = P.promisify(nexmo.message.sendSms, { context: nexmo.message })
var sendSms = P.promisify(nexmo.message.sendSms, nexmo.message)
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Changed to work with the auth server's old version of bluebird. Can be put back when we fix #1674.

"shrinkwrap": "npmshrink",
"prepush": "grunt quicklint && grunt templates && git status -s | (! grep 'M lib/senders/templates/')",
"postinstall": "scripts/download_l10n.sh",
"shrinkwrap": "npmshrink && npm run postinstall",
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Without this explicit postinstall the mailer fails after you regenerate shrinkwrap.

"fxa-shared": "1.0.4",
"google-libphonenumber": "2.0.10",
"grunt-nunjucks-2-html": "vitkarpov/grunt-nunjucks-2-html#1900f91a756b2eaf900b20",
"handlebars": "4.0.6",
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Updated because nsp warnings. Seems to work fine.

if (error.reason && error.reasonCode) {
message = `${message}: ${error.reasonCode} ${error.reason}`
} else if (error.stack) {
message = error.stack
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This helped me debug a problem while I was making the changes, thought it earned the right to stick around.

.travis.yml Outdated
# Test fxa-auth-mailer
- cd mailer
- grunt templates
- npm test
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We already run npm test with COVERALLS_REPO_TOKEN=vKN3jjhAOwxkv9HG0VBX4EYIlWLPwiJ9d npm test above ^^^

@vladikoff
Copy link
Copy Markdown
Contributor

translations work well 👍
image

@vladikoff vladikoff merged commit d09759c into master Feb 24, 2017
@philbooth philbooth deleted the phil/mailer-tidy branch February 24, 2017 15:42
@rfk rfk added this to the FxA-0: quality milestone Mar 16, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants