optimize-include.ts 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. // const fs = require('fs')
  2. // const files = fs.readdirSync(
  3. // 'D:\\github\\vue3-admin-ts\\node_modules\\.pnpm\\element-plus@2.2.9_vue@3.2.37\\node_modules\\element-plus\\es\\components\\'
  4. // )
  5. // console.log(111, JSON.stringify(files))
  6. // console.log(console.dir(files))
  7. // console.log(console.dir(files.slice(20)))
  8. import { resolve } from 'path'
  9. const elementPlusComponentNameArr = [
  10. 'affix',
  11. 'alert',
  12. 'aside',
  13. 'autocomplete',
  14. 'avatar',
  15. 'backtop',
  16. 'badge',
  17. 'base',
  18. 'breadcrumb',
  19. 'breadcrumb-item',
  20. 'button',
  21. 'button-group',
  22. 'calendar',
  23. 'card',
  24. 'carousel',
  25. 'carousel-item',
  26. 'cascader',
  27. 'cascader-panel',
  28. 'check-tag',
  29. 'checkbox',
  30. 'checkbox-button',
  31. 'checkbox-group',
  32. 'col',
  33. 'collapse',
  34. 'collapse-item',
  35. 'collapse-transition',
  36. 'color-picker',
  37. 'config-provider',
  38. 'container',
  39. 'date-picker',
  40. 'descriptions',
  41. 'descriptions-item',
  42. 'dialog',
  43. 'divider',
  44. 'drawer',
  45. 'dropdown',
  46. 'dropdown-item',
  47. 'dropdown-menu',
  48. 'empty',
  49. 'footer',
  50. 'form',
  51. 'form-item',
  52. 'header',
  53. 'icon',
  54. 'image',
  55. 'image-viewer',
  56. 'infinite-scroll',
  57. 'input',
  58. 'input-number',
  59. 'link',
  60. 'loading',
  61. 'main',
  62. 'menu',
  63. 'menu-item',
  64. 'menu-item-group',
  65. 'message',
  66. 'message-box',
  67. 'notification',
  68. 'option',
  69. 'option-group',
  70. 'overlay',
  71. 'page-header',
  72. 'pagination',
  73. 'popconfirm',
  74. 'popover',
  75. 'popper',
  76. 'progress',
  77. 'radio',
  78. 'radio-button',
  79. 'radio-group',
  80. 'rate',
  81. 'result',
  82. 'row',
  83. 'scrollbar',
  84. 'select',
  85. 'select-v2',
  86. 'skeleton',
  87. 'skeleton-item',
  88. 'slider',
  89. 'space',
  90. 'step',
  91. 'steps',
  92. 'sub-menu',
  93. 'switch',
  94. 'tab-pane',
  95. 'table',
  96. 'table-column',
  97. 'table-v2',
  98. 'tabs',
  99. 'tag',
  100. 'teleport',
  101. 'time-picker',
  102. 'time-select',
  103. 'timeline',
  104. 'timeline-item',
  105. 'tooltip',
  106. 'transfer',
  107. 'tree',
  108. 'tree-select',
  109. 'tree-v2',
  110. 'upload',
  111. 'virtual-list'
  112. ]
  113. export const pkgPath = resolve(__dirname, './package.json')
  114. // eslint-disable-next-line @typescript-eslint/no-var-requires
  115. let { dependencies } = require(pkgPath)
  116. dependencies = Object.keys(dependencies).filter((dep) => !dep.startsWith('@types/'))
  117. const EPDepsArr = () => {
  118. const depsArr = [] as string[]
  119. elementPlusComponentNameArr.forEach((feItem) => {
  120. depsArr.push(`element-plus/es/components/${feItem}/style/index`)
  121. })
  122. return depsArr
  123. }
  124. export const optimizeElementPlus = EPDepsArr()
  125. export const optimizeDependencies = dependencies
  126. export default []