main.js 618 B

123456789101112131415161718192021222324
  1. const util = require('util');
  2. const child_process = require('child_process');
  3. const exec = util.promisify(child_process.exec);
  4. const fs = require('fs-extra')
  5. const path = require('path')
  6. const PATH = `./.laser-lib-path`
  7. const buildPaths = [
  8. `build`,
  9. ...fs.existsSync(PATH) ? [fs.readFileSync(PATH).toString()] : []
  10. ]
  11. buildPaths.forEach(d => {
  12. const potreeDir = path.resolve(__dirname, d, 'potree')
  13. const shadersDir = path.resolve(__dirname, d, 'shaders')
  14. if (fs.existsSync(potreeDir)) {
  15. fs.emptyDirSync(potreeDir)
  16. }
  17. if (fs.existsSync(shadersDir)) {
  18. fs.emptyDirSync(shadersDir)
  19. }
  20. })
  21. exec(`yarn build-c`);