diff --git a/tools/update-changelog.js b/tools/update-changelog.js index a7c16dcd9..a9b943d1a 100644 --- a/tools/update-changelog.js +++ b/tools/update-changelog.js @@ -18,6 +18,7 @@ const Promise = require("bluebird"); const semver = require("semver"); xsh.Promise = Promise; xsh.envPath.addToFront(Path.join(__dirname, "../node_modules/.bin")); +const _ = require("lodash"); const changeLogFile = Path.resolve("CHANGELOG.md"); const changeLog = Fs.readFileSync(changeLogFile).toString(); @@ -29,6 +30,17 @@ const packageMapping = { "electrode-archetype-react-component-dev": "electrode-archetype-react-component[-dev]" }; +const reverseMapping = Object.assign.apply( + undefined, + _(packageMapping) + .values() + .uniq() + .map(mapped => { + return { [mapped]: _.keys(_.pickBy(packageMapping, v => v === mapped)) }; + }) + .value() +); + const mapPkg = n => { return packageMapping[n] || n; }; @@ -138,6 +150,15 @@ const collateCommitsPackages = commits => { collated.lernaPackages = commits.updated.packages.filter( r => collated.realPackages.indexOf(r) < 0 ); + const updateByMap = _(collated.realPackages) + .map(p => packageMapping[p]) + .filter() + .map(p => { + return reverseMapping[p] || undefined; + }) + .flatMap() + .value(); + collated.realPackages = _.uniq(collated.realPackages.concat(updateByMap)); collated.forcePackages = collated.realPackages.filter( r => commits.updated.packages.indexOf(r) < 0 );