Skip to content

Instantly share code, notes, and snippets.

@iksena
Last active January 10, 2021 19:47
Show Gist options
  • Save iksena/d9624a75d02ec5b274d4707d0c9c6e8c to your computer and use it in GitHub Desktop.
Save iksena/d9624a75d02ec5b274d4707d0c9c6e8c to your computer and use it in GitHub Desktop.
Configuring tasks for ms generator
const Generator = require('yeoman-generator');
class MicroserviceGenerator extends Generator {
// ... other methods
configuring() {
// creating new variables
const { name } = this.options;
const title = `ms-${name.toLowerCase()}`; // will output as "ms-example"
// combining user data
this.answers = {
...this.config.getAll(), // getting saved config data
...this.answers,
name,
title,
};
// saving to config file
this.config.set(this.answers);
}
}
module.exports = MicroserviceGenerator
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment