-
Notifications
You must be signed in to change notification settings - Fork 0
Task Runners
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
- install files or modules
- starting a web server
- starting a worker ( can send out notifications or emails)
- starting a watcher (to watch for errors in the code)
- 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. It can run any binary or command line application.
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.
- 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
using Mocha javascript testing framework as an example - to run mocha, go to the node_modules directory. There's a .bin hidden directory
node_modules/.bin/mocha
inside there are command line executables like Mocha. type the command above and it runs the test.
Or you can update the scripts object in the package.json file with the Mocha command
"scripts" : {
"test" : "mocha"
},
run it by typing npm run test or 'npm test`
- Arbitrary
These are custom tasks that you've named yourself which require NPMs run command