Skip to content

Task Runners

Marie-Louise edited this page Jan 10, 2019 · 6 revisions

A task runner is an automated way of performing tasks over and over again.

Common software development tasks include

  • running test suites
  • Compiling sass and or Javascript etc files
  • starting a web server
  • starting a worker ( can send out notifications or emails)
  • starting a watcher (to watch for errors in the code)

Popular Task runners

  • Gulp
  • Grunt

These are especially good for complex projects.

  • NPM

Is quick to set up and is perhaps the most popular out of the three.

NPM tasks are called scripts which are added to the scripts property in a package.json file

"scripts" : {
             "<name>" : "<command>"
             ...
            },

Tests are nested inside the scripts property and are given a name and command. This is executed in the command line when the task is run.

Types of NPM tasks

  • Built in

these tasks do not require the run command. An example of this is test. So

npm run test

can also be ran as

npm test
  • Arbitrary

These are custom task that you've named yourself which require NPMs run command

Clone this wiki locally