Skip to content

Commit

Permalink
fix script
Browse files Browse the repository at this point in the history
  • Loading branch information
qwqcode committed Dec 19, 2023
1 parent 21c3128 commit bb5d43b
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 17 deletions.
8 changes: 0 additions & 8 deletions docs/docs/.gitignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,2 @@
# VitePress
.vitepress/dist/**
.vitepress/cache/**

# Landing page
public/landing/
public/index.html

# Swagger output
public/http-api.html
13 changes: 7 additions & 6 deletions docs/docs/.vitepress/theme/Artalk.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
<template>
<ClientOnly>
<div ref="el" style="margin-top: 20px;"></div>
</ClientOnly>
<div ref="el" style="margin-top: 20px;"></div>
</template>

<script setup lang="ts">
Expand All @@ -17,10 +15,12 @@ const page = useData().page
let artalk: Artalk
onMounted(() => {
initArtalk(getConfByPage())
nextTick(() => {
initArtalk(getConfByPage())
})
})
watch(() => router.route.data.relativePath, () => {
watch(() => router.route.path, () => {
nextTick(() => {
artalk.update(getConfByPage())
artalk.reload()
Expand All @@ -32,6 +32,7 @@ onUnmounted(() => {
})
function initArtalk(conf: any) {
// TODO: remove dynamic import after the new version released
import('artalk').then(({ default: Artalk }) => {
artalk = Artalk.init({
el: el.value,
Expand All @@ -48,7 +49,7 @@ function initArtalk(conf: any) {
function getConfByPage() {
return {
pageKey: 'https://artalk.js.org'+location.pathname,
pageKey: 'https://artalk.js.org'+router.route.path,
pageTitle: page.value.title,
server: 'https://artalk.qwqaq.com',
site: 'ArtalkDocs',
Expand Down
2 changes: 1 addition & 1 deletion docs/landing/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
},
"scripts": {
"dev": "vite",
"build": "tsc && vite build && cp -rf ./dist/* ../docs/public/",
"build": "tsc && vite build",
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
"preview": "vite preview"
},
Expand Down
1 change: 1 addition & 0 deletions docs/swagger/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
dist
2 changes: 1 addition & 1 deletion docs/swagger/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
},
"private": true,
"scripts": {
"swagger:build": "npx @redocly/cli build-docs --output ../docs/public/http-api.html",
"swagger:build": "npx @redocly/cli build-docs --output ./dist/http-api.html",
"swagger:serve": "npx @redocly/cli preview-docs"
},
"devDependencies": {
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
"private": true,
"homepage": "https://artalk.js.org",
"scripts": {
"docs:build": "pnpm -filter=docs-landing build && pnpm -r swagger:build && pnpm -r docs:build"
"docs:build": "pnpm -F=docs-landing build && pnpm -F=docs-swagger swagger:build && pnpm -F=docs docs:build && pnpm docs:patch",
"docs:patch": "cp -rf docs/{landing/dist/*,swagger/dist/*} docs/docs/.vitepress/dist"
},
"packageManager": "[email protected]"
}

0 comments on commit bb5d43b

Please sign in to comment.