pre-publish.js 894 B

1234567891011121314151617181920212223242526272829303132
  1. /**
  2. * Compatible with prevoius folder structure: `zrender/lib` exists in `node_modules`
  3. */
  4. const path = require('path');
  5. const fsExtra = require('fs-extra');
  6. const {color, travelSrcDir, prePulishSrc} = require('./helper');
  7. const ecDir = path.resolve(__dirname, '..');
  8. const srcDir = path.resolve(__dirname, '../src');
  9. const libDir = path.resolve(__dirname, '../lib');
  10. module.exports = function () {
  11. fsExtra.removeSync(libDir);
  12. fsExtra.ensureDirSync(libDir);
  13. travelSrcDir(srcDir, ({fileName, relativePath, absolutePath}) => {
  14. prePulishSrc({
  15. inputPath: absolutePath,
  16. outputPath: path.resolve(libDir, relativePath, fileName)
  17. });
  18. });
  19. prePulishSrc({
  20. inputPath: path.resolve(ecDir, 'zrender.all.js'),
  21. outputPath: path.resolve(ecDir, 'index.js')
  22. });
  23. console.log(color('fgGreen', 'bright')('All done.'));
  24. };