From 3cb336be6740f10b93b550216ac490c6643868ca Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 10 Nov 2020 18:09:02 +0100 Subject: [PATCH] [Backport 7.x] Add warning log about nodejs version support (#1350) Co-authored-by: Tomas Della Vedova --- index.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/index.js b/index.js index d575bc2d8..c3c278efc 100644 --- a/index.js +++ b/index.js @@ -41,6 +41,24 @@ const kEventEmitter = Symbol('elasticsearchjs-event-emitter') const ESAPI = require('./api') +/* istanbul ignore next */ +if (nodeMajor < 10) { + process.emitWarning('You are using a version of Node.js that is currently in EOL. ' + + 'The support for this version will be dropped in 7.12. ' + + 'Please refer to https://ela.st/nodejs-support for additional information.', + 'DeprecationWarning' + ) +} + +/* istanbul ignore next */ +if (nodeMajor >= 10 && nodeMajor < 12) { + process.emitWarning('You are using a version of Node.js that will reach EOL in April 2021. ' + + 'The support for this version will be dropped in 7.13. ' + + 'Please refer to https://ela.st/nodejs-support for additional information.', + 'DeprecationWarning' + ) +} + class Client extends ESAPI { constructor (opts = {}) { super({ ConfigurationError })