2.1.3 • Published 4 years ago
isom v2.1.3
Isom
Take your task runner further
If you have a tasks.json file running isom or npx isom will run the task you pass in or the start task.
Lifecyle
For every task you can define you can also have a pre post as well as a cleanup associated with it.
preruns before the main command.commandruns if theprecommand is successfulpostruns if thecommandwas successfulcleanruns regardless of the success or failure of the other tasks
Example
The tasks.json file
{
"prebuild": ["npx eslint ./src", "npx jest", "rm -rf dist"],
"build": "npx webpack --config ./src/webpack/prod.config.js --mode production",
"postbuild": ["npm publish", "npx publisher", "node ./src/tasks/announce.js"],
"cleanupbuild": "rm -rf dist"
}Then from the command line you can either run npx isom build or if installed globally isom build
You can use it within your scripts so in your package.json
{
"build": "isom build"
}Parallel Tasks
In addition to single items, a task can be an array of items. If the array is a pretask they execute in a series, however if the array is the main task to run, the tasks run in parallel.
Example
{
"predev": [
"docker-compose -f ./docker/docker-compose.yml up --detach",
"node ./src/scripts/delay.js",
"npx knex migrate:latest",
"npx knex seed:run"
],
"dev": [
"nodemon ./src/server/index.js",
"webpack-dev-server --config ./src/webpack/dev.config.js --mode development"
]
}Then from command line
isom devThen the predev tasks run in order then then dev task executes both tasks at the same time.