Join egghead, unlock knowledge.

Want more egghead? It's 45% off for a limited time only!

This lesson is for members. Join us? Get access to all 3,000+ tutorials + a community with expert developers around the world.

Unlock All Content for 45% Off

Already subscribed? Sign In

Save 45% for a limited time.

Get access to all courses and lessons on egghead today.

Autoplay

    Run npm scripts in series

    Elijah ManorElijah Manor

    After creating several npm script it becomes useful to run multiple scripts back-to-back in series. This is a nice feature because you can enforce that one script needs to complete before starting another one.

    npmnpm
    Code

    Code

    Become a Member to view code

    You must be a Member to view code

    Access all courses and lessons, track your progress, gain confidence and expertise.

    Become a Member
    and unlock code for this lesson
    Transcript

    Transcript

    00:01 Before we run our tests, it would be nice to lint our JavaScript and our styles first. What we're going to do is we're going to npm run eslint and then we're going to use the double ampersand in order to run multiple scripts in series. Then we'll also run our style lint script to lint our SaaS. The nice thing about this is that if any of the linting fails, then the rest of the command is aborted.

    00:24 Let's quit to our terminal and run npm test or npmt, and you'll see first it's linting our JavaScript and linting our SaaS, then running our tests. In this case, all the linting passed, so the tests will run at the end. This time, let's go into our index CSS file and change one of our colors to green, then we'll save that.

    00:46 We'll run our tests, but this time, the JavaScript linting passed, but our style lint failed, because we're using a named color and that's one of our rules, so we'll need to address that linting error, if we want the test to run.

    Discuss

    Discuss