Skip to content

Commit

Permalink
fix(utils): ignore licence field if it is an object
Browse files Browse the repository at this point in the history
  • Loading branch information
Realtin committed Jul 8, 2019
1 parent 95c8d34 commit 5bab98b
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion test/jobs/__snapshots__/create-version-branch.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand Down
2 changes: 1 addition & 1 deletion test/jobs/create-version-branch.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: '[email protected]'
Expand Down
4 changes: 2 additions & 2 deletions utils/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit 5bab98b

Please sign in to comment.