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