import { readFileSync, writeFileSync } from 'fs' import { glob } from 'glob' import { resolve } from 'path' import { HOME_DIR, ICONS_SRC_DIR } from './helpers.mjs' let count = glob.sync(resolve(ICONS_SRC_DIR, '**/*.svg')).length, outlineCount = glob.sync(resolve(ICONS_SRC_DIR, '**/outline/*.svg')).length, filledCount = glob.sync(resolve(ICONS_SRC_DIR, '**/filled/*.svg')).length console.log('count', count); console.log('filledCount', filledCount); console.log('outlineCount', outlineCount); const readmes = glob.sync(resolve(HOME_DIR, '{.,packages/*}/README.md')) readmes.forEach(readme => { let fileData = readFileSync(readme).toString() fileData = fileData.replace(/(.*?)/, `${count}`) .replace(/(.*?)/, `${outlineCount}`) .replace(/(.*?)/, `${filledCount}`) writeFileSync(readme, fileData) })