build.js 570 B

12345678910111213141516171819202122
  1. var fs = require('fs');
  2. switch(process.argv[2]) {
  3. case 'updateVersion':
  4. updateVersion();
  5. break;
  6. default:
  7. throw "Invalid type argument";
  8. }
  9. /**
  10. * Updates the plugin version in the dist files
  11. */
  12. function updateVersion() {
  13. var v = require('./package.json').version;
  14. var distFiles = ['dist/jspdf.plugin.autotable.js', 'dist/jspdf.plugin.autotable.src.js'];
  15. for (var file of distFiles) {
  16. var lf = fs.readFileSync(file, 'utf8');
  17. lf = lf.replace('__VERSION__', 'v' + v);
  18. fs.writeFileSync(file, lf);
  19. }
  20. }