diff --git a/docs/README.md b/docs/README.md index 0cf2a16..3a5f2e5 100644 --- a/docs/README.md +++ b/docs/README.md @@ -14,6 +14,7 @@ yarn add kopy const kopy = require('kopy') const config = { + // Ask some questions! prompts() { return [ { @@ -23,10 +24,13 @@ const config = { } ] }, + // Manipulate files with ease! actions() { return [ + // Copy files from `templates` directory to output directory { type: 'copy', + // One or more glob patterns files: '**', cwd: '/path/to/templates', // When specified, transform the files with `ejs` @@ -34,8 +38,11 @@ const config = { } ] }, + // When we're done :) completed() { - console.log('Done!') + this.logger.success(`Generated into ${this.colors.underline(this.outDir)}`) + // Or simply: + // this.showSuccessTips() } } @@ -56,6 +63,7 @@ const kopy = require('kopy') test('it works', async () => { const generator = kopy(config) const result = await generator.test({ + // Prompt answers name: 'kevin' }) expect(result.fileList).toContain('index.js') diff --git a/example/saofile.js b/example/saofile.js index 5f334c2..cfcce4e 100644 --- a/example/saofile.js +++ b/example/saofile.js @@ -37,6 +37,6 @@ module.exports = { async completed() { await this.npmInstall() await this.gitInit({ commit: true }) - this.logger.success('Done!') + this.showSuccessTips() } } diff --git a/lib/Generator.js b/lib/Generator.js index 8938380..6178196 100644 --- a/lib/Generator.js +++ b/lib/Generator.js @@ -145,7 +145,7 @@ module.exports = class Generator { return fs.readFileSync(path.join(this.outDir, file), 'utf8') } - showProjectTips() { + showSuccessTips() { spinner.stop() // Stop when necessary logger.success(`Generated into ${this.colors.underline(this.outDir)}`) }