-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(plop): add option to use custom templates #59
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for adding this. Since this doesn't change the kinds of templates supported, I'm assuming this is for cases where you, for example, would like to have ts or flow templates?
Are the existing templates up-to-date? 😀
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Super nice feature! Thank you for adding this! :)
@felixjung You're right, it doesn't change the supported templates or prompt. I think this would be much harder to customize because Foundry's plop config contains a lot of custom code. You'd probably be better off adding a custom generator: const configFn = require('@sumup/foundry/plop').react;
module.exports = plop => {
plop.setGenerator('Vue', {
description: 'Generate a new Vue component',
prompts: [], // array of inquirer prompts
actions: [] // array of actions
});
return configFn(plop);
}; I'll add some documentation about this in a follow-up PR. Regarding the support for TypeScript, const configFn = require('@sumup/foundry/plop').react;
const opts = {
language: 'TypeScript' | 'JavaScript'
}
module.exports = plop => configFn(plop, opts); My motivation for this change was, in fact, to use custom Flow templates on the partner portal. Flow works with the Edit: I've added an option to customize the template extension. |
79b071a
to
8139d98
Compare
🎉 This PR is included in version 1.7.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Purpose
I've worked on several projects where the default templates didn't match the custom project setup.
Approach & changes
opts
parameter to the Plop config filetemplateDir
andtemplateExtension
optionsPlop will first check for a custom template and fall back to the default template. This makes it easy to override just one or some of the templates.