From 5bab98b81c5f963ae12ca0325f7c637a65c633c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julia=20Kr=C3=BCger?= Date: Mon, 8 Jul 2019 13:07:43 +0200 Subject: [PATCH] fix(utils): ignore licence field if it is an object --- test/jobs/__snapshots__/create-version-branch.js.snap | 2 +- test/jobs/create-version-branch.js | 2 +- utils/utils.js | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/test/jobs/__snapshots__/create-version-branch.js.snap b/test/jobs/__snapshots__/create-version-branch.js.snap index 6f9d5428..a9343a41 100644 --- a/test/jobs/__snapshots__/create-version-branch.js.snap +++ b/test/jobs/__snapshots__/create-version-branch.js.snap @@ -102,7 +102,7 @@ This monorepo update includes releases of one or more dependencies which all bel --- **Publisher:** finn -**License:** MIT + [Find out more about this release](https://github.com/orgname/flowers). diff --git a/test/jobs/create-version-branch.js b/test/jobs/create-version-branch.js index 9d328fd4..47fd8b6f 100644 --- a/test/jobs/create-version-branch.js +++ b/test/jobs/create-version-branch.js @@ -2351,7 +2351,7 @@ describe('create version branch for dependencies from monorepos', () => { repository: { url: 'https://github.com/colors/monorepo' }, - 'license': 'MIT', + 'license': { 'preferred': 'MIT' }, '_npmUser': { name: 'finn', email: 'finn.pauls@gmail.com' diff --git a/utils/utils.js b/utils/utils.js index 1e680d2d..8aaca841 100644 --- a/utils/utils.js +++ b/utils/utils.js @@ -328,11 +328,11 @@ const getLicenseAndPublisherFromVersions = function ({ versions, version, oldVer const oldVersion = versions[oldVersionResolved] const publisher = _.get(newVersion, '_npmUser.name') let license, previousLicense, licenseHasChanged - if (_.has(newVersion, 'license')) { + if (_.has(newVersion, 'license') && typeof newVersion['license'] !== 'object') { license = newVersion['license'] || 'No license' // only compare if we have a license field for both versions in the DB - if (_.has(oldVersion, 'license')) { + if (_.has(oldVersion, 'license') && typeof oldVersion['license'] !== 'object') { previousLicense = oldVersion['license'] || 'No license' licenseHasChanged = previousLicense !== license }