import { readFileSync, writeFileSync } from 'fs'
import updateSection from 'update-section'
import { name, main, version } from '../package.json'
console.log(`Updating CDN info to latest v${version} release...`)
const readmePath = './README.md'
const cdnUrl = `https://unpkg.com/${name}@${version}/${main}`
const minifiedUrl = cdnUrl.replace('.js', '.min.js')
const content = readFileSync(readmePath, 'utf-8')
const update = `
**Uncompressed:**
\`\`\`html
\`\`\`
**Minified:**
\`\`\`html
\`\`\`
`.trim().replace(/ {2}/gm, '')
const updated = updateSection(
content,
update,
(line) => (/