前端转vue
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

index.ts 791B

123456789101112131415161718192021
  1. import { moduleTypes } from './type'
  2. import { copyFolder, log, templatePath, disPath, deleteFolder, modifyIndexVue, firstLetterUpperCase } from './utils'
  3. function run() {
  4. const argv = require('minimist')(process.argv.slice(2));
  5. const { type, moduleName } = argv
  6. if (!moduleName) {
  7. log.error('请输入组件/页面名称!')
  8. return false
  9. }
  10. copyFolder(templatePath, disPath(type + '/' + firstLetterUpperCase(moduleName)))
  11. // 修改index.vue的class名称为组件名称
  12. setTimeout(() => modifyIndexVue(type, moduleName), 300)
  13. if (type === moduleTypes.component) {
  14. // components文件夹不需要再复制components文件夹了
  15. setTimeout(() => deleteFolder(disPath('components/' + moduleName + '/components')), 300)
  16. }
  17. log.success('复制完成!')
  18. }
  19. run()