update-readme.mjs 558 B

1234567891011121314151617181920
  1. import { readFileSync, writeFileSync } from 'fs'
  2. import glob from 'glob'
  3. import { resolve } from 'path'
  4. import { HOME_DIR } from './helpers.mjs'
  5. let count = glob.sync(resolve(HOME_DIR, 'icons/*.svg')).length
  6. console.log('count', count);
  7. const readmes = glob.sync(resolve(HOME_DIR, '{.,packages/*}/README.md'))
  8. readmes.forEach(readme => {
  9. let fileData = readFileSync(readme).toString()
  10. fileData = fileData.replace(/<!--icons-count-->(.*?)<!--\/icons-count-->/, `<!--icons-count-->${count}<!--/icons-count-->`)
  11. writeFileSync(readme, fileData)
  12. })