December 6, 2019

264 words 2 mins read

Using npm scripts as your build tool

Using npm scripts as your build tool

Elijah Manor explains how to use npm scripts to handle your various build needs, covering running scripts in series or parallel, using lifecycle hooks, passing arguments, piping data, using environment variables, running scripts on file change or when Git hooks are triggered, and organizing our scripts in external filesas well as how to modify your scripts to run across Mac, Linux, and Windows.

Talk Title Using npm scripts as your build tool
Speakers Elijah Manor (LeanKit)
Conference O’Reilly Fluent Conference
Conf Tag The Web Platform in Practice
Location San Jose, California
Date June 20-22, 2017
URL Talk Page
Slides Talk Slides
Video

If you’re building a JavaScript application, chances are you’re already using npm to install your dependencies. Using an example project, Elijah Manor walks you through leveraging npm scripts to handle all of your various build needs. Elijah begins by exploring existing npm scripts, creating custom scripts, having 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. Elijah then looks at several node packages that enable you to use shorthand and wildcard syntax, run scripts when either the file system changes or certain Git hooks are triggered, and provide ways to easily find and execute the scripts we want. Elijah ends by examining several techniques to split out npm scripts to external files once they get large or complicated and addressing considerations when trying to run npm scripts across different environments (i.e., Mac, Linux, and Windows).

comments powered by Disqus