2
0
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:
Declan de Wet
2016-11-05 15:47:22 +02:00
parent 323f63fbf5
commit 761ddb0f34
5 changed files with 75 additions and 13 deletions
+32
View File
@@ -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.')