cloverfield-tools / cf-package

Cloverfield Package Scaffold
MIT License
98 stars 14 forks source link

Watch task / dev console. #33

Open ericelliott opened 9 years ago

ericelliott commented 9 years ago

I almost always use a watch task to create a dedicated dev console that simply monitors for file changes and reruns unit tests. That way I always have lint and unit test results on the screen while I'm developing.

On save, the task should:

Avoid any time-consuming activity. This should act like a realtime status monitor.

nkbt commented 9 years ago
  1. https://www.npmjs.com/package/eslint-watch
  2. node-watch
  3. https://www.npmjs.com/package/concurrently to run multiple concurrent tasks in background

I usually do not add these things since I started using webpack and eslint-loader, but here it makes sense

ericelliott commented 9 years ago

You don't need es-lint watch.

npm install --save-dev watch
  "scripts": {
    "watch": "watch 'npm run -s lint  && npm test -s' test/ examples/"
  },

The -s in these prevents npm from scrolling the errors off the screen with the giant npm error message of doom.

nkbt commented 9 years ago

In this way you:

  1. run both tasks consequently.
  2. run over all files, not only changed ones.

eslint-watch runs over only changed files in contrast

That may not be a big deal on such a tiny project as cf-package, but still it makes sense not to burn more cpu then you actually need at the moment :)

halhenke commented 9 years ago

Will these detect/run for new files also? One annoyance of gulp.watch is that it only watches anything that was present at the time the task was initialized.

ericelliott commented 9 years ago

Yeah, that's what I want for small modules. On our app scaffold, it's probably better to plug into webpack's watch feature.

ericelliott commented 9 years ago

Will these detect/run for new files also?

Yes.