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.

27 regels
779 B

  1. /* eslint-disable @typescript-eslint/no-var-requires */
  2. const fs = require('fs');
  3. // Patch README
  4. const insert = fs.readFileSync('./README.pre.md', { encoding: 'utf8' });
  5. if (insert.trim().length !== 0) {
  6. const data = fs.readFileSync('./README.md', { encoding: 'utf8' });
  7. fs.writeFileSync('./README.md', `${insert}\n${data}`);
  8. }
  9. // Patch package.json
  10. const date = new Date(new Date().toLocaleString('en-US', { timeZone: 'America/New_York' }));
  11. let packageJSON = require('../package.json');
  12. packageJSON = JSON.stringify(
  13. {
  14. ...packageJSON,
  15. version: `${String(date.getFullYear())}.${date.getMonth() + 1}.${date.getDate()}${String(
  16. date.getHours(),
  17. ).padStart(2, '0')}`,
  18. },
  19. undefined,
  20. '\t',
  21. );
  22. packageJSON += '\n';
  23. fs.writeFileSync('./package.json', packageJSON);