From b3863014116aecc01e641788d33653053ff7da0d Mon Sep 17 00:00:00 2001 From: Filipp Riabchun Date: Sun, 22 Nov 2020 17:47:55 +0100 Subject: [PATCH] hack: use chokidar@2 only on node < 8 --- lib/forever-monitor/monitor.js | 1 - lib/forever-monitor/plugins/watch.js | 5 ++++- lib/forever-monitor/utils.js | 3 ++- lib/index.js | 2 +- package.json | 3 ++- 5 files changed, 9 insertions(+), 5 deletions(-) diff --git a/lib/forever-monitor/monitor.js b/lib/forever-monitor/monitor.js index 54a77d4..2077658 100755 --- a/lib/forever-monitor/monitor.js +++ b/lib/forever-monitor/monitor.js @@ -17,7 +17,6 @@ const plugins = require('./plugins'); const utils = require('./utils'); const util = require('util'); - // // ### function Monitor (script, options) // #### @script {string} Location of the target script to run. diff --git a/lib/forever-monitor/plugins/watch.js b/lib/forever-monitor/plugins/watch.js index e15e299..5828f93 100644 --- a/lib/forever-monitor/plugins/watch.js +++ b/lib/forever-monitor/plugins/watch.js @@ -9,7 +9,10 @@ const fs = require('fs'), path = require('path'), minimatch = require('minimatch'), - chokidar = require('chokidar'); + chokidar = + parseInt(process.versions.node) >= 8 + ? require('chokidar') + : require('@nicolo-ribaudo/chokidar-2'); exports.name = 'watch'; diff --git a/lib/forever-monitor/utils.js b/lib/forever-monitor/utils.js index 15abb75..d2b5076 100644 --- a/lib/forever-monitor/utils.js +++ b/lib/forever-monitor/utils.js @@ -7,7 +7,8 @@ // function randomString(length) { let rand, i, ret, bits; - const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_-'; + const chars = + 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_-'; const mod = 4; ret = ''; diff --git a/lib/index.js b/lib/index.js index 52c3cdb..b369658 100644 --- a/lib/index.js +++ b/lib/index.js @@ -6,7 +6,7 @@ * */ -const utils = require('./forever-monitor/utils') +const utils = require('./forever-monitor/utils'); const common = require('./forever-monitor/common'); exports.kill = common.kill; diff --git a/package.json b/package.json index 16b4710..179b68f 100644 --- a/package.json +++ b/package.json @@ -50,8 +50,9 @@ "tools" ], "dependencies": { + "@nicolo-ribaudo/chokidar-2": "^2.1.8", "async": "^1.5.2", - "chokidar": "^2.1.8", + "chokidar": "^3.4.3", "eventemitter2": "^6.4.3", "minimatch": "^3.0.4", "ps-tree": "^1.2.0"