changelog.js 667 B

12345678910111213141516171819202122232425262728
  1. #!/usr/bin/env node
  2. 'use strict'
  3. const fs = require('fs'),
  4. path = require('path'),
  5. YAML = require('yaml');
  6. const content = YAML.parse(fs.readFileSync(path.join(__dirname, '../src/pages/_data/changelog.yml'), 'utf8')).reverse()
  7. let readme = `# Changelog
  8. All notable changes to this project will be documented in this file.\n`
  9. content.forEach((change) => {
  10. readme += `\n\n## \`${change.version}\` - ${change.date}\n\n`
  11. if (change.description) {
  12. readme += `**${change.description}**\n\n`
  13. }
  14. change.changes.forEach((line) => {
  15. readme += `- ${line}\n`
  16. })
  17. console.log(change.version);
  18. })
  19. fs.writeFileSync(path.join(__dirname, '../CHANGELOG.md'), readme)