changelog-commit.mjs 762 B

123456789101112131415161718192021222324
  1. import cp from 'child_process'
  2. import { printChangelog } from './helpers.mjs'
  3. cp.exec('git status', function(err, ret) {
  4. let newIcons = [], modifiedIcons = [], renamedIcons = []
  5. ret.replace(/new file:\s+icons\/([a-z0-9-\/]+)\.svg/g, function(m, fileName) {
  6. newIcons.push(fileName)
  7. })
  8. ret.replace(/modified:\s+icons\/([a-z0-9-\/]+)\.svg/g, function(m, fileName) {
  9. modifiedIcons.push(fileName)
  10. })
  11. ret.replace(/renamed:\s+icons\/([a-z0-9-\/]+).svg -> icons\/([a-z0-9-\/]+).svg/g, function(m, fileNameBefore, fileNameAfter) {
  12. renamedIcons.push([fileNameBefore, fileNameAfter])
  13. })
  14. modifiedIcons = modifiedIcons.filter(function(el) {
  15. return newIcons.indexOf(el) < 0
  16. })
  17. printChangelog(newIcons, modifiedIcons, renamedIcons)
  18. })