Skip to content

Commit

Permalink
build: add sitemap
Browse files Browse the repository at this point in the history
  • Loading branch information
灵亦 committed Nov 23, 2022
1 parent 773cd47 commit 3143e14
Show file tree
Hide file tree
Showing 5 changed files with 209 additions and 26 deletions.
16 changes: 11 additions & 5 deletions .vitepress/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,16 +45,22 @@ module.exports = (async () => {
title: 'SLS',
description: 'SLS 文档中心',

plugins: {
sitemap: {
hostname: 'https://sls.aliyun.com/',
},
},

/**
* @type {import('.theme/src/vitepress/config').Config}
*/
themeConfig: {
logo: '/img/sls.svg',

algolia: {
// indexName: "vuejs-v3",
// appId: "BH4D9OD16A",
// apiKey: "bc6e8acb44ed4179c30d0a45d6140d3f",
indexName: 'sls-doc-test',
appId: 'H7AKHYSS2Y',
apiKey: '5562d4b6eb57fe8fd21a319d961a3bf2',
placeholder: '在SLS文档中心查找',
translations: {
modal: {
Expand Down Expand Up @@ -93,15 +99,15 @@ module.exports = (async () => {
},
],
'/sqldemo': getSqldemoSider(),
'/opensource/ilogtail': getOpensourceSider()
'/opensource/ilogtail': getOpensourceSider(),
},

footer: {
// license: {
// text: 'MIT License',
// link: 'https://opensource.org/licenses/MIT'
// },
copyright: `Copyright © 2021-${new Date().getFullYear()} Aliyun SLS`
copyright: `Copyright © 2021-${new Date().getFullYear()} Aliyun SLS`,
},

// // For i18n translation messages
Expand Down
17 changes: 17 additions & 0 deletions .vitepress/genSiteMap.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
const fs = require('fs')
const path = require('path')
const fg = require('fast-glob')
const { SitemapStream, streamToPromise } = require('sitemap')

console.log('Start building sitemap..')

const linksStream = fg
.stream(['./src/**/*.md'])
.map((filePath) => ({ url: filePath.replace('./src/', '/doc/').replace(/\.md$/, '.html') }))

const sitemapStream = new SitemapStream({ hostname: 'https://sls.aliyun.com/' })

// Return a promise that resolves with your XML string
streamToPromise(linksStream.pipe(sitemapStream)).then((sitemap) => {
fs.writeFileSync(path.resolve(__dirname, './dist/sitemap.xml'), sitemap)
})
13 changes: 12 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,15 @@
[地址](https://sls.aliyun.com/doc.html)

# 如何贡献
[查看](https://github.com/aliyun-sls/sls-doc/blob/main/src/dev/env.md)开发环境
[查看](https://github.com/aliyun-sls/sls-doc/blob/main/src/dev/env.md)开发环境

## 更多参考
B站:https://space.bilibili.com/630680534

云栖博客:https://yq.aliyun.com/teams/4/type_blog-cid_8

知乎:https://zhuanlan.zhihu.com/aliyunlog

微信:智能日志分析 or AISecDevOps

产品网站:https://www.aliyun.com/product/sls
33 changes: 13 additions & 20 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,46 +1,39 @@
{
"name": "@vue/theme",
"version": "1.2.2",
"description": "The design system for Vue.js.",
"main": "src/index.ts",
"exports": {
".": "./src/index.ts",
"./config": "./src/vitepress/config/baseConfig.js"
},
"files": [
"src",
"types"
],
"name": "@sls/doc",
"version": "1.0.0",
"description": "The doc for sls.",
"repository": {
"type": "git",
"url": "git+https://github.com/vuejs/theme.git"
"url": "git+https://github.com:aliyun-sls/sls-doc.git"
},
"keywords": [
"vue",
"design-system"
"sls",
"doc"
],
"author": "Evan You",
"license": "MIT",
"homepage": "https://theme.vuejs.org",
"author": "wangtao0101",
"homepage": "https://sls.aliyun.com/doc/",
"bugs": {
"url": "https://github.com/vuejs/theme/issues"
"url": "https://github.com/aliyun-sls/sls-doc/issues"
},
"scripts": {
"lint": "prettier --check --write --parser typescript \"{__tests__,docs,src,types}/**/*.ts\"",
"sitemap": "node .vitepress/genSiteMap",
"lint:fail": "prettier --check --parser typescript \"{__tests__,docs,src,types}/**/*.ts\"",
"type": "tsc --noEmit",
"test": "npm run lint && npm run type",
"dev": "vitepress",
"build": "vitepress build",
"build": "vitepress build && npm run sitemap",
"serve": "npm run demo-build && vitepress serve demo"
},
"dependencies": {
"@docsearch/css": "^3.2.1",
"@docsearch/js": "^3.2.1",
"@vueuse/core": "^9.1.1",
"body-scroll-lock": "^3.1.5",
"fast-glob": "^3.2.12",
"glob": "^8.0.3",
"normalize.css": "^8.0.1",
"sitemap": "^7.1.1",
"urijs": "^1.19.11"
},
"devDependencies": {
Expand Down
156 changes: 156 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,27 @@
resolved "https://registry.npmmirror.com/@mdit-vue/types/-/types-0.11.0.tgz#ab9c6f4e69d9c9eaabf1a73e59dc699875b224ef"
integrity sha512-ygCGP7vFpqS02hpZwEe1uz8cfImWX06+zRs08J+tCZRKb6k+easIaIHFtY9ZSxt7j9L/gAPLDo/5RmOT6z0DPQ==

"@nodelib/fs.scandir@2.1.5":
version "2.1.5"
resolved "https://registry.npmmirror.com/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz#7619c2eb21b25483f6d167548b4cfd5a7488c3d5"
integrity sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==
dependencies:
"@nodelib/fs.stat" "2.0.5"
run-parallel "^1.1.9"

"@nodelib/fs.stat@2.0.5", "@nodelib/fs.stat@^2.0.2":
version "2.0.5"
resolved "https://registry.npmmirror.com/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz#5bd262af94e9d25bd1e71b05deed44876a222e8b"
integrity sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==

"@nodelib/fs.walk@^1.2.3":
version "1.2.8"
resolved "https://registry.npmmirror.com/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz#e95737e8bb6746ddedf69c556953494f196fe69a"
integrity sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==
dependencies:
"@nodelib/fs.scandir" "2.1.5"
fastq "^1.6.0"

"@types/body-scroll-lock@^3.1.0":
version "3.1.0"
resolved "https://registry.npmmirror.com/@types/body-scroll-lock/-/body-scroll-lock-3.1.0.tgz#435f6abf682bf58640e1c2ee5978320b891970e7"
Expand All @@ -178,6 +199,23 @@
resolved "https://registry.npmmirror.com/@types/estree/-/estree-1.0.0.tgz#5fb2e536c1ae9bf35366eed879e827fa59ca41c2"
integrity sha512-WulqXMDUTYAXCjZnk6JtIHPigp55cVtDgDrO2gHRwhyJto21+1zbVCtOYB2L1F9w4qCQ0rOGWBnBe0FNTiEJIQ==

"@types/node@*":
version "18.11.9"
resolved "https://registry.npmmirror.com/@types/node/-/node-18.11.9.tgz#02d013de7058cea16d36168ef2fc653464cfbad4"
integrity sha512-CRpX21/kGdzjOpFsZSkcrXMGIBWMGNIHXXBVFSH+ggkftxg+XYP20TESbh+zFvFj3EQOl5byk0HTRn1IL6hbqg==

"@types/node@^17.0.5":
version "17.0.45"
resolved "https://registry.npmmirror.com/@types/node/-/node-17.0.45.tgz#2c0fafd78705e7a18b7906b5201a522719dc5190"
integrity sha512-w+tIMs3rq2afQdsPJlODhoUEKzFP1ayaoyl1CcnwtIlsVe7K7bA1NGm4s3PraqTLlXnbIN84zuBlxBWo1u9BLw==

"@types/sax@^1.2.1":
version "1.2.4"
resolved "https://registry.npmmirror.com/@types/sax/-/sax-1.2.4.tgz#8221affa7f4f3cb21abd22f244cfabfa63e6a69e"
integrity sha512-pSAff4IAxJjfAXUG6tFkO7dsSbTmf8CtUpfhhZ5VhkRpC4628tJhh3+V6H1E+/Gs9piSzYKT5yzHO5M4GG9jkw==
dependencies:
"@types/node" "*"

"@types/urijs@^1.19.19":
version "1.19.19"
resolved "https://registry.npmmirror.com/@types/urijs/-/urijs-1.19.19.tgz#2789369799907fc11e2bc6e3a00f6478c2281b95"
Expand Down Expand Up @@ -330,6 +368,11 @@ algoliasearch@^4.0.0:
"@algolia/requester-node-http" "4.14.2"
"@algolia/transporter" "4.14.2"

arg@^5.0.0:
version "5.0.2"
resolved "https://registry.npmmirror.com/arg/-/arg-5.0.2.tgz#c81433cc427c92c4dcf4865142dbca6f15acd59c"
integrity sha512-PYjyFOLKQ9y57JvQ6QLo8dAgNqswh8M1RMJYdQduT6xbWSgK36P/Z/v+p888pM69jMMfS8Xd8F6I1kQ/I9HUGg==

balanced-match@^1.0.0:
version "1.0.2"
resolved "https://registry.npmmirror.com/balanced-match/-/balanced-match-1.0.2.tgz#e83e3a7e3f300b34cb9d87f615fa0cbf357690ee"
Expand All @@ -352,6 +395,13 @@ brace-expansion@^2.0.1:
dependencies:
balanced-match "^1.0.0"

braces@^3.0.2:
version "3.0.2"
resolved "https://registry.npmmirror.com/braces/-/braces-3.0.2.tgz#3454e1a462ee8d599e236df336cd9ea4f8afe107"
integrity sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==
dependencies:
fill-range "^7.0.1"

csstype@^2.6.8:
version "2.6.21"
resolved "https://registry.npmmirror.com/csstype/-/csstype-2.6.21.tgz#2efb85b7cc55c80017c66a5ad7cbd931fda3a90e"
Expand Down Expand Up @@ -490,6 +540,31 @@ estree-walker@^2.0.2:
resolved "https://registry.npmmirror.com/estree-walker/-/estree-walker-2.0.2.tgz#52f010178c2a4c117a7757cfe942adb7d2da4cac"
integrity sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==

fast-glob@^3.2.12:
version "3.2.12"
resolved "https://registry.npmmirror.com/fast-glob/-/fast-glob-3.2.12.tgz#7f39ec99c2e6ab030337142da9e0c18f37afae80"
integrity sha512-DVj4CQIYYow0BlaelwK1pHl5n5cRSJfM60UA0zK891sVInoPri2Ekj7+e1CT3/3qxXenpI+nBBmQAcJPJgaj4w==
dependencies:
"@nodelib/fs.stat" "^2.0.2"
"@nodelib/fs.walk" "^1.2.3"
glob-parent "^5.1.2"
merge2 "^1.3.0"
micromatch "^4.0.4"

fastq@^1.6.0:
version "1.13.0"
resolved "https://registry.npmmirror.com/fastq/-/fastq-1.13.0.tgz#616760f88a7526bdfc596b7cab8c18938c36b98c"
integrity sha512-YpkpUnK8od0o1hmeSc7UUs/eB/vIPWJYjKck2QKIzAf71Vm1AAQ3EbuZB3g2JIy+pg+ERD0vqI79KyZiB2e2Nw==
dependencies:
reusify "^1.0.4"

fill-range@^7.0.1:
version "7.0.1"
resolved "https://registry.npmmirror.com/fill-range/-/fill-range-7.0.1.tgz#1919a6a7c75fe38b2c7c77e5198535da9acdda40"
integrity sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==
dependencies:
to-regex-range "^5.0.1"

fs.realpath@^1.0.0:
version "1.0.0"
resolved "https://registry.npmmirror.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f"
Expand All @@ -505,6 +580,13 @@ function-bind@^1.1.1:
resolved "https://registry.npmmirror.com/function-bind/-/function-bind-1.1.1.tgz#a56899d3ea3c9bab874bb9773b7c5ede92f4895d"
integrity sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==

glob-parent@^5.1.2:
version "5.1.2"
resolved "https://registry.npmmirror.com/glob-parent/-/glob-parent-5.1.2.tgz#869832c58034fe68a4093c17dc15e8340d8401c4"
integrity sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==
dependencies:
is-glob "^4.0.1"

glob@^8.0.3:
version "8.0.3"
resolved "https://registry.npmmirror.com/glob/-/glob-8.0.3.tgz#415c6eb2deed9e502c68fa44a272e6da6eeca42e"
Expand Down Expand Up @@ -543,6 +625,23 @@ is-core-module@^2.9.0:
dependencies:
has "^1.0.3"

is-extglob@^2.1.1:
version "2.1.1"
resolved "https://registry.npmmirror.com/is-extglob/-/is-extglob-2.1.1.tgz#a88c02535791f02ed37c76a1b9ea9773c833f8c2"
integrity sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==

is-glob@^4.0.1:
version "4.0.3"
resolved "https://registry.npmmirror.com/is-glob/-/is-glob-4.0.3.tgz#64f61e42cbbb2eec2071a9dac0b28ba1e65d5084"
integrity sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==
dependencies:
is-extglob "^2.1.1"

is-number@^7.0.0:
version "7.0.0"
resolved "https://registry.npmmirror.com/is-number/-/is-number-7.0.0.tgz#7535345b896734d5f80c4d06c50955527a14f12b"
integrity sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==

jsonc-parser@^3.0.0:
version "3.2.0"
resolved "https://registry.npmmirror.com/jsonc-parser/-/jsonc-parser-3.2.0.tgz#31ff3f4c2b9793f89c67212627c51c6394f88e76"
Expand All @@ -555,6 +654,19 @@ magic-string@^0.25.7:
dependencies:
sourcemap-codec "^1.4.8"

merge2@^1.3.0:
version "1.4.1"
resolved "https://registry.npmmirror.com/merge2/-/merge2-1.4.1.tgz#4368892f885e907455a6fd7dc55c0c9d404990ae"
integrity sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==

micromatch@^4.0.4:
version "4.0.5"
resolved "https://registry.npmmirror.com/micromatch/-/micromatch-4.0.5.tgz#bc8999a7cbbf77cdc89f132f6e467051b49090c6"
integrity sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==
dependencies:
braces "^3.0.2"
picomatch "^2.3.1"

minimatch@^5.0.1:
version "5.1.0"
resolved "https://registry.npmmirror.com/minimatch/-/minimatch-5.1.0.tgz#1717b464f4971b144f6aabe8f2d0b8e4511e09c7"
Expand Down Expand Up @@ -589,6 +701,11 @@ picocolors@^1.0.0:
resolved "https://registry.npmmirror.com/picocolors/-/picocolors-1.0.0.tgz#cb5bdc74ff3f51892236eaf79d68bc44564ab81c"
integrity sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==

picomatch@^2.3.1:
version "2.3.1"
resolved "https://registry.npmmirror.com/picomatch/-/picomatch-2.3.1.tgz#3ba3833733646d9d3e4995946c1365a67fb07a42"
integrity sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==

postcss@^8.1.10, postcss@^8.4.18:
version "8.4.19"
resolved "https://registry.npmmirror.com/postcss/-/postcss-8.4.19.tgz#61178e2add236b17351897c8bcc0b4c8ecab56fc"
Expand All @@ -608,6 +725,11 @@ prettier@^2.7.1:
resolved "https://registry.npmmirror.com/prettier/-/prettier-2.7.1.tgz#e235806850d057f97bb08368a4f7d899f7760c64"
integrity sha512-ujppO+MkdPqoVINuDFDRLClm7D78qbDt0/NR+wp5FqEZOoTNAjPHWj17QRhu7geIHJfcNhRk1XVQmF8Bp3ye+g==

queue-microtask@^1.2.2:
version "1.2.3"
resolved "https://registry.npmmirror.com/queue-microtask/-/queue-microtask-1.2.3.tgz#4929228bbc724dfac43e0efb058caf7b6cfb6243"
integrity sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==

resolve@^1.22.1:
version "1.22.1"
resolved "https://registry.npmmirror.com/resolve/-/resolve-1.22.1.tgz#27cb2ebb53f91abb49470a928bba7558066ac177"
Expand All @@ -617,13 +739,30 @@ resolve@^1.22.1:
path-parse "^1.0.7"
supports-preserve-symlinks-flag "^1.0.0"

reusify@^1.0.4:
version "1.0.4"
resolved "https://registry.npmmirror.com/reusify/-/reusify-1.0.4.tgz#90da382b1e126efc02146e90845a88db12925d76"
integrity sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==

rollup@^2.79.1:
version "2.79.1"
resolved "https://registry.npmmirror.com/rollup/-/rollup-2.79.1.tgz#bedee8faef7c9f93a2647ac0108748f497f081c7"
integrity sha512-uKxbd0IhMZOhjAiD5oAFp7BqvkA4Dv47qpOCtaNvng4HBwdbWtdOh8f5nZNuk2rp51PMGk3bzfWu5oayNEuYnw==
optionalDependencies:
fsevents "~2.3.2"

run-parallel@^1.1.9:
version "1.2.0"
resolved "https://registry.npmmirror.com/run-parallel/-/run-parallel-1.2.0.tgz#66d1368da7bdf921eb9d95bd1a9229e7f21a43ee"
integrity sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==
dependencies:
queue-microtask "^1.2.2"

sax@^1.2.4:
version "1.2.4"
resolved "https://registry.npmmirror.com/sax/-/sax-1.2.4.tgz#2816234e2378bddc4e5354fab5caa895df7100d9"
integrity sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==

shiki@^0.11.1:
version "0.11.1"
resolved "https://registry.npmmirror.com/shiki/-/shiki-0.11.1.tgz#df0f719e7ab592c484d8b73ec10e215a503ab8cc"
Expand All @@ -633,6 +772,16 @@ shiki@^0.11.1:
vscode-oniguruma "^1.6.1"
vscode-textmate "^6.0.0"

sitemap@^7.1.1:
version "7.1.1"
resolved "https://registry.npmmirror.com/sitemap/-/sitemap-7.1.1.tgz#eeed9ad6d95499161a3eadc60f8c6dce4bea2bef"
integrity sha512-mK3aFtjz4VdJN0igpIJrinf3EO8U8mxOPsTBzSsy06UtjZQJ3YY3o3Xa7zSc5nMqcMrRwlChHZ18Kxg0caiPBg==
dependencies:
"@types/node" "^17.0.5"
"@types/sax" "^1.2.1"
arg "^5.0.0"
sax "^1.2.4"

source-map-js@^1.0.2:
version "1.0.2"
resolved "https://registry.npmmirror.com/source-map-js/-/source-map-js-1.0.2.tgz#adbc361d9c62df380125e7f161f71c826f1e490c"
Expand All @@ -653,6 +802,13 @@ supports-preserve-symlinks-flag@^1.0.0:
resolved "https://registry.npmmirror.com/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz#6eda4bd344a3c94aea376d4cc31bc77311039e09"
integrity sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==

to-regex-range@^5.0.1:
version "5.0.1"
resolved "https://registry.npmmirror.com/to-regex-range/-/to-regex-range-5.0.1.tgz#1648c44aae7c8d988a326018ed72f5b4dd0392e4"
integrity sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==
dependencies:
is-number "^7.0.0"

typescript@^4.8.2:
version "4.9.3"
resolved "https://registry.npmmirror.com/typescript/-/typescript-4.9.3.tgz#3aea307c1746b8c384435d8ac36b8a2e580d85db"
Expand Down

0 comments on commit 3143e14

Please sign in to comment.