Skip to content

Instantly share code, notes, and snippets.

@elijahmanor
Last active January 11, 2017 14:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save elijahmanor/0a38144796e0ddc2d741e1b1272333a5 to your computer and use it in GitHub Desktop.
Save elijahmanor/0a38144796e0ddc2d741e1b1272333a5 to your computer and use it in GitHub Desktop.
Using npm scripts as your build tool

Using npm scripts as your build tool

Title

Using npm scripts as your build tool

Description (unpublished notes)

This talk is meant for JavaScript developers who have a basic understanding of npm and would like to start using npm scripts as their build tool.

Takeaway for the Audience

The take of this talk is that you can use npm script as your build tool. There are many tips, tricks, and node packages covered that the viewer can start using as they develop their own build system.

Short Description

In this session, we will take a look at using npm scripts to handle your various build needs. We will cover running scripts in series and in parallel, using npm script lifecycle hooks, passing arguments, piping data, using environment and config variables, running scripts when files change or when git hooks are triggered, and look at ways to organize our scripts when they get large or complicated. In addition we will talk about cross-environment issues so they our scripts can run on Mac, Linux, and Windows.

Abstract

If you are building a JavaScript application then chances are you're already using npm to install your dependencies. In this session, we'll take an example project and slowly start to leverage npm scripts to handle all of our various build needs.

We will start by using existing npm scripts, creating our own custom script, having our scripts run in series and in parallel, using various npm script lifecycle hooks, passing arguments from one script to another, piping data from one process to another, and using environment or config variables within our scripts.

In addition we will look at several node packages that enable us to use shorthand and wildcard syntax, that will run scripts when either when the file system changes or when certain git hooks are triggered, and will provide us various ways to easily find and execute the scripts we want.

We will examine several techniques to split out npm scripts to external files once they get large or complicated. And finally we will address the various things you need to consider when trying to run npm scripts across different environments (Mac, Linux, Windows).

Bio

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment