From 1477fdbd020c40bbfda08ed7182e11eb5fee4803 Mon Sep 17 00:00:00 2001 From: George Fu Date: Sat, 11 Feb 2023 14:58:02 -0500 Subject: [PATCH] chore: add maintenance mode message (#4345) * chore: add maintenance mode message * chore: update require location of maintenance mode message --- lib/core.js | 1 + lib/maintenance_mode_message.js | 31 +++++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 lib/maintenance_mode_message.js diff --git a/lib/core.js b/lib/core.js index 6232daf102..1ad1287106 100644 --- a/lib/core.js +++ b/lib/core.js @@ -85,6 +85,7 @@ require('./response'); require('./resource_waiter'); require('./signers/request_signer'); require('./param_validator'); +require('./maintenance_mode_message'); /** * @readonly diff --git a/lib/maintenance_mode_message.js b/lib/maintenance_mode_message.js new file mode 100644 index 0000000000..54ecce5283 --- /dev/null +++ b/lib/maintenance_mode_message.js @@ -0,0 +1,31 @@ +var warning = [ + 'The AWS SDK for JavaScript (v2) will be put into maintenance mode in 2023.\n', + 'Please migrate your code to use AWS SDK for JavaScript (v3).', + 'For more information, check the migration guide at https://a.co/7PzMCcy' +].join('\n'); + +module.exports = { + suppress: false +}; + +/** + * To suppress this message: + * @example + * require('aws-sdk/lib/maintenance_mode_message').suppress = true; + */ +function emitWarning() { + if ( + typeof process !== 'undefined' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning(warning, { + type: 'NOTE' + }); + } +} + +setTimeout(function () { + if (!module.exports.suppress) { + emitWarning(); + } +}, 0);