changelog-image.mjs 804 B

123456789101112131415161718192021222324252627282930
  1. import { generateIconsPreview, getAllIcons, getArgvs, getPackageJson, GITHUB_DIR } from './helpers.mjs'
  2. import path from 'path'
  3. const argv = getArgvs(),
  4. p = getPackageJson()
  5. const version = argv['new-version'] || `${p.version}`
  6. if (version) {
  7. const icons = getAllIcons()
  8. let newIcons = []
  9. Object.entries(icons).forEach(([type, icons]) => {
  10. icons.forEach(icon => {
  11. if (icon.version) {
  12. if (`${icon.version}.0` === version) {
  13. console.log(`Add icon "${type}/${icon.name}" vith version "${icon.version}" to new icons list`)
  14. newIcons.push(icon.path)
  15. }
  16. }
  17. })
  18. })
  19. if (newIcons.length > 0) {
  20. generateIconsPreview(newIcons, path.join(GITHUB_DIR, `tabler-icons-${version}.svg`), {
  21. columnsCount: 6,
  22. paddingOuter: 24
  23. })
  24. }
  25. }