Skip to content

Commit

Permalink
fix(init): refactored the init.ts success message (webpack#810)
Browse files Browse the repository at this point in the history
Previously there was multiple `stdout.write` due to the presence of conditional statements. In this PR I have scrapped those repeating lines into a single `process.stdout.write`

<!-- Thanks for submitting a pull request! Please provide enough information so that others can review your pull request. -->

**What kind of change does this PR introduce?**
Refactoring

**Did you add tests for your changes?**
No

**If relevant, did you update the documentation?**
Can't say

**Does this PR introduce a breaking change?**
Probably not
  • Loading branch information
pranshuchittora authored and misterdev committed Apr 23, 2019
1 parent b76cea1 commit 5c04702
Showing 1 changed file with 4 additions and 15 deletions.
19 changes: 4 additions & 15 deletions packages/init/init.ts
Expand Up @@ -78,21 +78,10 @@ export default function runTransform(webpackProperties: IWebpackProperties, acti
});
});

let successMessage: string = `Congratulations! Your new webpack configuration file has been created!`;
if (initActionNotDefined && webpackProperties.config.item) {
process.stdout.write(
"\n" +
chalk.green(
`Congratulations! ${
webpackProperties.config.item
} has been ${action}ed!\n`,
),
);
} else {
process.stdout.write(
"\n" +
chalk.green(
"Congratulations! Your new webpack configuration file has been created!\n",
),
);
successMessage = `Congratulations! ${webpackProperties.config.item} has been ${action}ed!`;

}
process.stdout.write("\n" + chalk.green(`${successMessage}\n`));
}

0 comments on commit 5c04702

Please sign in to comment.