Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Configuring watchman in ember-cli

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?

like image 704
Sathyanarayanan Ganesan Avatar asked Dec 15 '15 13:12

Sathyanarayanan Ganesan


People also ask

Which command is used to install the ember CLI?

Installing Ember is done using NPM. While you're at it we recommend you to also install phantomjs (if you don't have it already). Ember CLI uses phantomjs to run tests from the command line (without the need for a browser to be open).

What is Ember CLI?

Ember CLI, Ember's command line interface, provides a standard project structure, a set of development tools, and an addon system. This allows Ember developers to focus on building apps rather than building the support structures that make them run.

What is Ember CLI Babel?

Ember CLI by default uses Babel. js to allow you to use tomorrow's JavaScript, today. It will ensure that you can use the newest features in the language and know that they will be transformed to JavaScript that can run in every browser you support.

How do I update ember addons?

Step 3: Upgrade Ember CLI and friends with ember-cli-update For example, if you're on 2.16, first go to 2.18, then 3.4. This tool takes care of the annoying parts of an upgrade – changing Ember CLI's autogenerated blueprint files to match their new versions. You will run into git conflicts, so fix them as usual.


1 Answers

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 .

like image 68
jessica Avatar answered Sep 22 '22 13:09

jessica