changelog.mjs 989 B

12345678910111213141516171819202122232425262728293031
  1. import cp from 'child_process'
  2. import { getArgvs, getPackageJson, printChangelog } from './helpers.mjs'
  3. const p = getPackageJson(),
  4. argv = getArgvs(),
  5. version = argv['latest-version'] || `${p.version}`
  6. if (version) {
  7. cp.exec(`git diff ${version} HEAD --name-status src/_icons`, function(err, ret) {
  8. let newIcons = [], modifiedIcons = [], renamedIcons = []
  9. ret.replace(/A\s+src\/_icons\/([a-z0-9-]+)\.svg/g, function(m, fileName) {
  10. newIcons.push(fileName)
  11. })
  12. ret.replace(/M\s+src\/_icons\/([a-z0-9-]+)\.svg/g, function(m, fileName) {
  13. modifiedIcons.push(fileName)
  14. })
  15. ret.replace(/R[0-9]+\s+src\/_icons\/([a-z0-9-]+)\.svg\s+src\/_icons\/([a-z0-9-]+).svg/g, function(m, fileNameBefore, fileNameAfter) {
  16. renamedIcons.push([fileNameBefore, fileNameAfter])
  17. })
  18. modifiedIcons = modifiedIcons.filter(function(el) {
  19. return newIcons.indexOf(el) < 0
  20. })
  21. printChangelog(newIcons, modifiedIcons, renamedIcons, true)
  22. })
  23. }