Skip to content

Commit

Permalink
remove fsevents (#130)
Browse files Browse the repository at this point in the history
* remove fsevents

* set circle's node version to one we actually support
  • Loading branch information
stefanpenner authored Sep 26, 2018
1 parent dedc549 commit b4c4f03
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 132 deletions.
5 changes: 5 additions & 0 deletions circle.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
machine:
node:
version: 6.9.5
npm:
version: 3.10.10
dependencies:
pre:
- git clone https://github.com/facebook/watchman.git && cd watchman && git checkout v4.7.0 && ./autogen.sh && ./configure && make && sudo make install
14 changes: 11 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ const NodeWatcher = require('./src/node_watcher');
const PollWatcher = require('./src/poll_watcher');
const WatchmanWatcher = require('./src/watchman_watcher');
const WatchexecWatcher = require('./src/watchexec_watcher');
const FSEventsWatcher = require('./src/fsevents_watcher');

function throwNoFSEventsSupports() {
throw new Error('Sane >= 4 no longer support the fsevents module.');
}

function sane(dir, options) {
options = options || {};
Expand All @@ -18,7 +21,7 @@ function sane(dir, options) {
} else if (options.watchexec) {
return new WatchexecWatcher(dir, options);
} else if (options.fsevents) {
return new FSEventsWatcher(dir, options);
throwNoFSEventsSupports();
} else {
return new NodeWatcher(dir, options);
}
Expand All @@ -29,4 +32,9 @@ sane.NodeWatcher = NodeWatcher;
sane.PollWatcher = PollWatcher;
sane.WatchmanWatcher = WatchmanWatcher;
sane.WatchexecWatcher = WatchexecWatcher;
sane.FSEventsWatcher = FSEventsWatcher;

Object.defineProperty(sane, 'FSEventsWatcher', {
get() {
throwNoFSEventsSupports();
},
});
122 changes: 0 additions & 122 deletions src/fsevents_watcher.js

This file was deleted.

12 changes: 5 additions & 7 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ var rimraf = require('rimraf');
var path = require('path');
var assert = require('assert');
var tmp = require('tmp');
var os = require('os');

tmp.setGracefulCleanup();
var jo = path.join.bind(path);
Expand All @@ -19,11 +18,12 @@ describe('sane in node mode', function() {
harness.call(this, {});
});

if (os.platform() === 'darwin') {
describe('sane in fsevents mode', function() {
harness.call(this, { fsevents: true });
describe('sane in fsevents mode', function() {
it('errors in a helpful manner', function() {
assert.throws(() => sane.FSEventsWatcher, 'asdf');
assert.throws(() => sane('/dev/null', { fsevents: true }), 'asdf');
});
}
});

describe('sane in watchman mode', function() {
harness.call(this, { watchman: true });
Expand All @@ -43,8 +43,6 @@ function getWatcherClass(mode) {
return sane.WatchexecWatcher;
} else if (mode.poll) {
return sane.PollWatcher;
} else if (mode.fsevents) {
return sane.FSEventsWatcher;
} else {
return sane.NodeWatcher;
}
Expand Down

0 comments on commit b4c4f03

Please sign in to comment.