plopfile.js 593 B

12345678910111213141516171819202122232425
  1. export default plop => {
  2. plop.setGenerator('domain', {
  3. description: '生成一个领域',
  4. prompts: [
  5. {
  6. type: 'input',
  7. name: 'name',
  8. message: 'domain name: '
  9. }
  10. ],
  11. actions: [
  12. {
  13. type: 'add',
  14. path: 'src/domain/{{name}}/api.ts',
  15. templateFile: 'plop-template/api.hbs'
  16. },
  17. {
  18. type: 'add',
  19. path: 'src/domain/{{name}}/service.ts',
  20. templateFile: 'plop-template/service.hbs'
  21. }
  22. ]
  23. })
  24. plop.setHelper('upperCase', string => string.charAt(0).toUpperCase() + string.slice(1))
  25. }