COVID19 Lockdown Dev Log – Day 30, Creating A Custom Command In Package.json

What I Worked On

Better design and code refactoring on my Weather App

What I Learned

Today hasn’t involved much new learning as most of the day has been about design and refactoring. I did however come across creating custom commands for your scripts in ‘package.json’ file.

Instead of running “nodemon src/app.js -e js,hbs” in my terminal everytime I want to start my local development server, I learned that I could create a simple custom command that would execute it:

// package.json
// I removed all 'unnecessary' code

{
  "scripts": {
    "dev": "nodemon src/app.js - js,hbs"
  },
}

So now, when I want to execute the command to start my development server I just write:

npm run dev

Wonderful! 😀 Nodemon is an NPM package that watches for filechanges and reloads your development server so you don’t have to restart it yourself everytime you add changes to your files 😀

What Distracted Me During The Day

  • Had to take a trip to another town to pick up some wares 😀

Resources