Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

What if Watchman CLI is missing... #2643

Closed
wants to merge 8 commits into from
Closed

Conversation

alunyov
Copy link
Contributor

@alunyov alunyov commented Feb 10, 2019

Here is an updated version of the GraphQLWatchmanClient.isAvailable. (as a fix for #2617)

Now, it's also checking if the watchman CLI is available.

Test plan (Tested with relay-examples:relay-publish-test (relayjs/relay-examples#89)

First of all, I've removed watchman from my machine.
Then,

  • Build the compiler
  • Install updated dependencies relay-examples (yarn)
  • Run the compiler (yarn build)

Compiled without errors.

}
} catch {
return resolve(false);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TIL about command ! ✨

How about using the exit status, though? (And made it async too, although it probably matters very little overall.)

const exec = require("util").promisify(require("child_process").exec)
undefined
> exec("command -v does-not-exist").then(() => console.log("Exists!")).catch(() => console.log("Does not exist!"))
Promise {  }
> Does not exist!
> exec("command -v ls").then(() => console.log("Exists!")).catch(() => console.log("Does not exist!"))
Promise {  }
> Exists!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just realized that this won't work on windows. I will add something else.

@alloy
Copy link
Contributor

alloy commented Feb 10, 2019

Can you clarify if using watchman without --watch is faster at yielding files than using fast-glob instead? (E.g. does watchman keep a live cached version of the results?)

The amount of faffing with ‘watch’ related options in the code is starting to confuse me a bit, so it would be nice if we could simplify that without a loss in performance.

@alunyov
Copy link
Contributor Author

alunyov commented Feb 11, 2019

I'm not sure about the performance differences between watchman and fast-glob. But I think at this point, it's fine to keep it as it is.

We've been working recently on the new relay compiler. It's ready, but still has a lot of dependencies on internal tools. And we still are using both versions - but I think once we complete the migration, we will replace an open source version too.

Copy link
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@alunyov has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@kassens kassens deleted the relay-compiler-no-watchman branch August 8, 2019 18:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants