Skip to content

Commit

Permalink
feat: display generator description
Browse files Browse the repository at this point in the history
  • Loading branch information
egoist committed Jan 9, 2019
1 parent 17a703b commit b129bfc
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
6 changes: 6 additions & 0 deletions docs/config.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Config

## config.description

- Type: `string`

Generator description.

## config.prompts

- Type: `Array<Prompt> | (this: Generator) => Array<Prompt>`
Expand Down
4 changes: 4 additions & 0 deletions lib/Generator.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,10 @@ module.exports = class Generator {

const config = validateConfig(this.config, opts.extendConfigSchema)

if (config.description) {
logger.status('green', 'Generator', config.description)
}

if (config.prepare) {
await config.prepare.call(this, this)
}
Expand Down
1 change: 1 addition & 0 deletions lib/validateConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ const KopyError = require('./KopyError')
module.exports = (config, extendConfigSchema) => {
// TODO: improve prompts and actions validation
const schema = {
description: struct.optional('string'),
prepare: struct.optional('function'),
prompts: struct.optional(struct.union(['array', 'function'])),
actions: struct.optional(struct.union(['array', 'function'])),
Expand Down

0 comments on commit b129bfc

Please sign in to comment.