重新组织项目文件目录结构,在仓库中可以直接查看文档中的图片

This commit is contained in:
孟宁
2025-11-16 06:29:10 +00:00
parent ff69c668c1
commit 6b3638c71a
57 changed files with 193 additions and 259 deletions

View File

@@ -1,25 +1,25 @@
{
"name": "dev-vitepress",
"image": "node:20-alpine",
"customizations": {
"vscode": {
"settings": {},
"extensions": [
"vue.volar",
"vue.vscode-typescript-vue-plugin",
"bradlc.vscode-tailwindcss",
"esbenp.prettier-vscode"
]
}
},
"portsAttributes": {
"5173": {
"label": "vitepress debug",
"onAutoForward": "notify"
}
},
"postCreateCommand": "apk add git && npm install && npm add -D vitepress",
"postAttachCommand": "npm run docs:dev"
{
"name": "dev-vitepress",
"image": "node:20-alpine",
"customizations": {
"vscode": {
"settings": {},
"extensions": [
"vue.volar",
"vue.vscode-typescript-vue-plugin",
"bradlc.vscode-tailwindcss",
"esbenp.prettier-vscode"
]
}
},
"portsAttributes": {
"5173": {
"label": "vitepress debug",
"onAutoForward": "notify"
}
},
"postCreateCommand": "apk add git && npm install && npm add -D vitepress",
"postAttachCommand": "npm run dev"
}

View File

@@ -1,53 +1,53 @@
name: CI/CD Pipeline for mengning.com.cn
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
container:
image: gitea/runner-images:ubuntu-latest
steps:
- name: 拉取代码
uses: https://devstar.cn/actions/checkout@v4
with:
fetch-depth: 0
- name: 安装依赖
working-directory:
run: |
npm install
npm add -D vitepress
- name: 构建项目
working-directory:
run: |
chmod +x node_modules/.bin/vitepress
npm run docs:build
- name: 构建 Docker 镜像
run: |
docker build -t devstar-docs:${{ gitea.sha }} .
- name: 登录 Docker Registry 并推送镜像
run: |
echo "${{ secrets.DOCKER_REGISTRY_PASSWORD }}" | docker login -u ${{ secrets.DOCKER_REGISTRY_USERNAME }} ${{ vars.DOCKER_REGISTRY_ADDRESS }} --password-stdin
docker tag devstar-docs:${{ gitea.sha }} ${{ vars.DOCKER_REGISTRY_ADDRESS }}/devstar/devstar-studio-docs:${{ gitea.sha }}
docker tag devstar-docs:${{ gitea.sha }} ${{ vars.DOCKER_REGISTRY_ADDRESS }}/devstar/devstar-studio-docs:latest
docker push ${{ vars.DOCKER_REGISTRY_ADDRESS }}/devstar/devstar-studio-docs:${{ gitea.sha }}
docker push ${{ vars.DOCKER_REGISTRY_ADDRESS }}/devstar/devstar-studio-docs:latest
- name: 📝 Update mengning.com.cn
run: |
curl -LO https://mirrors.ustc.edu.cn/kubernetes/core%3A/stable%3A/v1.28/deb/amd64/kubectl_1.28.0-1.1_amd64.deb
sudo dpkg -i kubectl_1.28.0-1.1_amd64.deb
kubectl config set-cluster remote-cluster --server=${{ secrets.K8S_URL }} --insecure-skip-tls-verify=true
kubectl config set-credentials token-user --token=${{ secrets.K8S_TOKEN }}
kubectl config set-context remote-context --cluster=remote-cluster --user=token-user
kubectl config use-context remote-context
name: CI/CD Pipeline for mengning.com.cn
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
container:
image: gitea/runner-images:ubuntu-latest
steps:
- name: 拉取代码
uses: https://devstar.cn/actions/checkout@v4
with:
fetch-depth: 0
- name: 安装依赖
working-directory:
run: |
npm install
npm add -D vitepress
- name: 构建项目
working-directory:
run: |
chmod +x node_modules/.bin/vitepress
npm run build
- name: 构建 Docker 镜像
run: |
docker build -t devstar-docs:${{ gitea.sha }} .
- name: 登录 Docker Registry 并推送镜像
run: |
echo "${{ secrets.DOCKER_REGISTRY_PASSWORD }}" | docker login -u ${{ secrets.DOCKER_REGISTRY_USERNAME }} ${{ vars.DOCKER_REGISTRY_ADDRESS }} --password-stdin
docker tag devstar-docs:${{ gitea.sha }} ${{ vars.DOCKER_REGISTRY_ADDRESS }}/devstar/devstar-studio-docs:${{ gitea.sha }}
docker tag devstar-docs:${{ gitea.sha }} ${{ vars.DOCKER_REGISTRY_ADDRESS }}/devstar/devstar-studio-docs:latest
docker push ${{ vars.DOCKER_REGISTRY_ADDRESS }}/devstar/devstar-studio-docs:${{ gitea.sha }}
docker push ${{ vars.DOCKER_REGISTRY_ADDRESS }}/devstar/devstar-studio-docs:latest
- name: 📝 Update mengning.com.cn
run: |
curl -LO https://mirrors.ustc.edu.cn/kubernetes/core%3A/stable%3A/v1.28/deb/amd64/kubectl_1.28.0-1.1_amd64.deb
sudo dpkg -i kubectl_1.28.0-1.1_amd64.deb
kubectl config set-cluster remote-cluster --server=${{ secrets.K8S_URL }} --insecure-skip-tls-verify=true
kubectl config set-credentials token-user --token=${{ secrets.K8S_TOKEN }}
kubectl config set-context remote-context --cluster=remote-cluster --user=token-user
kubectl config use-context remote-context
kubectl set image deployment/devstar-docs-app devstar-docs=${{ vars.DOCKER_REGISTRY_ADDRESS }}/devstar/devstar-studio-docs:latest -n app

32
.gitignore vendored
View File

@@ -1,17 +1,17 @@
# VitePress
docs/.vitepress/dist/
docs/.vitepress/cache/
docs/.vitepress/.temp/
# Node.js
node_modules/
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# Environment
.env
.env.local
.env.development.local
.env.test.local
# VitePress
.vitepress/dist/
.vitepress/cache/
.vitepress/.temp/
# Node.js
node_modules/
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# Environment
.env
.env.local
.env.development.local
.env.test.local
.env.production.local

View File

@@ -1,6 +1,5 @@
import { defineConfig } from 'vitepress'
import type { DefaultTheme } from 'vitepress'
import { set_sidebar } from "../utils/auto_sidebar.js";
// https://vitepress.dev/reference/site-config
export default defineConfig({
@@ -18,18 +17,18 @@ export default defineConfig({
src: '/mnsoftware.png',
},
nav: [
// { text: '文档', link: '/document/index' },
// { text: '文档', link: '/src/document/index' },
//
{ text: 'DevStar', link: '/devstar' },
{ text: '编译加速', link: '/compile' },
{ text: '虚拟仿真', link: '/simulator' },
{ text: 'Enterprise', link: '/enterprise' },
{ text: 'DevStar', link: '/src/devstar' },
{ text: '编译加速', link: '/src/compile' },
{ text: '虚拟仿真', link: '/src/simulator' },
{ text: 'Enterprise', link: '/src/enterprise' },
],
sidebar: {
'/devstar/': sidebarDevStar(), // 直接返回 SidebarItem[]
'/compile/': sidebarCompiling(),
'/simulator/': sidebarSimulator(),
'/enterprise/': sidebarEnterprise()
'/src/devstar/': sidebarDevStar(), // 直接返回 SidebarItem[]
'/src/compile/': sidebarCompiling(),
'/src/simulator/': sidebarSimulator(),
'/src/enterprise/': sidebarEnterprise()
},
socialLinks: [
{ icon: 'github', link: ' https://github.com/mengning/DevStar' }
@@ -70,11 +69,11 @@ function sidebarDevStar(): DefaultTheme.SidebarItem[] {
return [
{
text: 'DevStar Studio',
link: '/devstar/index',
link: '/src/devstar/index',
collapsible: true, // 使整个组可折叠
collapsed: false, // 默认展开
items: [
{ text: 'AI+ DevOps', link: '/devstar/ai-devops' },
{ text: 'AI+ DevOps', link: '/src/devstar/ai-devops' },
]
} as any,
{
@@ -84,8 +83,8 @@ function sidebarDevStar(): DefaultTheme.SidebarItem[] {
items: [
{ text: '对比Gitea与其它Git托管工具', link: 'https://docs.gitea.com/zh-cn/installation/comparison' },
{ text: '数据库准备', link: 'https://docs.gitea.com/zh-cn/installation/database-prep' },
// { text: '数据库准备', link: '/document/installation/from-source' },
{ text: '使用shell脚本安装', link: '/devstar/installation/install-via-shell-script' },
// { text: '数据库准备', link: '/src/document/installation/from-source' },
{ text: '使用shell脚本安装', link: '/src/devstar/installation/install-via-shell-script' },
{ text: '使用二进制文件安装', link: 'https://docs.gitea.com/zh-cn/installation/install-from-binary' },
{ text: '包管理器安装', link: 'https://docs.gitea.com/zh-cn/installation/install-from-package' },
{ text: '使用源代码安装', link: 'https://docs.gitea.com/zh-cn/installation/install-from-source' },
@@ -239,19 +238,19 @@ function sidebarSimulator(): DefaultTheme.SidebarItem[] {
return [
{
text: '虚拟仿真技术',
link: '/simulator/index',
link: '/src/simulator/index',
items: [
]
},
{
text: '虚拟ECU',
link: '/simulator/vECU',
link: '/src/simulator/vECU',
items: [
]
} as any,
{
text: '整车系统级软硬件联合仿真',
link: '/simulator/vehicle-simulator',
link: '/src/simulator/vehicle-simulator',
items: []
},
]
@@ -261,7 +260,7 @@ function sidebarCompiling(): DefaultTheme.SidebarItem[] {
return [
{
text: '编译加速',
link: '/compile/index',
link: '/src/compile/index',
items: [
]
@@ -273,15 +272,15 @@ function sidebarCompiling(): DefaultTheme.SidebarItem[] {
items: [
{
text: '为什么需要分布式编译?',
link: '/compile/why-distributed-compiling'
link: '/src/compile/why-distributed-compiling'
},
{
text: 'CloudBuild',
link: '/compile/cloudbuild'
link: '/src/compile/cloudbuild'
},
{
text: 'ShareBuild',
link: '/compile/sharebuild'
link: '/src/compile/sharebuild'
},
]
} as any,
@@ -292,15 +291,15 @@ function sidebarCompiling(): DefaultTheme.SidebarItem[] {
items: [
{
text: 'AI Compiler简介',
link: '/compile/why-distributed-compiling'
link: '/src/compile/why-distributed-compiling'
},
{
text: 'CloudBuild',
link: '/compile/cloudbuild'
link: '/src/compile/cloudbuild'
},
{
text: 'ShareBuild',
link: '/compile/sharebuild'
link: '/src/compile/sharebuild'
},
]
} as any,
@@ -311,15 +310,15 @@ function sidebarCompiling(): DefaultTheme.SidebarItem[] {
items: [
{
text: 'PGO/LTO简介',
link: '/compile/why-distributed-compiling'
link: '/src/compile/why-distributed-compiling'
},
{
text: 'CloudBuild',
link: '/compile/cloudbuild'
link: '/src/compile/cloudbuild'
},
{
text: 'ShareBuild',
link: '/compile/sharebuild'
link: '/src/compile/sharebuild'
},
]
},
@@ -330,14 +329,14 @@ function sidebarEnterprise(): DefaultTheme.SidebarItem[] {
return [
{
text: 'DevStar Enterprise',
link: '/enterprise/index',
link: '/src/enterprise/index',
items: [
]
},
{
text: '常见问题FAQ',
link: '/enterprise/faq',
link: '/src/enterprise/faq',
items: []
},
]

View File

@@ -1,21 +1,21 @@
# 第一阶段node镜像打包
FROM node:20-alpine AS frontend-builder
WORKDIR /build-app
COPY . .
RUN npm install
RUN npm add -D vitepress
RUN npm run docs:build
# 第二阶段nginx打包
FROM nginx:1.25-alpine
EXPOSE 80
WORKDIR /app
# 替换nginx配置
COPY nginx.conf /etc/nginx/conf.d/default.conf
# 将第一阶段的静态文件复制到nginx中
RUN rm -rf /usr/share/nginx/html
RUN mkdir /usr/share/nginx/html
COPY --from=frontend-builder /build-app/docs/.vitepress/dist /usr/share/nginx/html
# 运行
CMD ["nginx", "-g", "daemon off;"]
# 第一阶段node镜像打包
FROM node:20-alpine AS frontend-builder
WORKDIR /build-app
COPY . .
RUN npm install
RUN npm add -D vitepress
RUN npm run build
# 第二阶段nginx打包
FROM nginx:1.25-alpine
EXPOSE 80
WORKDIR /app
# 替换nginx配置
COPY nginx.conf /etc/nginx/conf.d/default.conf
# 将第一阶段的静态文件复制到nginx中
RUN rm -rf /usr/share/nginx/html
RUN mkdir /usr/share/nginx/html
COPY --from=frontend-builder /build-app/.vitepress/dist /usr/share/nginx/html
# 运行
CMD ["nginx", "-g", "daemon off;"]

View File

@@ -1,31 +1,31 @@
# 梦宁软件官网及DevStar文档
## 配置开发环境
```md
npm install
npm add -D vitepress
```
## 如何启动调试项目
```md
npm run docs:dev
```
## 如何打包项目
```md
npm run docs:build
```
## 如何预览打包的项目
```md
npm run docs:preview
```
## 如何添加或修改侧边栏
在docs/.vitepress/config.mts中的sidebar进行修改对于不同路径下的侧边栏分别使用不同函数得到text为侧边栏的描述内容link为点击侧边栏后加载的内容的链接如果有子目录在items进行修改
link链接的内容既可以是网页链接也可以是本地文档
## 如何自定义网站样式
在docs/.vitepress/theme/style.css中自定义网站样式
## 如何添加或修改导航栏
在docs/.vitepress/config.mts中的nav进行修改
# 梦宁软件官网及DevStar文档
## 配置开发环境
```md
npm install
npm add -D vitepress
```
## 如何启动调试项目
```md
npm run dev
```
## 如何打包项目
```md
npm run build
```
## 如何预览打包的项目
```md
npm run preview
```
## 如何添加或修改侧边栏
在docs/.vitepress/config.mts中的sidebar进行修改对于不同路径下的侧边栏分别使用不同函数得到text为侧边栏的描述内容link为点击侧边栏后加载的内容的链接如果有子目录在items进行修改
link链接的内容既可以是网页链接也可以是本地文档
## 如何自定义网站样式
在docs/.vitepress/theme/style.css中自定义网站样式
## 如何添加或修改导航栏
在docs/.vitepress/config.mts中的nav进行修改

View File

@@ -1,65 +0,0 @@
import path from "node:path";
import fs from "node:fs";
const DIR_PATH = path.resolve("docs");
const WHITE_LIST = ["index.md", ".vitepress", "node_modules", ".idea", "assets", "public"];
const isDirectory = (path) => fs.lstatSync(path).isDirectory();
const intersections = (arr1, arr2) =>
Array.from(new Set(arr1.filter((item) => !new Set(arr2).has(item))));
// 新增:按文件系统原始顺序排序
const keepOriginalOrder = (files, dirPath) => {
return files
.map(file => ({
name: file,
time: fs.statSync(path.join(dirPath, file)).birthtimeMs // 获取创建时间戳
}))
.sort((a, b) => a.time - b.time) // 按创建时间排序
.map(item => item.name);
};
function getList(params, path1, pathname) {
const res = [];
// 修改点1使用 keepOriginalOrder 保持原始顺序
const orderedParams = keepOriginalOrder(params, path1);
for (let file of orderedParams) { // 修改点2改用 for...of 遍历
const dir = path.join(path1, file);
const isDir = isDirectory(dir);
if (isDir) {
const files = fs.readdirSync(dir);
res.push({
text: file,
collapsible: true,
items: getList(files, dir, `${pathname}/${file}`),
});
} else {
const suffix = path.extname(file);
if (suffix !== ".md") continue;
const name = path.basename(file, '.md');
res.push({
text: name,
link: `${pathname}/${name}`,
});
}
}
// 修改点3完全移除 sort() 调用
return res;
}
export const set_sidebar = (pathname) => {
try {
const dirPath = path.join(DIR_PATH, pathname);
const files = fs.readdirSync(dirPath);
const items = intersections(files, WHITE_LIST);
return getList(items, dirPath, pathname);
} catch (error) {
console.error(`Error generating sidebar for ${pathname}:`, error);
return [];
}
};

View File

@@ -30,7 +30,7 @@ hero:
# details: 安装和使用体验良好的详细描述
---
<script setup>
import Index from './index.vue' // 你的组件
import Index from './src/index.vue' // 你的组件
</script>
<Index/>

View File

@@ -1,14 +1,14 @@
{
"devDependencies": {
"vitepress": "^1.6.4"
},
"scripts": {
"docs:dev": "vitepress dev docs",
"docs:build": "vitepress build docs",
"docs:preview": "vitepress preview docs"
},
"dependencies": {
"@vitejs/plugin-vue": "^6.0.1",
"prismjs": "^1.30.0"
}
}
{
"devDependencies": {
"vitepress": "^1.6.4"
},
"scripts": {
"dev": "vitepress dev",
"build": "vitepress build",
"preview": "vitepress preview"
},
"dependencies": {
"@vitejs/plugin-vue": "^6.0.1",
"prismjs": "^1.30.0"
}
}

View File

Before

Width:  |  Height:  |  Size: 68 KiB

After

Width:  |  Height:  |  Size: 68 KiB

View File

Before

Width:  |  Height:  |  Size: 27 KiB

After

Width:  |  Height:  |  Size: 27 KiB

View File

Before

Width:  |  Height:  |  Size: 27 KiB

After

Width:  |  Height:  |  Size: 27 KiB

View File

Before

Width:  |  Height:  |  Size: 35 KiB

After

Width:  |  Height:  |  Size: 35 KiB

View File

Before

Width:  |  Height:  |  Size: 30 KiB

After

Width:  |  Height:  |  Size: 30 KiB

View File

Before

Width:  |  Height:  |  Size: 51 KiB

After

Width:  |  Height:  |  Size: 51 KiB

View File

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 24 KiB

View File

Before

Width:  |  Height:  |  Size: 35 KiB

After

Width:  |  Height:  |  Size: 35 KiB

View File

Before

Width:  |  Height:  |  Size: 91 KiB

After

Width:  |  Height:  |  Size: 91 KiB

View File

Before

Width:  |  Height:  |  Size: 151 KiB

After

Width:  |  Height:  |  Size: 151 KiB

View File

Before

Width:  |  Height:  |  Size: 164 KiB

After

Width:  |  Height:  |  Size: 164 KiB

View File

Before

Width:  |  Height:  |  Size: 233 KiB

After

Width:  |  Height:  |  Size: 233 KiB

View File

Before

Width:  |  Height:  |  Size: 39 KiB

After

Width:  |  Height:  |  Size: 39 KiB

View File

Before

Width:  |  Height:  |  Size: 34 KiB

After

Width:  |  Height:  |  Size: 34 KiB

View File

Before

Width:  |  Height:  |  Size: 26 KiB

After

Width:  |  Height:  |  Size: 26 KiB

View File

Before

Width:  |  Height:  |  Size: 1.8 MiB

After

Width:  |  Height:  |  Size: 1.8 MiB

View File

Before

Width:  |  Height:  |  Size: 556 KiB

After

Width:  |  Height:  |  Size: 556 KiB

View File

Before

Width:  |  Height:  |  Size: 1.9 MiB

After

Width:  |  Height:  |  Size: 1.9 MiB

View File

Before

Width:  |  Height:  |  Size: 2.0 MiB

After

Width:  |  Height:  |  Size: 2.0 MiB

View File

Before

Width:  |  Height:  |  Size: 51 KiB

After

Width:  |  Height:  |  Size: 51 KiB

View File

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 10 KiB

View File

Before

Width:  |  Height:  |  Size: 41 KiB

After

Width:  |  Height:  |  Size: 41 KiB

View File

Before

Width:  |  Height:  |  Size: 164 KiB

After

Width:  |  Height:  |  Size: 164 KiB

View File

Before

Width:  |  Height:  |  Size: 510 KiB

After

Width:  |  Height:  |  Size: 510 KiB

View File

Before

Width:  |  Height:  |  Size: 126 KiB

After

Width:  |  Height:  |  Size: 126 KiB

View File

Before

Width:  |  Height:  |  Size: 941 KiB

After

Width:  |  Height:  |  Size: 941 KiB

View File

Before

Width:  |  Height:  |  Size: 756 KiB

After

Width:  |  Height:  |  Size: 756 KiB

View File

Before

Width:  |  Height:  |  Size: 2.5 MiB

After

Width:  |  Height:  |  Size: 2.5 MiB

View File

Before

Width:  |  Height:  |  Size: 1.4 MiB

After

Width:  |  Height:  |  Size: 1.4 MiB

View File

Before

Width:  |  Height:  |  Size: 156 KiB

After

Width:  |  Height:  |  Size: 156 KiB

View File

@@ -47,6 +47,6 @@ DevStar Enterprise 与 Gitea 项目的版本号不同但相互对应:
## 问题反馈
大多数问题已在 [FAQ](/enterprise/faq) 中解答,如需进一步帮助请联系:
大多数问题已在 [FAQ](/src/enterprise/faq) 中解答,如需进一步帮助请联系:
**邮箱**: [contact@mengning.com.cn](mailto:contact@mengning.com.cn)

View File

@@ -47,6 +47,6 @@ DevStar Enterprise 与 Gitea 项目的版本号不同但相互对应:
## 问题反馈
大多数问题已在 [FAQ](/enterprise/faq) 中解答,如需进一步帮助请联系:
大多数问题已在 [FAQ](/src/enterprise/faq) 中解答,如需进一步帮助请联系:
**邮箱**: [contact@mengning.com.cn](mailto:contact@mengning.com.cn)

View File

@@ -3,7 +3,7 @@
<div class="ten_main">
<div class="ten_links">
<a
href="/devstar/ai-devops"
href="/src/devstar/ai-devops"
class="ten_img"
@mouseenter="hoverItem = 'about'"
@mouseleave="hoverItem = null"
@@ -20,7 +20,7 @@
</a>
<a
href="/compile"
href="/src/compile"
class="ten_img"
@mouseenter="hoverItem = 'culture'"
@mouseleave="hoverItem = null"
@@ -37,7 +37,7 @@
</a>
<a
href="/simulator"
href="/src/simulator"
class="ten_img"
@mouseenter="hoverItem = 'office'"
@mouseleave="hoverItem = null"
@@ -90,7 +90,7 @@
<p>
<a href="https://beian.miit.gov.cn/" target="_blank" rel="noopener noreferrer">苏ICP备2024068144号-1</a>
©
<a href="/copyright" rel="noopener noreferrer">Mengning Software</a>.
<a href="/src/copyright" rel="noopener noreferrer">Mengning Software</a>.
2025- All rights reserved.
</p>
</div>