Defining and executing npm scripts

Scripts are an awesome feature of npm that we will use throughout the book and that we heavily recommend not overlooking.

Scripts are sets of commands that you can include in the package.json file of your projects in order to automate various tasks. An example of a task that you could automate using scripts is the compilation of your project (for example, in our case, the transpilation from TypeScript to JavaScript).

Using scripts, you can define fairly complex build systems for your applications. If you want a real-world example, check this package.json file out:

With a newly initialized npm project, you usually only have the following: ...

Get Learn TypeScript 3 by Building Web Applications now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.