@sugarat/create-theme 0.0.27 → 0.0.29

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 CHANGED
@@ -26,7 +26,7 @@ $ pnpm create @sugarat/theme
26
26
  With Bun:
27
27
 
28
28
  ```bash
29
- $ bunx @sugarat/create-theme --bun
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
- bunx @sugarat/create-theme my-first-blog --bun
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 h=Object.create;var f=Object.defineProperty;var w=Object.getOwnPropertyDescriptor;var v=Object.getOwnPropertyNames;var y=Object.getPrototypeOf,_=Object.prototype.hasOwnProperty;var N=(o,n,e,a)=>{if(n&&typeof n=="object"||typeof n=="function")for(let c of v(n))!_.call(o,c)&&c!==e&&f(o,c,{get:()=>n[c],enumerable:!(a=w(n,c))||a.enumerable});return o};var u=(o,n,e)=>(e=o!=null?h(y(o)):{},N(n||!o||!o.__esModule?f(e,"default",{value:o,enumerable:!0}):e,o));var j=(o,n,e)=>new Promise((a,c)=>{var r=l=>{try{m(e.next(l))}catch(p){c(p)}},s=l=>{try{m(e.throw(l))}catch(p){c(p)}},m=l=>l.done?a(l.value):Promise.resolve(l.value).then(r,s);m((e=e.apply(o,n)).next())});var t=u(require("path")),b=u(require("process")),g=u(require("fs-extra"));var $=b.default.argv.slice(2),k=$.filter(o=>o.startsWith("--")),d=$.filter(o=>!o.startsWith("--")),F=d[d.length-1]||"my-blog",i=k.includes("--bun");function O(o){let n=t.default.join(__dirname,"template");g.default.copy(n,o,e=>j(this,null,function*(){yield g.default.copy(t.default.join(__dirname,"move/gitignore"),t.default.join(o,".gitignore"));let a=i?"bunfig.toml":"npmrc",c=i?"bunfig.toml":".npmrc";if(yield g.default.copy(t.default.join(__dirname,`move/${a}`),t.default.join(o,c)),i){let r=t.default.join(o,"package.json"),s=yield g.default.readJSON(r);s.scripts.build=`NODE_ENV=production ${s.scripts.build}`,yield g.default.writeJSON(r,s,{spaces:2})}if(e)console.error("An error occurred while copying template files:",e);else{console.log("\u{1F389} \u{1F389} created successfully!"),console.log(),console.log(`project in ${o}`),console.log();let r=i?"bun":"pnpm",s=`Done. Now run:
3
-
4
- \u2460 cd ${t.default.parse(o).name}
5
- \u2461 ${r} install
6
- \u2462 ${r} run ${i?"--bun ":""}dev
7
- \u2463 ${r} run ${i?"--bun ":""}build
8
- \u2464 ${r} run ${i?"--bun ":""}serve`;console.log(s)}}))}console.log("Creating @sugarat/theme project...");console.log();O(t.default.join(b.default.cwd(),F));
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
+ 效果如下,详见 [个人作品展示](./../work.md)
175
+
176
+ ![](https://img.cdn.sugarat.top/mdImg/MTY4NzA4ODczMzkwNg==687088733906)
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
- 主题还提供了许多开箱即用的能力,项见文档 https://theme.sugarat.top
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;">bunx</span><span style="color:#E1E4E8;"> </span><span style="color:#9ECBFF;">@sugarat/create-theme</span><span style="color:#E1E4E8;"> </span><span style="color:#79B8FF;">--bun</span></span>
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
- bunx @sugarat/create-theme --bun
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
- bunx @sugarat/create-theme my-first-blog --bun
77
+ bun create @sugarat/theme my-first-blog
78
78
  ```
79
79
  :::
80
80
 
@@ -43,7 +43,7 @@ export default BlogTheme
43
43
  );
44
44
  }
45
45
  ```
46
- 解除注释后,就能看到模板首页背景图发生了变化
46
+ 解除文件`index.ts` 中`import './style.scss'` 注释后,就能看到模板首页背景图发生了变化
47
47
 
48
48
  ![](https://img.cdn.sugarat.top/mdImg/MTY3Njk5MTAzODkzOQ==676991038939)
49
49
 
@@ -11,7 +11,7 @@
11
11
  },
12
12
  "dependencies": {
13
13
  "@element-plus/icons-vue": "^2.1.0",
14
- "@sugarat/theme": "^0.2.7",
14
+ "@sugarat/theme": "^0.2.9",
15
15
  "element-plus": "^2.3.8",
16
16
  "vue": "^3.3.4"
17
17
  },
@@ -21,6 +21,6 @@
21
21
  "devDependencies": {
22
22
  "sass": "^1.64.1",
23
23
  "typescript": "^5.1.6",
24
- "vitepress": "1.0.0-rc.24"
24
+ "vitepress": "1.0.0-rc.32"
25
25
  }
26
26
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sugarat/create-theme",
3
- "version": "0.0.27",
3
+ "version": "0.0.29",
4
4
  "description": "简约风的 Vitepress 博客主题,sugarat vitepress blog theme",
5
5
  "author": "粥里有勺糖",
6
6
  "license": "MIT",