diff --git a/install.js b/install.js new file mode 100644 index 0000000..9d81e6b --- /dev/null +++ b/install.js @@ -0,0 +1,13 @@ +const { spawn } = require('child_process'); + +const rebuildIfDarwin = () => { + if (process.platform !== 'darwin') { + console.log(); + console.log(`Skipping 'fsevents' build as platform ${process.platform} is not supported`); + process.exit(0); + } else { + spawn('node-gyp', ['rebuild'], { stdio: 'inherit' }); + } +}; + +rebuildIfDarwin(); diff --git a/package.json b/package.json index 0672e1b..5384ca6 100644 --- a/package.json +++ b/package.json @@ -15,7 +15,8 @@ "node": ">= 4.0" }, "scripts": { - "test": "node ./test/fsevents.js && node ./test/function.js 2> /dev/null" + "test": "node ./test/fsevents.js && node ./test/function.js 2> /dev/null", + "install": "node install.js" }, "repository": { "type": "git",