refactor: Ensure that options are copied in Serverless constructor

This commit is contained in:
Piotr Grzesik 2021-04-28 15:27:17 +02:00
parent d81730c219
commit fd97e877ce

View File

@ -87,7 +87,10 @@ class Serverless {
this._shouldReportMissingServiceDeprecation = true;
}
const commands = ensureArray(configObject.commands, { isOptional: true });
const options = ensurePlainObject(configObject.options, { isOptional: true });
let options = ensurePlainObject(configObject.options, { isOptional: true });
// This is a temporary workaround to ensure that original `options` are not mutated
// Should be removed after addressing: https://github.com/serverless/serverless/issues/2582
if (options) options = { ...options };
if (!commands || !options) {
this._shouldReportCommandsDeprecation = true;
this.processedInput = resolveCliInput();