Fix control flow bug

This commit is contained in:
Radon Rosborough 2020-12-31 22:58:55 -08:00
parent 40b6bb4a53
commit b4c5cf2763
1 changed files with 4 additions and 4 deletions

View File

@ -137,22 +137,22 @@ async function main() {
program.option("--publish", "deploy newly built artifacts");
program.option("--all", "show also unchanged artifacts");
program.parse(process.argv);
const plan = await computePlan();
let plan = await computePlan();
const filteredPlan = plan.filter(
({ desired, local, remote }) => desired !== local || desired !== remote
);
console.log();
if (filteredPlan.length === 0) {
console.log(`*** NO CHANGES REQUIRED TO ${plan.length} ARTIFACTS ***`);
if (!program.all) {
plan = filteredPlan;
}
} else {
console.log(
`*** CHANGES REQUIRED TO ${filteredPlan.length} of ${plan.length} ARTIFACTS ***`
);
}
console.log();
if (!program.all) {
plan = filteredPlan;
}
if (plan.length === 0) {
process.exit(0);
}