Created
March 18, 2019 13:54
-
-
Save divyanshu013/3547297f58224ee34271490ac4fb5b6e to your computer and use it in GitHub Desktop.
Final generator with writing method added
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const Generator = require('yeoman-generator'); | |
module.exports = class extends Generator { | |
// ... | |
writing() { | |
this.log('Writing files... 📝'); | |
const { type, name } = this.answers; | |
if (type === 'screen') { | |
this.fs.copyTpl( | |
this.templatePath('component.js'), | |
this.destinationPath(`components/${name}.js`), | |
{ | |
name, | |
}, | |
); | |
} else { | |
this.fs.copyTpl( | |
this.templatePath('module.js'), | |
this.destinationPath(`modules/${name.toLowerCase()}.js`), | |
{ | |
name, | |
}, | |
); | |
} | |
} | |
// ... | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment