Tag Archives: npm

Give Grunt the Boot! A Guide to Using npm as a Build Tool

via Give Grunt the Boot! A Guide to Using npm as a Build Tool.

Front-end build and workflow tools are available in abundance: Grunt, Gulp, Broccoli, and Jake to name but a few. These tools can automate almost anything you find yourself doing repeatedly in a project, from minifying and concatenating source files, to running tests or compiling code. But the question is, do you need them? Do you really want to introduce an additional dependency to your project? The answer is “No!”. There is a free alternative that can do the majority of these tasks for you and it comes bundled withNode.js. Of course I’m talking about npm.

In this article we’ll discuss what npm is capable of as a build tool. If you’d like a quick primer on npm before starting, please refer to our beginner’s guide to npm. If you’d like to follow along, you can find the code used in this article on GitHub.

How to Build A Slackbot + Deploy an App to Heroku for Absolute Beginners

via The npm Blog — How to Build A Slackbot + Deploy an App to Heroku….

Back in ye olde days of the internet, there was IRC (Internet Relay Chat), a chat network with channels and servers for every microcosm in the world. Folks would make these little bots or services — they’d greet you when you joined a channel, played trivia, Uno and other chat-based games with you. Unfortunately, if you wanted to make one yourself, you likely needed some knowledge of Perl, client-server architecture and a handful of Unix commands.

Today, most will opt for a more aesthetic alternative to IRC. Namely, Slack — a chat-based team communication tool. The best part? You can create a Slackbot with substantially fewer roadblocks.

I’ll try not to make assumptions on the technologies you may or may not have on your machine here. So let’s go ahead and start from scratch. If you already have any or all of following downloaded, you’re ahead of the game!

How to create and publish npm modules for Nodejs applications

A short tutorial on creating and publishing a simple and reusable npm module for nodejs applications.


Pre and Post hooks for npm scripting

via Pre and Post hooks for npm scripting.

npm is at the core of developing in Node. Most of us use it to get packages, set up the package.json etc.

But when you put it together with the vast possibilities in package.json you get another gear. Then npm can actually become a build tool – driving every aspect of your development. Without getting unwieldy and out of control.

In this post I wanted to examine one of the lesser known features of scripting with npm and package.json; pre– and post hooks. In doing so I will most likely brush on a lot of other subjects too. We’ll see how it goes.

I’ll keep my code here

npm scripting: git, version and deploy

via npm scripting: git, version and deploy.

In the last post I promised to write something about “git, pushing and deploying”. This is purely from a personal need since I have used make for those things. I wanted to see if I can move all of that to use npm and package.jsoninstead.

I’ll also add a compile and minification step, just since that it’s a common need.

NodeJS ABC’s – M is for Modules

via Node.js ABC’s – M is for Modules.

As any one who has created a software system can tell you, after some point you get to a point in time where putting all your code in one big location becomes unmanageable and leads to maintenance issues.  The logical first step is to try to separate code that is related into smaller distinct entities and “include” them in the project in question.  But, what happens if two included file “A” and file “B” both define a “doSomething()” method?  Global Scope is sometimes convenient, but more often a cause for troubles when development and enhancing a product.

Different languages handle these “namespace” collisions in different ways.  Some make them optional, some a bit more strict.  Node avoids potential “global scope” issues by not offering an easy way to accidentally over-stuff the global scope.  This is done in the form of “Modules”.

At a high level, modules are just an easy way to group similar code together.  Every file in Node.js is considered a module, although modules can be a bit more complex than a single file.  Node modules allow you to select which functions and variables that are in the file are exposed to the calling application and, consequently, which ones are private.

Modules can be packaged and published to an online repository (most likely the Node Package Manager or npm) without those using the modules having to worry about one module conflicting with another in the project.

How-to Install the last version of Node.js (Node.js v0.12) and npm in Ubuntu 14.04 LTS

How-To Install the last version of Node.js in Ubuntu