mirror of
https://github.com/tenrok/vue-meta.git
synced 2026-06-07 04:32:24 +03:00
add build steps for CDN distribution
This commit is contained in:
@@ -46,6 +46,7 @@
|
||||
- [Installation](#installation)
|
||||
- [Yarn](#yarn)
|
||||
- [NPM](#npm)
|
||||
- [CDN](#cdn)
|
||||
- [Usage](#usage)
|
||||
- [Step 1: Preparing the plugin](#step-1-preparing-the-plugin)
|
||||
- [Step 2: Server Rendering (Optional)](#step-2-server-rendering-optional)
|
||||
@@ -67,7 +68,7 @@
|
||||
- [`noscript` ([Object])](#noscript-object)
|
||||
- [`changed` (Function)](#changed-function)
|
||||
- [How `metaInfo` is Resolved](#how-metainfo-is-resolved)
|
||||
- [Lists of Tags](#lists-of-tags)
|
||||
- [Lists of Tags](#lists-of-tags)
|
||||
- [Performance](#performance)
|
||||
- [How to prevent the update on the initial page render](#how-to-prevent-the-update-on-the-initial-page-render)
|
||||
- [FAQ](#faq)
|
||||
@@ -98,6 +99,18 @@ $ yarn add vue-meta
|
||||
$ npm install vue-meta --save
|
||||
```
|
||||
|
||||
### CDN
|
||||
|
||||
Use the links below - if you want a previous version, check the instructions at https://unpkg.com.
|
||||
|
||||
<!-- start CDN generator - do **NOT** remove this comment -->
|
||||
**Uncompressed:**
|
||||
> https://unpkg.com/vue-meta@0.0.0/lib/vue-meta.js
|
||||
|
||||
**Minified:**
|
||||
> https://unpkg.com/vue-meta@0.0.0/lib/vue-meta.min.js
|
||||
<!-- end CDN generator - do **NOT** remove this comment -->
|
||||
|
||||
# Usage
|
||||
|
||||
## Step 1: Preparing the plugin
|
||||
|
||||
+12
-3
@@ -42,12 +42,15 @@
|
||||
"rollup-plugin-node-resolve": "^2.0.0",
|
||||
"snazzy": "^5.0.0",
|
||||
"standard": "^8.5.0",
|
||||
"uglify-js": "^2.7.4",
|
||||
"update-section": "^0.3.3",
|
||||
"vue": "^2.0.3",
|
||||
"vue-loader": "^9.7.0",
|
||||
"webpack": "beta",
|
||||
"webpack-dev-server": "beta"
|
||||
},
|
||||
"homepage": "https://github.com/declandewet/vue-meta",
|
||||
"jsnext:main": "lib/jsnext/vue-meta.js",
|
||||
"keywords": [
|
||||
"attribute",
|
||||
"google",
|
||||
@@ -63,7 +66,8 @@
|
||||
"vue"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "lib",
|
||||
"main": "lib/vue-meta.js",
|
||||
"module": "lib/jsnext/vue-meta.js",
|
||||
"nyc": {
|
||||
"exclude": [
|
||||
"test/**/*.js"
|
||||
@@ -74,14 +78,19 @@
|
||||
"type": "git"
|
||||
},
|
||||
"scripts": {
|
||||
"codecov": "codecov",
|
||||
"build": "rollup -c",
|
||||
"codecov": "codecov",
|
||||
"dev": "babel-node examples/server.js",
|
||||
"lint": "standard --verbose | snazzy",
|
||||
"minify": "uglifyjs lib/vue-meta.js -cm --comments -o lib/vue-meta.min.js",
|
||||
"postbuild": "npm run minify",
|
||||
"postminify": "npm run toc",
|
||||
"posttoc": "npm run update-cdn",
|
||||
"prebuild": "rimraf lib",
|
||||
"pretest": "npm run lint",
|
||||
"test": "cross-env NODE_ENV=test karma start karma.conf.js",
|
||||
"toc": "doctoc README.md --title '# Table of Contents'"
|
||||
"toc": "doctoc README.md --title '# Table of Contents'",
|
||||
"update-cdn": "babel-node scripts/update-cdn.js"
|
||||
},
|
||||
"standard": {
|
||||
"globals": [
|
||||
|
||||
+15
-7
@@ -3,17 +3,25 @@ import nodeResolve from 'rollup-plugin-node-resolve'
|
||||
import json from 'rollup-plugin-json'
|
||||
import buble from 'rollup-plugin-buble'
|
||||
|
||||
const pkg = require('./package.json')
|
||||
|
||||
export default {
|
||||
entry: './src/index.js',
|
||||
format: 'umd',
|
||||
dest: './lib/index.js',
|
||||
moduleName: 'VueMeta',
|
||||
targets: [
|
||||
{ dest: pkg.main, format: 'umd', moduleName: 'VueMeta' },
|
||||
{ dest: pkg['jsnext:main'], format: 'es' }
|
||||
],
|
||||
plugins: [
|
||||
json(),
|
||||
nodeResolve({
|
||||
jsnext: true
|
||||
}),
|
||||
nodeResolve({ jsnext: true }),
|
||||
commonjs(),
|
||||
buble()
|
||||
]
|
||||
],
|
||||
banner: `
|
||||
/**
|
||||
* vue-meta v${pkg.version}
|
||||
* (c) ${new Date().getFullYear()} Declan de Wet
|
||||
* @license MIT
|
||||
*/
|
||||
`.replace(/ {4}/gm, '').trim()
|
||||
}
|
||||
|
||||
@@ -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.')
|
||||
@@ -5122,7 +5122,7 @@ typedarray@~0.0.5:
|
||||
version "0.0.6"
|
||||
resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777"
|
||||
|
||||
uglify-js@^2.6, uglify-js@~2.7.3:
|
||||
uglify-js, uglify-js@^2.6, uglify-js@~2.7.3:
|
||||
version "2.7.4"
|
||||
resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-2.7.4.tgz#a295a0de12b6a650c031c40deb0dc40b14568bd2"
|
||||
dependencies:
|
||||
@@ -5199,7 +5199,7 @@ untildify@^2.1.0:
|
||||
dependencies:
|
||||
os-homedir "^1.0.0"
|
||||
|
||||
update-section@^0.3.0:
|
||||
update-section, update-section@^0.3.0:
|
||||
version "0.3.3"
|
||||
resolved "https://registry.yarnpkg.com/update-section/-/update-section-0.3.3.tgz#458f17820d37820dc60e20b86d94391b00123158"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user