Skip to content

Commit

Permalink
refactor(cli): extract helper logClassCreation
Browse files Browse the repository at this point in the history
Signed-off-by: Miroslav Bajtoš <[email protected]>
  • Loading branch information
bajtos committed Sep 23, 2019
1 parent 6cce047 commit 1dc05cc
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
9 changes: 1 addition & 8 deletions packages/cli/lib/artifact-generator.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,14 +79,7 @@ module.exports = class ArtifactGenerator extends BaseGenerator {
* >> Model MyModel will be created in src/models/my-model.model.ts
**/
promptClassFileName(type, typePlural, name) {
this.log(
`${utils.toClassName(type)} ${chalk.yellow(
name,
)} will be created in src/${typePlural}/${chalk.yellow(
utils.toFileName(name) + '.' + `${type}.ts`,
)}`,
);
this.log();
utils.logClassCreation(type, typePlural, name, this.log.bind(this));
}

scaffold() {
Expand Down
11 changes: 11 additions & 0 deletions packages/cli/lib/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,17 @@ exports.logNamingIssues = function(name, log) {
}
};

exports.logClassCreation = function(type, typePlural, name, log) {
log(
`${exports.toClassName(type)} ${chalk.yellow(
name,
)} will be created in src/${typePlural}/${chalk.yellow(
exports.toFileName(name) + '.' + `${type}.ts`,
)}`,
);
log();
};

/**
* Validate project directory to not exist
*/
Expand Down

0 comments on commit 1dc05cc

Please sign in to comment.