This course has been updated! We now recommend you take the AWS for Front-End Engineers (ft. S3, Cloudfront & Route 53) course.

Check out a free preview of the full Zero to Production Node.js on Amazon Web Services course:
The "Exercise 2: Enhancing our Build Tools" Lesson is part of the full, Zero to Production Node.js on Amazon Web Services course featured in this preview video. Here's what you'd learn in this lesson:

In this exercise, you will add an NPM script as a shortcut for the Sequelize migrate command. You will also uglify the JavaScript application code during the build process with Grunt. Tasks for this exercise are in the Github project’s issues and labeled with “exercise2”.

Get Unlimited Access Now

Transcript from the "Exercise 2: Enhancing our Build Tools" Lesson

>> [MUSIC]

>> Kevin Whinnery: Now it's time for the next exercise portion of our morning. Where you fix more stuff in the example code project. So, to correspond with exercise number two. We've got some more GitHub issues for you to take a look at.
>> Kevin Whinnery: They are tagged with exercise two.
>> Kevin Whinnery: And the first one is a bit that probably needs to be implemented before we take this thing fully to production which is a task which will, a task to modify our collect static task which we already have in addition to running our application JavaScript through Browserify to then run it through Uglify as well.

[00:00:55] So compressing the JavaScript source into a minified JavaScript source file that we can use in production and putting it into the public directory just like we do with the rest of the collect stack command so spoiler alert. There is a Grunt plugin called Uglify which is probably the place to start barking up.

[00:01:17] If you if you want to take a crack at that task. So that is number one. For bonus points actually on this task, I didn't actually call it out here, but if you look in the EJS template which renders our TODO MVC page, there's a little bit of conditional logic in there that inserts a script tag to the minified version of app.css if we're in the production environment.

[00:01:44] But the JavaScript is just app.JS every time so maybe we also want to in the production environment include the minified JS file rather than the fully inflated one with the source maps and everything. So that's another bit that you might want to take care of during this particular issue.

[00:02:03] The other one that I put out there was to add an NPM start script that is dedicated just for running migrations. I think you'll probably notice something in the package.json that already does run the migrations but post start, which is what it's currently assigned to, can do lots of other things.

[00:02:31] So it might be nice to have an NPM script which just runs migrations using the sequelize command line tool. And so, for that you'll have to learn a slightly different incantation to actually run that and make it work. So, adding a special purpose migration command to our NPM start NPM scripts will be another thing you could work on.

[00:02:55] And those are the two I got, but I'm getting like unsolicited pull requests for all kinds of stuff which is awesome. It's working, I'm very stoked at what you guys are doing with this.