Skip to content

Instantly share code, notes, and snippets.

@iksena
Created January 15, 2021 20:08
Show Gist options
  • Save iksena/424b8ef3bb29f003fc5ef3681df14c29 to your computer and use it in GitHub Desktop.
Save iksena/424b8ef3bb29f003fc5ef3681df14c29 to your computer and use it in GitHub Desktop.
yo microservice writing
const Generator = require('yeoman-generator');
class MicroserviceGenerator extends Generator {
// ...other tasks
writing() {
const templates = [
'.dockerignore',
'.env',
'.eslintrc.yml',
'Dockerfile',
'package.json',
'tsconfig.json',
'tslint.json',
'config/index.ts',
'src/index.ts',
'src/routes/index.ts',
];
templates.forEach((filePath) => {
this.fs.copyTpl(
this.templatePath(filePath),
this.destinationPath(filePath),
this.answers,
);
});
}
}
module.exports = MicroserviceGenerator
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment