Skip to content

Commit

Permalink
include packages updated by mapping
Browse files Browse the repository at this point in the history
  • Loading branch information
jchip committed Oct 20, 2017
1 parent 8b3313b commit 448c33e
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions tools/update-changelog.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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;
};
Expand Down Expand Up @@ -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
);
Expand Down

0 comments on commit 448c33e

Please sign in to comment.