diff --git a/docs/.vuepress/config.js b/docs/.vuepress/config.js index 9880a26318fc7eedab2306f12fa2acd7afd39765..eced2dfedc52e94a0a304f33d3693c0333cbef41 100644 --- a/docs/.vuepress/config.js +++ b/docs/.vuepress/config.js @@ -4,15 +4,9 @@ const highlight = require('@vuepress/markdown/lib/highlight') const translatePlugin = require('./markdown/translate') const headerPlugin = require('./markdown/header') const createSidebar = require('./markdown/createSidebar') -const { simplifySlugText, tabs, getFormattedDate } = require('./utils') +const { simplifySlugText, tabs } = require('./utils') const copyOptions = require('./config/copy'); -const nowString = getFormattedDate(); -const changeLoaderOptions = (options, key = 'name') => { - if (options && options[key]) options[key] = `${nowString}/${options[key]}`; - return options; -}; - const base = '/uniCloud/' const config = { @@ -127,47 +121,10 @@ const config = { '@theme-config', path.resolve(process.cwd(), 'docs/.vuepress/config') ) - config.output.filename(`${nowString}/${config.output.get('filename')}`); //输出文件名 - config.module.rule('images').use('url-loader').tap(changeLoaderOptions); - config.module.rule('fonts').use('url-loader').tap(changeLoaderOptions); - config.module.rule('media').use('url-loader').tap(changeLoaderOptions); - config.module.rule('svg').use('file-loader').tap(changeLoaderOptions); - if (!isServer && process.env.NODE_ENV === 'production') { - const extract_css_plugin = config.plugin('extract-css'); - const extract_css_plugin_args = extract_css_plugin.get('args'); - if (extract_css_plugin_args) { - extract_css_plugin.set( - 'args', - extract_css_plugin_args.map(item => - changeLoaderOptions(item, 'filename') - ) - ); - } - } }, patterns: ['**/!(_sidebar).md', '**/*.vue'], plugins: [ - ["vuepress-plugin-juejin-style-copy", copyOptions], - [ - 'named-chunks', - { - layoutChunkName: (layout) => 'layout-' + layout.componentName, - pageChunkName: page => { - const _context = page._context - const pageHeaders = (page.headers || []).map(item => item.title).join(',') - if (pageHeaders) { - const originDescription = page.frontmatter.description || '' - page.frontmatter = { - ...page.frontmatter, - description: `${_context.siteConfig.description ? `${_context.siteConfig.description},` : ''}${pageHeaders}${originDescription ? `,${originDescription}` : ''}`.slice(0, 150), - } - } - const pagePath = page.path.indexOf('.html') === -1 ? page.path + 'index' : page.path - const curPath = 'docs/' + pagePath.replace('docs/', '').substring(1).replace(/\.html/g, "") - return curPath - } - } - ] + ["vuepress-plugin-juejin-style-copy", copyOptions] ], /** * diff --git a/package.json b/package.json index 05d94830a77955a1ae42033f57fb62718a973b00..cdca07796d47cff2adc4f5af7435dbd84d3aa593 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,8 @@ "scripts": { "dev": "vuepress dev docs", "build": "node --max_old_space_size=4096 ./node_modules/vuepress/cli.js build docs --no-cache", - "build-lite": "cross-env DOCS_LITE=true node --max_old_space_size=4096 ./node_modules/vuepress/cli.js build docs-lite --no-cache" + "build-lite": "cross-env DOCS_LITE=true node --max_old_space_size=4096 ./node_modules/vuepress/cli.js build docs-lite --no-cache", + "check-md":"vuepress check-md2 docs" }, "repository": { "type": "git", @@ -31,8 +32,7 @@ "markdown-it-attrs": "^4.1.6", "markdown-it-raw-table": "^1.0.0", "markdown-it-task-lists": "^2.1.1", - "vuepress-plugin-named-chunks": "^1.1.4", - "vuepress-theme-uni-app-test": "^1.4.2" + "vuepress-theme-uni-app-test": "^1.4.3" }, "dependencies": { "@docsearch/js": "^3.1.0", diff --git a/yarn.lock b/yarn.lock index 58b1fedc9ec20e4b5329a2520e31b88b2d13eb81..14d656f9f52c751843bbca9083634bbfcda2b575 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1223,6 +1223,14 @@ resolved "https://registry.yarnpkg.com/@sindresorhus/is/-/is-0.14.0.tgz#9fb3a3cf3132328151f353de4632e01e52102bea" integrity sha512-9NET910DNaIPngYnLLPeg+Ogzqsi9uM4mSboU5y6p8S5DzMTVEsJZrawi+BoDNUVBa2DhJqQYUFvMDfgU062LQ== +"@sindresorhus/slugify@^0.8.0": + version "0.8.0" + resolved "https://registry.npmmirror.com/@sindresorhus/slugify/-/slugify-0.8.0.tgz#5550b7fa064f3a8a82651463ad635378054c72d0" + integrity sha512-Y+C3aG0JHmi4nCfixHgq0iAtqWCjMCliWghf6fXbemRKSGzpcrHdYxGZGDt8MeFg+gH7ounfMbz6WogqKCWvDg== + dependencies: + escape-string-regexp "^1.0.5" + lodash.deburr "^4.1.0" + "@szmarczak/http-timer@^1.1.2": version "1.1.2" resolved "https://registry.yarnpkg.com/@szmarczak/http-timer/-/http-timer-1.1.2.tgz#b1665e2c461a2cd92f4c1bbf50d5454de0d4b421" @@ -2714,7 +2722,7 @@ chalk@^1.1.3: strip-ansi "^3.0.0" supports-color "^2.0.0" -chalk@^2.0.0, chalk@^2.3.2, chalk@^2.4.1: +chalk@^2.0.0, chalk@^2.3.2, chalk@^2.4.1, chalk@^2.4.2: version "2.4.2" resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.2.tgz#cd42541677a54333cf541a49108c1432b44c9424" integrity sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ== @@ -2909,7 +2917,7 @@ combined-stream@^1.0.6, combined-stream@~1.0.6: dependencies: delayed-stream "~1.0.0" -commander@2, commander@^2.20.0: +commander@2, commander@^2.19.0, commander@^2.20.0: version "2.20.3" resolved "https://registry.yarnpkg.com/commander/-/commander-2.20.3.tgz#fd485e84c03eb4881c20722ba48035e8531aeb33" integrity sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ== @@ -4074,6 +4082,11 @@ detect-node@^2.0.4: resolved "https://registry.yarnpkg.com/detect-node/-/detect-node-2.1.0.tgz#c9c70775a49c3d03bc2c06d9a73be550f978f8b1" integrity sha512-T0NIuQpnTvFDATNuHN5roPwSBG83rFsuO+MXXH9/3N1eFbn4wcPjttvjMLEPWJ0RGUYgQE7cGgS3tNxbqCGM7g== +diacritics@^1.3.0: + version "1.3.0" + resolved "https://registry.npmmirror.com/diacritics/-/diacritics-1.3.0.tgz#3efa87323ebb863e6696cebb0082d48ff3d6f7a1" + integrity sha512-wlwEkqcsaxvPJML+rDh/2iS824jbREk6DUMUKkEaSlxdYHeS43cClJtsWglvw2RfeXGm6ohKDqsXteJ5sP5enA== + diffie-hellman@^5.0.0: version "5.0.3" resolved "https://registry.yarnpkg.com/diffie-hellman/-/diffie-hellman-5.0.3.tgz#40e8ee98f55a2149607146921c63e1ae5f3d2875" @@ -5083,7 +5096,7 @@ globby@^7.1.1: pify "^3.0.0" slash "^1.0.0" -globby@^9.2.0: +globby@^9.1.0, globby@^9.2.0: version "9.2.0" resolved "https://registry.yarnpkg.com/globby/-/globby-9.2.0.tgz#fd029a706c703d29bdd170f4b6db3a3f7a7cb63d" integrity sha512-ollPHROa5mcxDEkwg6bPt3QbEf4pDQSNtd6JPL1YvOvAo/7/0VAm9TccUeoTmarjPw4pfUthSCqcyfNB1I3ZSg== @@ -6217,6 +6230,11 @@ lodash.debounce@^4.0.8: resolved "https://registry.yarnpkg.com/lodash.debounce/-/lodash.debounce-4.0.8.tgz#82d79bff30a67c4005ffd5e2515300ad9ca4d7af" integrity sha1-gteb/zCmfEAF/9XiUVMArZyk168= +lodash.deburr@^4.1.0: + version "4.1.0" + resolved "https://registry.npmmirror.com/lodash.deburr/-/lodash.deburr-4.1.0.tgz#ddb1bbb3ef07458c0177ba07de14422cb033ff9b" + integrity sha512-m/M1U1f3ddMCs6Hq2tAsYThTBDaAKFDX3dwDo97GEYzamXi9SqUpjWi/Rrj/gf3X2n8ktwgZrlP1z6E3v/IExQ== + lodash.kebabcase@^4.1.1: version "4.1.1" resolved "https://registry.yarnpkg.com/lodash.kebabcase/-/lodash.kebabcase-4.1.1.tgz#8489b1cb0d29ff88195cceca448ff6d6cc295c36" @@ -9218,6 +9236,17 @@ vuepress-html-webpack-plugin@^3.2.0: toposort "^1.0.0" util.promisify "1.0.0" +vuepress-plugin-check-md2@^1.0.3: + version "1.0.3" + resolved "https://registry.npmmirror.com/vuepress-plugin-check-md2/-/vuepress-plugin-check-md2-1.0.3.tgz#ad03a77ad7b1d874cf05f29dd3c16e276b188678" + integrity sha512-1UdyPI9Jw8Qi3apRVCm9PqxCzJa9SlJNZDNCrgHO+/80VCOT077lq+ScUVshAGapkz5Z1/qRB60uRz2FseJRYQ== + dependencies: + "@sindresorhus/slugify" "^0.8.0" + chalk "^2.4.2" + commander "^2.19.0" + diacritics "^1.3.0" + globby "^9.1.0" + vuepress-plugin-container@^2.0.2: version "2.1.5" resolved "https://registry.yarnpkg.com/vuepress-plugin-container/-/vuepress-plugin-container-2.1.5.tgz#37fff05662fedbd63ffd3a5463b2592c7a7f3133" @@ -9259,15 +9288,16 @@ vuepress-plugin-zooming@^1.1.8: dependencies: zooming "^2.1.1" -vuepress-theme-uni-app-test@^1.4.2: - version "1.4.2" - resolved "https://registry.npmmirror.com/vuepress-theme-uni-app-test/-/vuepress-theme-uni-app-test-1.4.2.tgz#1793837612e402097ae81708760906f8c923c5e9" - integrity sha512-WXx5VBuEVlFzYy/wcNdQLadhFpc6xEJFrZbKnr1Rz4RjAX9y+HF8WbXAWZG/XNqXUOvqFjSXXma7vlTuzTU+9g== +vuepress-theme-uni-app-test@^1.4.3: + version "1.4.3" + resolved "https://registry.npmmirror.com/vuepress-theme-uni-app-test/-/vuepress-theme-uni-app-test-1.4.3.tgz#14b27263fa0514c7583be3e0b5ac059fe88a8c96" + integrity sha512-U9FhNP4+0ewPZbh1uDaqwVFF5JX+SY33nO7LyO2JmmhqrC13anKCXq7rwrDt1/izvmBBgfIH9QEBDh10lGebqQ== dependencies: "@vuepress/plugin-back-to-top" "^1.9.5" "@vuepress/theme-default" "^1.8.2" algoliasearch "^4.13.1" clipboard "^2.0.11" + vuepress-plugin-check-md2 "^1.0.3" vuepress-plugin-juejin-style-copy "^1.0.4" vuepress-plugin-mermaidjs "1.9.1" vuepress-plugin-named-chunks "^1.1.4"