Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Beginning Server-Side Application Development with Angular

You're reading from   Beginning Server-Side Application Development with Angular Discover how to rapidly prototype SEO-friendly web applications with Angular Universal

Arrow left icon
Product type Paperback
Published in Apr 2018
Publisher
ISBN-13 9781789342161
Length 110 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Bram Borggreve Bram Borggreve
Author Profile Icon Bram Borggreve
Bram Borggreve
Arrow right icon
View More author details
Toc

Adding Run Scripts to package.json


Now that we have added a second application to our Angular CLI config, we need to make sure we can easily build both applications without having to memorize the exact commands.

In order to do so, we will leverage the so-called npm scripts. These scripts are used to define operations that can be performed on our application. Examples of these operations are building the application, running tests, and deploying the application to a staging or production environment.

We can define our npm scripts in the scripts section of the package.json file in the root of our project.

Here, we will add three scripts called build, build:browser, and build:server, where the first script will invoke the other two.

This gives us the flexibility to run the two commands at once, or run them independently if we like.

To get an idea of how these scripts work, consider the following flow:

  1. The npm run build command will first run npm run build:browser.

  2. When that command is finished, it...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €18.99/month. Cancel anytime