GithubHelp home page GithubHelp logo

Comments (12)

amasad avatar amasad commented on May 24, 2024

I think you're running into this nodejs/node-v0.x-archive#5463. Sometimes restarting helps. Also maybe you're watching more directories than you have to. How many are you watching? Otherwise it's fixed in v0.11

from sane.

matthewmueller avatar matthewmueller commented on May 24, 2024

Yep that's what it is. I thought the glob would only watch those files, but it was watching all the dirs in node_modules, related to this: #23

Tradeoff I guess between the feature add/remove and watching a bunch of directories.

from sane.

matthewmueller avatar matthewmueller commented on May 24, 2024

Maybe you could conditionally watch directories (for the add and remove feature):

sane(root, glob)
  .watch('lib')
  .on('change', fn)
  .on('add', fn)

from sane.

amasad avatar amasad commented on May 24, 2024

Tradeoff I guess between the feature add/remove and watching a bunch of directories.

That's part of it but another problem is that sane will need to understand globs in order to safely ignore directories that will not produce a matching path. Example:

var glob = 'a/*.js';
var directory = 'a';
var file = 'a/a.js';

minimatch(directory, glob); // false
minimatch(file, glob); // true

Is there an easy way to do that?
It seems that minimatch does expose internal methods maybe we could use to do a partial match. If you want to work on it, I'd love to help.

from sane.

amasad avatar amasad commented on May 24, 2024

Also we can add a filter function to decide whether to watch a dir or not

from sane.

amasad avatar amasad commented on May 24, 2024

Reopening this to try and figure ways around it. Although this is fixed in v0.12 it seems like it's still some time away

from sane.

amasad avatar amasad commented on May 24, 2024

FYI 2d2b1a2 adds support for watchman which works really great on OS X and linux and doesn't suffer from this problem. I'd still want to find some time to make sane have better understanding of globs to lessen the severity of this bug

from sane.

matthewmueller avatar matthewmueller commented on May 24, 2024

@amasad sweet!

question: why not just make watchman the default, does it not do everything the default does?

from sane.

amasad avatar amasad commented on May 24, 2024

No windows support :/ But they're working on it but won't come until next year.
It also requires people to go install a native program which I feel most people wouldn't want to do when starting to use sane. However, all the APIs are the same (they run the same test suite) so it should be easy for clients of sane to programmatically select the mode (and programmatically install watchman as well) depending on the OS and node version. I wrote a section in the readme to help people decide https://github.com/amasad/sane#how-to-choose-a-mode

from sane.

matthewmueller avatar matthewmueller commented on May 24, 2024

Ahh gotcha. So fb-watchmen is just a client into the C program? Would it make sense / do you know of anyone already node-gyp'ing the C program?

I wrote a section in the readme to help people decide https://github.com/amasad/sane#how-to-choose-a-mode

Oops I missed that haha, thanks

from sane.

amasad avatar amasad commented on May 24, 2024

So fb-watchmen is just a client into the C program?

yes

Would it make sense / do you know of anyone already node-gyp'ing the C program?

I don't think anyone is working on it. We just added the "fb-watchman" client. Although it's designed to be a background daemon, I can't see why it wouldn't make sense to make it into an addont. If you're interested in that, open an issue https://github.com/facebook/watchman the folks running the project are very helpful in these things.

from sane.

stefanpenner avatar stefanpenner commented on May 24, 2024

I believe we can close this now. v0.12 is EOL, and watchman support is baked in

from sane.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.