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.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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. let outoutDir = path.resolve(__dirname, '..', 'packages/sdk/dist')
  12. fse.ensureDirSync(outoutDir)
  13. fse.emptyDirSync(outoutDir)
  14. const pkgs = ['base', 'core', 'chart', 'mapv', 's3m']
  15. const count = pkgs.length
  16. pkgs.forEach((item, index) => {
  17. fse.exists(
  18. path.resolve(__dirname, '..', `packages/${item}/dist`),
  19. async exists => {
  20. if (exists) {
  21. fse.copySync(
  22. path.resolve(__dirname, '..', `packages/${item}/dist`),
  23. outoutDir
  24. )
  25. shell.echo(chalk.yellow(`copy ${item} success`))
  26. if (index === count - 1) {
  27. await shell.echo(chalk.green('build sdk end'))
  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. }
  34. }
  35. }
  36. )
  37. })