mirror of
https://github.com/tenrok/vue-meta.git
synced 2026-06-09 12:12:25 +03:00
add build steps for CDN distribution
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
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 = `
|
||||
<!-- start CDN generator - do **NOT** remove this comment -->
|
||||
**Uncompressed:**
|
||||
> ${cdnUrl}
|
||||
|
||||
**Minified:**
|
||||
> ${minifiedUrl}
|
||||
<!-- end CDN generator - do **NOT** remove this comment -->
|
||||
`.trim().replace(/ {2}/gm, '')
|
||||
|
||||
const updated = updateSection(
|
||||
content,
|
||||
update,
|
||||
(line) => (/<!-- start CDN generator/).test(line),
|
||||
(line) => (/<!-- end CDN generator/).test(line)
|
||||
)
|
||||
|
||||
writeFileSync(readmePath, updated)
|
||||
|
||||
console.log('CDN info updated.')
|
||||
Reference in New Issue
Block a user