Comments (7)
Landed here looking for the same thing. Documentation is good, and a variety of usage examples would be very helpful.
from watchman.
Yep agree with the above. A couple of solid, common CLI examples at the top of the README would go a long way.
from watchman.
Take a look at https://algorithms.rdio.com/post/make/ for an example.
For your use case, I'd probably do something like this, which runs make
whenever any file in the jsx
folder is changed, or any .css
file in the sass
is changed (note: changed also includes created or deleted):
watchman -j <<-EOT
["trigger", "/path/to/root", {
"name": "assets",
"expression": ["anyof",
["match", "jsx/*", "wholename"],
["match", "sass/*.css", "wholename"]
],
"command": ["make"]
}]
EOT
Watchman doesn't know anything about building anything; it knows when things change and how to trigger a command when that happens. This means that it is up to you to fill in the logic for building stuff.
Watchman is a little different from most other watching utilities because it is optimized for machines and not really for humans; the output of your triggered commands lands in a log file and not in your terminal.
from watchman.
Looks like the examples situation still hasn't improved. I'm trying to figure out how to access the names of files that triggered a command in said command. Seems simple enough.
from watchman.
Thank you very much for the examples. I was some how missing how these commands were issued to watchman. I'm guessing I could put that JSON in to a file and pass the filename to watchman as an argument?
Just this basic example has made the rest of the documentation in the README make complete sense! Thanks again :)
from watchman.
You can either type the command as I pasted it above, or put the json in a file named, say, trigger.json
and then run watchman -j < trigger.json
.
The example I pasted was slightly modified from one that was actually in the README. Is there a specific spot in the README where you started to feel lost/tuned out? We should probably juggle things around a bit to make the docs more accessible, and your feedback on this would help us do that.
from watchman.
Thanks again!
I think the main issue is with the "legacy" command line stuff that is mixed in with the newer, JSON commands. I haven't really made a connection on how the two are related.
If there were just 3-4 common use examples it would help out a lot. It would be nice if each example showed both the CLI version as well as the JSON version. Personally, I'd rather use the CLI version so I don't have to hardcode or fiddle around with absolute paths in a block of JSON.
I still haven't figured out how to translate your above example to CLI or to use relative paths in the JSON... I could write a script to generate the absolute path in the JSON, but I've shaved enough yaks for the day. 😄
And put something about watchman -j < trigger.json
in there as well, that is pretty helpful! I know that is a shell command but when I'm using a new tool for the first time it can be hard to shift gears.
from watchman.
Related Issues (20)
- watchman on riscv
- why watchman does not support query base on time frame and sorting ability?
- Impossible to install on Amazonlinux HOT 2
- Folly related build issue for ARM Ubuntu 18.04.5 LTS
- Missing RPMs in Release v2023.04.24.00
- WatchMan Error on Docker. Watchman-make is not accessible even after installation.
- "Settle" behavior blocks entire file tree during long running zip operation
- Unable to compile with fmt 10.0.0
- Unable to talk to your watchman on /opt/homebrew/var/run/watchman/[user]-state/sock! HOT 8
- serde_bser: Apache-2.0 license file missing from git repo and published crates HOT 1
- No Mac OS X binary
- Watchman ignores platform-specific path separators in `dirname` expressions
- Watchman root is set to /Users/<username> despite being run from a different directory HOT 1
- Ubuntu packags missing since May HOT 3
- "I don't know how to install any packages on this system linux-mint-21.2"
- Watchman warns on custom_config example line
- Installation guide HOT 2
- Question - `hint_num_files_per_dir` recursive or not?
- Watchman service is timing out waiting for a synchronization cookie file to be observed by the watcher within 20000 milliseconds HOT 3
- Deploy on winget
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from watchman.