I'm pleased to announce the release of my new open-source project,
ncline. ncline stands for "Node Command Line", and it's a platform for
you launch ncline, it loops through the collections of module folders
within the master "cmdModules" folder and adds any functions exported
under the "commands" property to a catalog of executable commands. The
user can then execute any of those commands from the ncline command
prompt by typing the command name followed by any required or optional
When writing unit tests for Node.js applications, you can use the proxyquire npm module to override the modules pulled in by the file under test using require(), replacing them with your own.
Suppose for a moment that you have an AngularJS single-page
application, one with view routes managed with then ngRoute module, that
is used by users with different roles. A user in your company's Sales
group has access to certain areas of the application, while a user in
Accounting works in other parts of the application. And there are also
some areas of the application that are common to all users.
Now, you already have the navigation menu wired up so that users only
see the navigation links appropriate to their user roles. And even if a
Sales user somehow ends up in a view meant for an Accounting user, the
server answering the REST calls for the data powering that view is going
to check the security token sent with the request and isn't going to
honor that request. But you'd still like to keep users out of UI views
that aren't meant for them.
You could do a user access check at the start of each controller, or
perhaps within the resolve property of each route, but that would be
repetitive and it's something you could forget to do on occasion.
Sometimes projects take on a life of their own, and you end up with something unexpected.
I set out to create an template for CRUD-focused single page
AngularJS web applications, something I and perhaps my colleagues could
use as a foundation for writing new applications. But under the
momentum of self-applied scope creep, what I ended up creating was a
Grunt-powered codebase library management tool, with my original
template concept as the first codebase of potentially multiple
One of the most common uses of the Grunt
task runner is to build a deployment package out of your development
code for your website or web application, and part of that build process
singular (or at least fewer) files for optimal download.
The grunt-contrib-concat Grunt plugin allows you to configure a concatenation task to target individual files or entire directories, like so:
src: [ 'dev/jquery/jquery.js', 'dev/angular/services/*.js', 'dev/angular/directives/*.js' ],
The only drawback is that you have to update the task's "src"
As I was playing around with Grunt on a personal project, I came to
wonder: could I create a Grunt task or set of tasks that could figure
out which files to concatenate based on the <link> and
<script> tags in my code? Here's what I came up with.