From f0f0cf3710a4b4f6b1dd6799c33f0e4c97647b7e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=80=8C=CE=BB=E3=80=8Dxllily?= Date: Fri, 2 Jun 2023 16:25:37 +0800 Subject: [PATCH] fix: use deep merge strategy for context and options in Plugin (#1009) * fix: use deep merge strategy for context and options in Plugin (#997) Fixes #997 * fix: replace custom deep merge with lodash (#997) Fixes #997 --- lib/plugin/Plugin.js | 2 +- test/utils.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/plugin/Plugin.js b/lib/plugin/Plugin.js index 4fb667ae..64302534 100644 --- a/lib/plugin/Plugin.js +++ b/lib/plugin/Plugin.js @@ -40,7 +40,7 @@ class Plugin { afterRelease() {} getContext(path) { - const context = Object.assign({}, this.options, this.context); + const context = _.merge({}, this.options, this.context); return path ? _.get(context, path) : context; } diff --git a/test/utils.js b/test/utils.js index 8fc34b1a..89be6506 100644 --- a/test/utils.js +++ b/test/utils.js @@ -94,4 +94,4 @@ test('parseVersion', t => { t.deepEqual(parseVersion('1.0.0-0'), { version: '1.0.0-0', isPreRelease: true, preReleaseId: null }); t.deepEqual(parseVersion('1.0.0-next.1'), { version: '1.0.0-next.1', isPreRelease: true, preReleaseId: 'next' }); t.deepEqual(parseVersion('21.04.1'), { version: '21.04.1', isPreRelease: false, preReleaseId: null }); -}); +}); \ No newline at end of file