docs: add version info in playground.html

This commit is contained in:
Harttle
2021-10-20 23:20:23 +08:00
parent d0c3cc8b47
commit 564972ba74
10 changed files with 214 additions and 22710 deletions
-1
View File
@@ -3,7 +3,6 @@
[![npm downloads](https://img.shields.io/npm/dm/liquidjs.svg?style=flat-square)](https://www.npmjs.org/package/liquidjs)
[![Coverage](https://img.shields.io/coveralls/harttle/liquidjs.svg?style=flat-square)](https://coveralls.io/github/harttle/liquidjs?branch=master)
[![Build Status](https://img.shields.io/github/workflow/status/harttle/liquidjs/Check/master.svg?style=flat-square)](https://github.com/harttle/liquidjs/actions/workflows/check.yml?query=branch%3Amaster)
[![David dependencies](https://img.shields.io/david/harttle/liquidjs.svg?style=flat-square)](https://david-dm.org/harttle/liquidjs)
[![DUB license](https://img.shields.io/dub/l/vibe-d.svg?style=flat-square)](https://github.com/harttle/liquidjs/blob/master/LICENSE)
[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg?style=flat-square)](https://github.com/harttle/liquidjs)
+15
View File
@@ -0,0 +1,15 @@
#!/usr/bin/env bash
cd docs
cp ../CHANGELOG.md source/tutorials/changelog.md
sed -i \
-e 's/{%/{% raw %}{%{% endraw %}/g' \
-e 's/{{/{% raw %}{{{% endraw %}/g' \
-e '1 s/"/\"/g' \
-e '1 s/</\&lt;/g' \
-e '1 s/>/\&gt;/g' \
source/tutorials/changelog.md
cp source/tutorials/changelog.md source/zh-cn/tutorials/changelog.md
sed -i '1i ---\ntitle: Changelog\nauto: true\n---\n' source/tutorials/changelog.md
sed -i '1i ---\ntitle: 更新日志\nauto: true\n---\n' source/zh-cn/tutorials/changelog.md
+1 -13
View File
@@ -2,25 +2,13 @@
./bin/build-contributors.sh
./bin/build-apidoc.sh
./bin/build-changelog.sh
cd docs
npm ci
npm run build
cp CNAME public/
cp ../CHANGELOG.md source/tutorials/changelog.md
sed -i \
-e 's/{%/{% raw %}{%{% endraw %}/g' \
-e 's/{{/{% raw %}{{{% endraw %}/g' \
-e '1 s/"/\&quot;/g' \
-e '1 s/</\&lt;/g' \
-e '1 s/>/\&gt;/g' \
source/tutorials/changelog.md
cp source/tutorials/changelog.md source/zh-cn/tutorials/changelog.md
sed -i '1i ---\ntitle: Changelog\nauto: true\n---\n' source/tutorials/changelog.md
sed -i '1i ---\ntitle: 更新日志\nauto: true\n---\n' source/zh-cn/tutorials/changelog.md
if [ "$HEXO_ALGOLIA_INDEXING_KEY" != "" ]; then
npm run index
fi
+1
View File
@@ -8,5 +8,6 @@
</div>
<div class="col" id="previewEl">{{__('playground.loading')}}</div>
</div>
<p class="inner version"></p>
</div>
</div>
+3 -2
View File
@@ -1,6 +1,8 @@
#playground
background: white
overflow: hidden
.wrapper
margin-bottom: 40px
h1
font-size: 36px
font-weight: 300
@@ -10,11 +12,10 @@
display: flex
flex-wrap: wrap;
justify-content: space-between
margin-bottom: 30px
font-size: 1em
.col
flex: 1 1 100%
margin-bottom: 30px
margin-bottom: 10px
@media mq-normal
.row
+7
View File
@@ -59,6 +59,7 @@
// playground
/* global liquidjs, ace */
if (!location.pathname.match(/playground.html$/)) return;
updateVersion(liquidjs.version);
const engine = new liquidjs.Liquid();
const editor = createEditor('editorEl', 'liquid');
const dataEditor = createEditor('dataEl', 'json');
@@ -121,6 +122,12 @@
function utoa(str) {
return btoa(unescape(encodeURIComponent(str)));
}
function updateVersion(version) {
document.querySelector('.version').innerHTML = `
liquidjs@<a target="_blank" href="https://www.npmjs.com/package/liquidjs/v/${version}">${version}</a>
`
}
}());
if ('serviceWorker' in navigator) {
+154 -22644
View File
File diff suppressed because it is too large Load Diff
+1
View File
@@ -98,6 +98,7 @@
"rollup-plugin-replace": "^2.1.0",
"rollup-plugin-typescript2": "^0.21.1",
"rollup-plugin-uglify": "^5.0.2",
"rollup-plugin-version-injector": "^1.3.3",
"semantic-release": "^17.2.3",
"sinon": "^7.5.0",
"sinon-chai": "^3.3.0",
+31 -50
View File
@@ -2,6 +2,7 @@ import { uglify } from 'rollup-plugin-uglify'
import pkg from './package.json'
import typescript from 'rollup-plugin-typescript2'
import replace from 'rollup-plugin-replace'
import versionInjector from 'rollup-plugin-version-injector'
const version = process.env.VERSION || pkg.version
const sourcemap = true
@@ -13,6 +14,28 @@ const banner = `/*
const treeshake = {
propertyReadSideEffects: false
}
const tsconfig = {
tsconfigOverride: {
include: [ 'src' ],
exclude: [ 'test', 'benchmark' ],
compilerOptions: {
target: 'es5',
module: 'ES2015'
}
}
}
const versionInjection = versionInjector({
injectInComments: false,
injectInTags: {
fileRegexp: /\.(ts|js|html|css)$/,
tagId: 'VI',
dateFormat: 'mmmm d, yyyy HH:MM:ss'
},
packageJson: './package.json',
logLevel: 'info',
logger: console,
exclude: []
})
const input = './src/liquid.ts'
const replaceFS = {
include: './src/liquid-options.ts',
@@ -32,16 +55,7 @@ const nodeCjs = {
banner
}],
external: ['path', 'fs'],
plugins: [typescript({
tsconfigOverride: {
include: [ 'src' ],
exclude: [ 'test', 'benchmark' ],
compilerOptions: {
target: 'ES2017',
module: 'ES2015'
}
}
})],
plugins: [versionInjection, typescript(tsconfig)],
treeshake,
input
}
@@ -53,16 +67,7 @@ const nodeEsm = {
banner
}],
external: ['path', 'fs'],
plugins: [typescript({
tsconfigOverride: {
include: [ 'src' ],
exclude: [ 'test', 'benchmark' ],
compilerOptions: {
target: 'ES2017',
module: 'ES2015'
}
}
})],
plugins: [versionInjection, typescript(tsconfig)],
treeshake,
input
}
@@ -75,18 +80,10 @@ const browserEsm = {
}],
external: ['path', 'fs'],
plugins: [
versionInjection,
replace(replaceFS),
replace(replaceStream),
typescript({
tsconfigOverride: {
include: [ 'src' ],
exclude: [ 'test', 'benchmark' ],
compilerOptions: {
target: 'ES2017',
module: 'ES2015'
}
}
})
typescript(tsconfig)
],
treeshake,
input
@@ -101,18 +98,10 @@ const browserUmd = {
banner
}],
plugins: [
versionInjection,
replace(replaceFS),
replace(replaceStream),
typescript({
tsconfigOverride: {
include: [ 'src' ],
exclude: [ 'test', 'benchmark' ],
compilerOptions: {
target: 'es5',
module: 'ES2015'
}
}
})
typescript(tsconfig)
],
treeshake,
input
@@ -126,18 +115,10 @@ const browserMin = {
sourcemap
}],
plugins: [
versionInjection,
replace(replaceFS),
replace(replaceStream),
typescript({
tsconfigOverride: {
include: [ 'src' ],
exclude: [ 'test', 'benchmark' ],
compilerOptions: {
target: 'es5',
module: 'ES2015'
}
}
}),
typescript(tsconfig),
uglify()
],
treeshake,
+1
View File
@@ -16,6 +16,7 @@ import { toPromise, toValue } from './util/async'
export * from './util/error'
export * from './types'
export const version = '[VI]{version}[/VI]'
export class Liquid {
public readonly options: NormalizedFullOptions