# watch-detector

> [![Build Status](https://travis-ci.org/chrmod/watch-detector.svg?branch=master)](https://travis-ci.org/chrmod/watch-detector)

Latest version **1.0.3** (published 2026-08-20) · MIT license · 0 weekly downloads

## Install

```sh
npm install watch-detector
pnpm add watch-detector
yarn add watch-detector
bun add watch-detector
```

## Health

**Score 60/100 (C)** — status: active.

Positive: no vulnerabilities; has provenance; recently updated; high maintenance score.

Warnings: low downloads; no types; no esm support.

## Facts

| | |
|---|---|
| Version | 1.0.3 |
| Published | 2026-08-20 |
| First published | 2017-12-11 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >= 8 |
| Dependencies | 3 |
| Unpacked size | 10 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 0 |
| Maintainers | real_ate, kellyselden, rwjblue, katiegengler, turbo87, stefanpenner |

## Links

- npm: https://www.npmjs.com/package/watch-detector
- Repository: https://github.com/ember-cli/watch-detector
- Homepage: https://github.com/ember-cli/watch-detector#readme
- Issues: https://github.com/ember-cli/watch-detector/issues
- npm.io page: https://npm.io/package/watch-detector

## Dependencies (3)

- [tmp](https://npm.io/package/tmp.md) ^0.2.5
- [silent-error](https://npm.io/package/silent-error.md) ^1.1.1
- [heimdalljs-logger](https://npm.io/package/heimdalljs-logger.md) ^0.1.10

## Recent versions

- 1.0.3 (latest) — 2026-08-20
- 1.0.2 — 2022-07-28
- 1.0.1 — 2021-06-07
- 1.0.0 — 2019-09-07
- 0.1.0 — 2017-12-11

## README

# watch-detector
[![Build Status](https://travis-ci.org/chrmod/watch-detector.svg?branch=master)](https://travis-ci.org/chrmod/watch-detector)

Utility for selecting the best options for  `sane`:

watcher options:

* `watchman`: if a valid version of watchman is installed, we will prefer this.
* `node`: use node's built in watcher, if watchman is not present.


future options:

* `fs-events`: https://github.com/chrmod/watch-detector/issues/6


## usage

```sh
yarn add watch-detector
```

```js
const WatchDetector = require('watch-detector');
const sane = require('sane');

let detector = new WatchDetector();
let saneOptions = {
  /* sane options */
};

let options = detector.findBestWatcherOption(saneOptions)
/* options's watcher selection will be based on various heuristics */
sane(root, options);
```


## optional

```js
new WatchDetector({
  ui: /* console-ui instance */,
  fs: /* fs instance */
});
```

---
_Source: https://npm.io/package/watch-detector · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
