Skip to content

Commit

Permalink
preventFileFromLogging
Browse files Browse the repository at this point in the history
  • Loading branch information
JuanM04 committed Mar 26, 2021
1 parent 80743a6 commit c43a6be
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
17 changes: 14 additions & 3 deletions packages/generator/src/generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,11 @@ export abstract class Generator<
// expose postWrite hook, no default implementation
}

preventFileFromLogging(_file: string): boolean {
// no default implementation
return false
}

sourcePath(...paths: string[]): string {
return path.join(this.sourceRoot, ...paths)
}
Expand Down Expand Up @@ -316,9 +321,15 @@ export abstract class Generator<
}

if (!this.returnResults) {
this.performedActions.sort().forEach((action) => {
console.log(action)
})
this.performedActions
.sort()
.filter((action) => {
// Each action is something like this:
// "\u001b[32mCREATE \u001b[39m .env"
const filename = action.split(/ +/, 3)[2]
return !this.preventFileFromLogging(filename)
})
.forEach((action) => console.log(action))
}

if (!this.options.dryRun) {
Expand Down
4 changes: 4 additions & 0 deletions packages/generator/src/generators/app-generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,10 @@ export class AppGenerator extends Generator<AppGeneratorOptions> {
}
}

preventFileFromLogging(file: string): boolean {
return file.startsWith(".vscode") || file === ".editorconfig" || file.endsWith("/.keep")
}

commitChanges() {
const commitSpinner = log.spinner(log.withBrand("Committing your app")).start()
const commands: Array<[string, string[], object]> = [
Expand Down

0 comments on commit c43a6be

Please sign in to comment.