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.

build.js 1.1KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. /**
  2. * @Author: Caven
  3. * @Date: 2021-03-15 20:59:10
  4. */
  5. 'use strict'
  6. const fse = require('fs-extra')
  7. const path = require('path')
  8. const shell = require('shelljs')
  9. const chalk = require('chalk')
  10. shell.echo(chalk.green('build sdk start'))
  11. shell.rm('-rf', path.resolve(__dirname, '..', 'packages/sdk/dist/*'))
  12. const pkgs = ['base', 'core', 'chart', 'mapv']
  13. const count = pkgs.length
  14. pkgs.forEach(async (item, index) => {
  15. await fse.exists(
  16. path.resolve(__dirname, '..', `packages/${item}/dist`),
  17. exists => {
  18. if (exists) {
  19. shell.cp(
  20. '-R',
  21. path.resolve(__dirname, '..', `packages/${item}/dist/*`),
  22. path.resolve(__dirname, '..', 'packages/sdk/dist')
  23. )
  24. shell.echo(chalk.yellow(`copy ${item} success`))
  25. if (index === count - 1) {
  26. shell.echo(chalk.green('build sdk end'))
  27. shell.exit(0)
  28. }
  29. } else {
  30. shell.echo(chalk.red(`no ${item} dist`))
  31. if (index === count - 1) {
  32. shell.echo(chalk.green('build sdk end'))
  33. shell.exit(0)
  34. }
  35. }
  36. }
  37. )
  38. })