gilamran/tsc-watch

Add some options

zanminkian opened this issue · 2 comments

Please consider add some options to make this tool more convenient.

  • --clean: remove the outDir directory before every compilation. (This option extends #169)
  • --copyfiles: copy non-ts/js files to outDir. This is an important feature that tsc lacks of. We still have no elegant solution. I hope this tool can solve it.
  • --no-watch: With this option, we can focus this tool only. Otherwise, we have to face both tsc and tsc-watch. It's not very convenient. More #154

Without these options and #169, I have to write scripts below and install 3 pkgs (rimraf, copyfiles, nodemon). I hope this tool can help like NODE_ENV=local tsc-watch --clean --copyfiles --onSuccess 'node bootstrap.js'. It's much more clear and elegant!

{
  "scripts": {
    "clean": "rimraf dist",
    "compile": "tsc -p tsconfig.build.json",
    "copy-files": "copyfiles -u 1 src/**/*.json dist",
    "build": "npm run clean && npm run compile && npm run copy-files",
    "dev": "NODE_ENV=local nodemon -w src -e ts --exec 'npm run build && node bootstrap.js'",
  }
}

This is interesting, but I don't think that this is the role of tsc-watch, I want to keep this clean as possible.
You can create a simple wrapper to tsc-watch that does exactly what you offered.
Regarding the no-watch I'll reopen the issue

You can create a simple wrapper to tsc-watch that does exactly what you offered.

Seems impossible because tsc-watch cannot hook before compilation according to #169. That means I have to continue using rimraf, copyfiles, nodemon until I finish my tsc-watch-x.