I like ts-node-dev and I'm trying to avoid adding nodemon as a dev-dependence.
Nodemon allows executing an arbitrary command on current path when a watched file changes. I think that aligns nicely to create wacth versions of npm scripts:
// on package.json
"lint": "eslint",
"lint:watch": "nodemon ... --exec npm run lint",
I'm trying to do the same using ts-node-dev, but without success, yet. Is it possible?
EDIT 1
Following comments of @Trott, I realised my question could be clearer.
Why do you want to avoid adding
nodemonas a dev-dependency? Because I already usets-node-devto reload my application when I change my TS sources and it also works as a FS listener.What have you tried and what were the results? I tried the following, below; I can setup
ts-node-devto run the linter, but I have to copy-and-paste thelintscript into the end of thelint:watchscript. It works, but I believe it's not the ideal and I hope there's a better way to do it.
// real lines of my package.json
"lint": "eslint './src/**/*.ts' --cache --cache-location out/.eslintcache",
"lint:watch": "ts-node-dev --rs --debounce --transpile-only --respawn --inspect=7001 --watch './src/**/*.ts' -- node_modules/.bin/eslint './src/**/*.ts' --cache --cache-location out/.eslintcache",
// what I "intended"
"lint": "eslint './src/**/*.ts' --cache --cache-location out/.eslintcache",
"lint:watch": "ts-node-dev --rs --debounce --transpile-only --respawn --inspect=7001 --watch './src/**/*.ts' --exec npm run lint ",