build-lib.js 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. import path from 'path'
  2. import gulp from 'gulp'
  3. import * as utils from './build-utils'
  4. import getOutput from './get-output'
  5. const srcPath = `${getOutput()}/core`
  6. const buildPath = `${getOutput()}/lib`
  7. const files = utils.files
  8. const paths = {
  9. styles: {
  10. src: [`${srcPath}/**/*.less`],
  11. dest: buildPath,
  12. },
  13. scripts: {
  14. src: [`${srcPath}/**/*.js`],
  15. dest: buildPath,
  16. },
  17. colors: {
  18. src: [`${srcPath}/helpers/colors.js`],
  19. dest: buildPath,
  20. },
  21. copy: {
  22. src: [`${srcPath}*`],
  23. dest: buildPath,
  24. },
  25. }
  26. paths.styles.src = [
  27. `${srcPath}/styles/*.less`,
  28. ...files.map((v) => `${srcPath}/${v}/*.less`),
  29. ]
  30. paths.scripts.src = [
  31. ...['helpers', ...files].map((v) => `${srcPath}/${v}/**/*.js`),
  32. `${srcPath}/index.js`,
  33. ]
  34. paths.copy.src = [
  35. ...files.map((v) => `${srcPath}/${v}/**`),
  36. `!${srcPath}/**/*.less`,
  37. `!${srcPath}/icon/fonts/**`,
  38. `${srcPath}/helpers/**/*.wxs`,
  39. // `${srcPath}/index.js`,
  40. `${srcPath}/config.json`,
  41. ]
  42. export default gulp.series(
  43. gulp.parallel(
  44. utils.styles(paths.styles, srcPath, true),
  45. utils.copy(paths.copy, srcPath),
  46. // utils.generateFiles(buildPath, true),
  47. // utils.generateConfig(buildPath),
  48. ),
  49. utils.scripts(paths.scripts, srcPath),
  50. utils.generateColors(paths.colors, srcPath, true),
  51. )