Keeps the lawn clean
lawnman
runs your npm scripts on changes.
Uses nodemon
and npm-run-all
.
Inspired by yardman
.
npm i lawnman -D
Then use lawnman in your package.json scripts:
{
"scripts": {
"dev": "lawnman js,json lint test",
"lint": "eslint lib/ --fix",
"test": "ava"
}
}
lawnman <ext>[,<ext>,...] <script> [<script...>]\
--and\
<ext>[,<ext>,...] <script> [<script...>]\
--and\
...
Run the test script when any js file change.
lawnman js test
Watch js and scss files and compile accordingly
- Runs
npm run babel
when any js file changes - Runs
npm run compass
when any scss or png file changes
lawnman js babel --and scss,png compass
Watch js files and run multiple npm scripts
Runs npm run test
and then npm run format
when any js files change
lawnman js test format
If you only have one script in package.json
that uses lawnman, you can put the arguments into a .lawnmanrc
file.
For example, if you have this script in your package.json
{
"scripts": {
"dev": "lawnman cpp,cc,h,hpp,gyp rebuild e2e --and js,json lint test --and scss compass",
"test": "...", ...
}
}
You can put the arguments into a .lawnmanrc
file to clean up your package.json
to have it only run lawnman
. Empty lines is like --and
in the command line. It also supports comments.
# Build addons and run end-to-end tests
cpp,cc,h,hpp,gyp rebuild e2e
# Lint and test javascript
js,json lint test
# Compile scss
scss compass
Your dev
script will then look much nicer
{
"scripts": {
"dev": "lawnman",
"test": "...", ...
}
}