@sugarat/create-theme 0.0.28 → 0.0.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/index.js +7 -7
- package/dist/template/docs/.vitepress/config.mts +5 -0
- package/dist/template/docs/about.md +2 -2
- package/dist/template/docs/sop/component.md +119 -0
- package/dist/template/docs/sop/more.md +1 -1
- package/dist/template/docs/sop/quickStart.md +3 -3
- package/dist/template/docs/sop/style.md +1 -1
- package/dist/template/package.json +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -26,7 +26,7 @@ $ pnpm create @sugarat/theme
|
|
|
26
26
|
With Bun:
|
|
27
27
|
|
|
28
28
|
```bash
|
|
29
|
-
$
|
|
29
|
+
$ bun create @sugarat/theme
|
|
30
30
|
```
|
|
31
31
|
|
|
32
32
|
Then follow the prompts!
|
|
@@ -44,5 +44,5 @@ yarn create @sugarat/theme my-first-blog
|
|
|
44
44
|
pnpm create @sugarat/theme my-first-blog
|
|
45
45
|
|
|
46
46
|
# bun
|
|
47
|
-
|
|
47
|
+
bun create @sugarat/theme my-first-blog
|
|
48
48
|
```
|
package/dist/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
\u2460 cd ${
|
|
5
|
-
\u2461 ${
|
|
6
|
-
\u2462 ${
|
|
7
|
-
\u2463 ${
|
|
8
|
-
\u2464 ${
|
|
2
|
+
var k=Object.create;var j=Object.defineProperty;var v=Object.getOwnPropertyDescriptor;var h=Object.getOwnPropertyNames;var w=Object.getPrototypeOf,y=Object.prototype.hasOwnProperty;var N=(o,e,n,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of h(e))!y.call(o,r)&&r!==n&&j(o,r,{get:()=>e[r],enumerable:!(s=v(e,r))||s.enumerable});return o};var d=(o,e,n)=>(n=o!=null?k(w(o)):{},N(e||!o||!o.__esModule?j(n,"default",{value:o,enumerable:!0}):n,o));var b=(o,e,n)=>new Promise((s,r)=>{var i=t=>{try{u(n.next(t))}catch(f){r(f)}},g=t=>{try{u(n.throw(t))}catch(f){r(f)}},u=t=>t.done?s(t.value):Promise.resolve(t.value).then(i,g);u((n=n.apply(o,e)).next())});var c=d(require("path")),m=d(require("process")),p=d(require("fs-extra"));var S=m.default.argv.slice(2),$=S.filter(o=>!o.startsWith("--")),F=$[$.length-1]||"my-blog",_=O(m.default.env.npm_config_user_agent),a=_?_.name:"npm",l=a==="bun";function O(o){if(!o)return;let n=o.split(" ")[0].split("/");return{name:n[0],version:n[1]}}function P(o){let e=c.default.join(__dirname,"template");p.default.copy(e,o,n=>b(this,null,function*(){yield p.default.copy(c.default.join(__dirname,"move/gitignore"),c.default.join(o,".gitignore"));let s=l?"bunfig.toml":"npmrc",r=l?"bunfig.toml":".npmrc";if(yield p.default.copy(c.default.join(__dirname,`move/${s}`),c.default.join(o,r)),l){let i=c.default.join(o,"package.json"),g=yield p.default.readJSON(i);g.scripts.build=`NODE_ENV=production ${g.scripts.build}`,yield p.default.writeJSON(i,g,{spaces:2})}if(n)console.error("An error occurred while copying template files:",n);else{console.log("\u{1F389} \u{1F389} created successfully!"),console.log(),console.log(`project in ${o}`),console.log();let i=`Done. Now run:
|
|
3
|
+
|
|
4
|
+
\u2460 cd ${c.default.parse(o).name}
|
|
5
|
+
\u2461 ${a} install
|
|
6
|
+
\u2462 ${a} run ${l?"--bun ":""}dev
|
|
7
|
+
\u2463 ${a} run ${l?"--bun ":""}build
|
|
8
|
+
\u2464 ${a} run ${l?"--bun ":""}serve`;console.log(i)}}))}console.log("Creating @sugarat/theme project...");console.log();P(c.default.join(m.default.cwd(),F));
|
|
@@ -12,6 +12,11 @@ export default defineConfig({
|
|
|
12
12
|
title: '@sugarat/theme',
|
|
13
13
|
description: '粥里有勺糖的博客主题,基于 vitepress 实现',
|
|
14
14
|
lastUpdated: true,
|
|
15
|
+
// 详见:https://vitepress.dev/reference/site-config#head
|
|
16
|
+
head: [
|
|
17
|
+
// 配置网站的图标(显示在浏览器的 tab 上)
|
|
18
|
+
['link', { rel: 'icon', href: '/favicon.ico' }]
|
|
19
|
+
],
|
|
15
20
|
themeConfig: {
|
|
16
21
|
lastUpdatedText: '上次更新于',
|
|
17
22
|
logo: '/logo.png',
|
|
@@ -29,13 +29,12 @@ sticky: 1
|
|
|
29
29
|
* 流程图([vitepress-plugin-mermaid](https://github.com/emersonbottero/vitepress-plugin-mermaid#readme))
|
|
30
30
|
* RSS
|
|
31
31
|
* 主题色统一
|
|
32
|
+
* 更多可定制的主题样式
|
|
32
33
|
|
|
33
34
|
## 规划中功能
|
|
34
35
|
* Valine 评论系统
|
|
35
36
|
* 文章合集(类似于聚合一个内容专题)
|
|
36
|
-
* 更多可定制的主题样式
|
|
37
37
|
* 文章时间线页面支持
|
|
38
|
-
* 博客案例集合
|
|
39
38
|
* 背景图自动更换
|
|
40
39
|
* 首屏铺满slogan,参考reco
|
|
41
40
|
|
|
@@ -51,6 +50,7 @@ sticky: 1
|
|
|
51
50
|
* [charles7c.github.io](https://github.com/Charles7c/charles7c.github.io)
|
|
52
51
|
* [vitepress-blog-zaun](https://github.com/clark-cui/vitepress-blog-zaun)
|
|
53
52
|
* [vuejs/blog](https://github.com/vuejs/blog/tree/main)
|
|
53
|
+
* [列表无限滚动轮播效果](https://code.juejin.cn/pen/7145007064350195748)
|
|
54
54
|
|
|
55
55
|
## 主题相关资源
|
|
56
56
|
* 主题地址:https://theme.sugarat.top/
|
|
@@ -9,6 +9,13 @@ description: 默认支持流程图,tabs面板
|
|
|
9
9
|
|
|
10
10
|
支持局部的`tabs`面板,**默认开启**
|
|
11
11
|
|
|
12
|
+
:::details 我之前手动安装配置了怎么办?
|
|
13
|
+
① package.json 中移除 vitepress-plugin-tabs 依赖
|
|
14
|
+
|
|
15
|
+
② .vitepress/theme/index.ts 中移除注册的组件`enhanceAppWithTabs`
|
|
16
|
+
|
|
17
|
+
③ (可选)`getThemeConfig` 中移除配置项`tabs`
|
|
18
|
+
:::
|
|
12
19
|
:::tip 一点说明
|
|
13
20
|
基于 [vitepress-plugin-tabs@0.2.0](https://www.npmjs.com/package/vitepress-plugin-tabs) 内置实现
|
|
14
21
|
:::
|
|
@@ -158,3 +165,115 @@ gantt
|
|
|
158
165
|
Parallel 3 : des5, after des3, 1d
|
|
159
166
|
Parallel 4 : des6, after des4, 1d
|
|
160
167
|
```
|
|
168
|
+
|
|
169
|
+
## UserWorksPage
|
|
170
|
+
* Type: `UserWorks`
|
|
171
|
+
|
|
172
|
+
用于作品列表展示
|
|
173
|
+
|
|
174
|
+
效果如下,详见 [个人作品展示](https://theme.sugarat.top/work.html)
|
|
175
|
+
|
|
176
|
+

|
|
177
|
+
|
|
178
|
+
新建一个`works.md`文件,放入以下内容
|
|
179
|
+
|
|
180
|
+
```md
|
|
181
|
+
---
|
|
182
|
+
layout: page
|
|
183
|
+
title: 个人作品展示
|
|
184
|
+
sidebar: false
|
|
185
|
+
outline: [2,3]
|
|
186
|
+
sticky: 1
|
|
187
|
+
---
|
|
188
|
+
<UserWorksPage />
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
内容配置方式如下
|
|
192
|
+
|
|
193
|
+
::: code-group
|
|
194
|
+
|
|
195
|
+
```ts [default]
|
|
196
|
+
const blogTheme = getThemeConfig({
|
|
197
|
+
works: {
|
|
198
|
+
title: '个人项目/线上作品',
|
|
199
|
+
description: '记录开发的点点滴滴',
|
|
200
|
+
topTitle: '举些🌰',
|
|
201
|
+
list: [
|
|
202
|
+
{
|
|
203
|
+
title: '博客主题 @sugarat/theme',
|
|
204
|
+
description: '基于 vitepress 实现的博客主题',
|
|
205
|
+
time: {
|
|
206
|
+
start: '2023/01/29'
|
|
207
|
+
},
|
|
208
|
+
github: {
|
|
209
|
+
owner: 'ATQQ',
|
|
210
|
+
repo: 'sugar-blog',
|
|
211
|
+
branch: 'master',
|
|
212
|
+
path: 'packages/theme'
|
|
213
|
+
},
|
|
214
|
+
status: {
|
|
215
|
+
text: '自定义badge'
|
|
216
|
+
},
|
|
217
|
+
url: 'https://theme.sugarat.top',
|
|
218
|
+
cover:
|
|
219
|
+
'https://img.cdn.sugarat.top/mdImg/MTY3MzE3MDUxOTMwMw==673170519303',
|
|
220
|
+
tags: ['Vitepress', 'Vue'],
|
|
221
|
+
links: [
|
|
222
|
+
{
|
|
223
|
+
title: '一个简约风的VitePress博客主题',
|
|
224
|
+
url: 'https://juejin.cn/post/7196517835380293693'
|
|
225
|
+
}
|
|
226
|
+
]
|
|
227
|
+
}
|
|
228
|
+
]
|
|
229
|
+
}
|
|
230
|
+
})
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
```ts [type]
|
|
234
|
+
interface UserWorks {
|
|
235
|
+
title: string
|
|
236
|
+
description?: string
|
|
237
|
+
topTitle?: string
|
|
238
|
+
list: UserWork[]
|
|
239
|
+
}
|
|
240
|
+
interface UserWork {
|
|
241
|
+
title: string
|
|
242
|
+
description: string
|
|
243
|
+
time:
|
|
244
|
+
| string
|
|
245
|
+
| {
|
|
246
|
+
start: string
|
|
247
|
+
end?: string
|
|
248
|
+
lastupdate?: string
|
|
249
|
+
}
|
|
250
|
+
status?: {
|
|
251
|
+
text: string
|
|
252
|
+
type?: 'tip' | 'warning' | 'danger'
|
|
253
|
+
}
|
|
254
|
+
url?: string
|
|
255
|
+
github?:
|
|
256
|
+
| string
|
|
257
|
+
| {
|
|
258
|
+
owner: string
|
|
259
|
+
repo: string
|
|
260
|
+
branch?: string
|
|
261
|
+
path?: string
|
|
262
|
+
}
|
|
263
|
+
cover?:
|
|
264
|
+
| string
|
|
265
|
+
| string[]
|
|
266
|
+
| {
|
|
267
|
+
urls: string[]
|
|
268
|
+
layout?: 'swiper' | 'list'
|
|
269
|
+
}
|
|
270
|
+
links?: {
|
|
271
|
+
title: string
|
|
272
|
+
url: string
|
|
273
|
+
}[]
|
|
274
|
+
tags?: string[]
|
|
275
|
+
top?: number
|
|
276
|
+
}
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
:::
|
|
@@ -3,7 +3,7 @@ top: 3
|
|
|
3
3
|
---
|
|
4
4
|
# 更多能力
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
主题还提供了许多开箱即用的能力,详见文档 https://theme.sugarat.top
|
|
7
7
|
|
|
8
8
|
* [主题配置:首页&文章](https://theme.sugarat.top/config/frontmatter.html) - 主题提供的一些 `frontmatter`
|
|
9
9
|
* [主题配置:全局](https://theme.sugarat.top/config/global.html) - 主题提供的额外能力
|
|
@@ -7,7 +7,7 @@ descriptionHTML: '
|
|
|
7
7
|
<span class="line"><span style="color:#FFCB6B;">npm</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">create</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">@sugarat/theme@latest</span></span>
|
|
8
8
|
<br/>
|
|
9
9
|
<br/>
|
|
10
|
-
<span class="line"><span style="color:#B392F0;">
|
|
10
|
+
<span class="line"><span style="color:#B392F0;">bun create</span><span style="color:#E1E4E8;"> </span><span style="color:#9ECBFF;">@sugarat/theme</span><span style="color:#E1E4E8;"> </span></span>
|
|
11
11
|
</code>
|
|
12
12
|
</pre>'
|
|
13
13
|
tag:
|
|
@@ -50,7 +50,7 @@ yarn create @sugarat/theme
|
|
|
50
50
|
pnpm create @sugarat/theme
|
|
51
51
|
```
|
|
52
52
|
```sh [bun]
|
|
53
|
-
|
|
53
|
+
bun create @sugarat/theme
|
|
54
54
|
```
|
|
55
55
|
:::
|
|
56
56
|
|
|
@@ -74,7 +74,7 @@ yarn create @sugarat/theme my-first-blog
|
|
|
74
74
|
pnpm create @sugarat/theme my-first-blog
|
|
75
75
|
```
|
|
76
76
|
```sh [bun]
|
|
77
|
-
|
|
77
|
+
bun create @sugarat/theme my-first-blog
|
|
78
78
|
```
|
|
79
79
|
:::
|
|
80
80
|
|