-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
188 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import glob from 'fast-glob'; | ||
import { readFileSync } from 'fs'; | ||
import { resolve } from 'path'; | ||
|
||
type Item = { | ||
text: string; | ||
items?: Item[]; | ||
link?: string; | ||
}; | ||
|
||
const handleSidebars = () => { | ||
const file = glob.sync('*.json', { | ||
cwd: resolve(__dirname, '..', 'router', 'pages'), | ||
absolute: true, | ||
objectMode: true, | ||
}); | ||
|
||
let sidebars = {}; | ||
|
||
file.forEach((i) => { | ||
const content = JSON.parse(readFileSync(i.path, 'utf-8')); | ||
const newContent = Object.fromEntries( | ||
Object.keys(content).map((i) => { | ||
return [i, content[i].map((item: Item) => handlePrefix(item, i))]; | ||
}), | ||
); | ||
sidebars = Object.assign(sidebars, newContent); | ||
}); | ||
|
||
return sidebars; | ||
}; | ||
|
||
const handlePrefix = (item: Item, key: string) => { | ||
if (item.items && item.items.length > 0) { | ||
return { | ||
...item, | ||
items: item.items.map((child) => handlePrefix(child, key)), | ||
}; | ||
} | ||
|
||
return { | ||
...item, | ||
link: `${key}${item.link}`, | ||
}; | ||
}; | ||
|
||
export const sidebar = handleSidebars(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
[ | ||
{ | ||
"text": "首页", | ||
"link": "/" | ||
}, | ||
{ | ||
"text": "指南", | ||
"link": "/guide/getting-started", | ||
"activeMatch": "/guide/" | ||
}, | ||
{ | ||
"text": "组件", | ||
"link": "/components/button", | ||
"activeMatch": "/components/" | ||
}, | ||
{ | ||
"text": "GitHub", | ||
"link": "https://github.com/SuperCuteXiaoSi/xiaosiCommitLib" | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"/components/": [ | ||
{ | ||
"text": "组件", | ||
"items": [ | ||
{ | ||
"text": "Button", | ||
"link": "button" | ||
} | ||
] | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"/guide/": [ | ||
{ | ||
"text": "入门", | ||
"collapsible": true, | ||
"items": [ | ||
{ | ||
"text": "介绍", | ||
"link": "introduce" | ||
}, | ||
{ | ||
"text": "开始", | ||
"link": "getting-started" | ||
} | ||
] | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
@use './vars.css'; | ||
@use './code'; | ||
@use './transition'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,3 +7,11 @@ | |
button/basic | ||
|
||
::: | ||
|
||
|
||
```vue | ||
<template> | ||
<IButton>超级简单的按钮实例</IButton> | ||
</template> | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# 开始 | ||
|
||
## 开发环境 | ||
|
||
首先得有 node,并确保 node 版本是 v16 或以上。 | ||
|
||
``` sh | ||
node -v | ||
# v16+ | ||
``` | ||
|
||
## 代码拉取 | ||
``` sh | ||
# (https or ssh) | ||
git clone https://github.com/jsxiaosi/xiaosiCommitLib.git | ||
|
||
git clone git@github.com:jsxiaosi/xiaosiCommitLib.git | ||
``` | ||
|
||
## 使用 | ||
- 安装依赖 | ||
``` sh | ||
npm install | ||
``` | ||
|
||
### Develop | ||
- 运行文档 | ||
``` sh | ||
npm run docs:dev | ||
``` | ||
|
||
- 运行组件开发调试模板 | ||
``` sh | ||
npm run dev | ||
``` | ||
|
||
### Production | ||
- 文档 | ||
``` sh | ||
npm run docs:build | ||
``` | ||
|
||
- 组件打包 | ||
``` sh | ||
npm run build | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# 介绍 | ||
|
||
xs-components是一款为组件开发场景而生的模板,使用了最新的`Vue3` `Vite` `TypeScript` `Rollup`等主流技术开发,开箱即用的组件开发解决方案,也可用于学习参考。 | ||
|
||
## 特性 | ||
- 📦 开箱即用 内置打包组件、Hooks、Utils,可按需引入,支持TypeScript,让所有注意力都能放在文档编写和组件开发上 | ||
- ⚡️ VitePress主题 内置VitePress主题,免去写样式的烦恼,自带夜间模式,可自定义主题,你的风格由你自己定义 | ||
- 🛠️ 代码块 内置代码块解析器,参考ElementPush文档实现代码块解析器,示例和文档内容分离,让你的文档结构更加整洁 | ||
|
||
## 知识库 | ||
|
||
开始前你需要了解: | ||
- Vue3 | ||
- Vite | ||
- VitePress | ||
- Rollup |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters