Configuring watchman in ember-cli
Asked Answered
B

1

7

In my ember-cli app, .watchman config file, I've mentioned what directories to ignore while watching, like "ignore_dirs": ["tmp"]. Now I want to watch files in a directory which is outside my app directory. Is there any way to do it?

Balkanize answered 15/12, 2015 at 13:41 Comment(3)
Did you ever figure this out?Lamartine
Can you clarify the following? As far as I understood it, you want to watch changes outside your ember app folder, which means on the project's root level. E.g. your tmp folder which you are already ignoring in your .watchmanconfig file is also living on the project's root level. Do I understand it correctly, that you want to watch changes in other sibling folders of tmp, e.g. in public or tests?Phone
@Phone Yes, I want to watch changes in sibling folders of tmp.Balkanize
P
5

If you had an ember project called my-ember-app in which the directory structure would typically look something like this:

my-ember-app
 .watchmanconfig
 -- app
 -- bower_components
 -- config
 -- dist
 -- node_modules
 -- public
 -- tests
 -- tmp
 -- vendor

and if you wanted watchman to not only ignore changes in the tmp but also in the sibling folder public, your .watchmanconfig file would have to look like this:

{
  "ignore_dirs": ["tmp","public"]
}

You can find out more about the ignore_dirs option value of the .watchmanconfig file in the documentation.


If that isn't working in your setup yet, make also sure that

Watchman is actually installed.

Ember CLI doesn't come with watchman out of the box, so you will have to install this additionally. If you notice this message showing up in your terminal once you spin up your ember app with ember serve:

Could not find watchman, falling back to NodeWatcher for file system events Livereload server on http://localhost:49152 Serving on http://localhost:4200/

watchman is not installed yet. On OSX you can install Watchman using Homebrew: brew install watchman and installation instructions for other OS'es can be found in the Watchman documentation.

the watch for your project is removed and readded after editing .watchmanconfig.

As stated in the documentation, watchman doesn't pick up on changes in your .watchmanconfig file automatically. For your new configuration to take any effect, move to the root of your ember project

cd my-ember-app

to first remove the watch

watchman watch-del .

and then re-add the watch

watchman watch .

You can check if the changes have been recognised by watchman correctly by using the command watchman get-config .

Phone answered 17/10, 2016 at 22:35 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.