updateVersionScript.js 657 B

12345678910111213
  1. var fs = require('fs');
  2. var path = require('path');
  3. var fileName = '.ivprog_version.json';
  4. var date = new Date();
  5. var day = date.getUTCDate() > 9 ? date.getUTCDate() : '0' + date.getUTCDate();
  6. var month = date.getMonth() > 9 ? date.getMonth() + 1 : '0' + (date.getMonth() + 1);
  7. var minutes = date.getMinutes() > 9 ? date.getMinutes() : '0' + date.getMinutes();
  8. var hour = date.getHours() > 9 ? date.getHours() : '0' + date.getHours();
  9. var versionString = `${date.getFullYear()}_${month}_${day} ${hour}_${minutes}`;
  10. var versionData = `{ "version":"${versionString}" }`;
  11. var filePath = path.join(__dirname, fileName);
  12. fs.writeFileSync(filePath, versionData);