@sugarat/create-theme 0.0.46 → 0.0.48

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.
@@ -0,0 +1,95 @@
1
+ name: Deploy Pages
2
+
3
+ # 触发条件,push到main分支或者pull request到main分支
4
+ on:
5
+ push:
6
+ branches: [main]
7
+ pull_request:
8
+ branches: [main]
9
+
10
+ # 支持手动在工作流上触发
11
+ workflow_dispatch:
12
+
13
+ # 设置时区
14
+ env:
15
+ TZ: Asia/Shanghai
16
+
17
+ # 权限设置
18
+ permissions:
19
+ # 允许读取仓库内容的权限。
20
+ contents: read
21
+ # 允许写入 GitHub Pages 的权限。
22
+ pages: write
23
+ # 允许写入 id-token 的权限。
24
+ id-token: write
25
+
26
+ # 并发控制配置
27
+ concurrency:
28
+ group: pages
29
+ cancel-in-progress: false
30
+
31
+ # 定义执行任务
32
+ jobs:
33
+ # 构建任务
34
+ build:
35
+
36
+ runs-on: ubuntu-latest
37
+
38
+ # node v20 运行
39
+ strategy:
40
+ matrix:
41
+ node-version: [20]
42
+
43
+ steps:
44
+ # 拉取代码
45
+ - name: Checkout
46
+ uses: actions/checkout@v3
47
+ with:
48
+ # 保留 Git 信息
49
+ fetch-depth: 0
50
+
51
+ # 设置使用 Node.js 版本
52
+ - name: Use Node.js ${{ matrix.node-version }}
53
+ uses: actions/setup-node@v3
54
+ with:
55
+ node-version: ${{ matrix.node-version }}
56
+
57
+ # 使用 PNPM V8
58
+ - uses: pnpm/action-setup@v2
59
+ name: Install pnpm
60
+ with:
61
+ version: 8
62
+ run_install: false
63
+
64
+ # 安装依赖
65
+ - name: Install dependencies
66
+ run: pnpm install --frozen-lockfile
67
+
68
+ # 构建项目
69
+ - name: Build blog project
70
+ run: |
71
+ echo ${{ github.workspace }}
72
+ pnpm build
73
+
74
+ # 资源拷贝
75
+ - name: Build with Jekyll
76
+ uses: actions/jekyll-build-pages@v1
77
+ with:
78
+ source: ./docs/.vitepress/dist
79
+ destination: ./_site
80
+
81
+ # 上传 _site 的资源,用于后续部署
82
+ - name: Upload artifact
83
+ uses: actions/upload-pages-artifact@v3
84
+
85
+ # 部署任务
86
+ deploy:
87
+ environment:
88
+ name: github-pages
89
+ url: ${{ steps.deployment.outputs.page_url }}
90
+ runs-on: ubuntu-latest
91
+ needs: build
92
+ steps:
93
+ - name: Deploy to GitHub Pages
94
+ id: deployment
95
+ uses: actions/deploy-pages@v4
@@ -1,7 +1,15 @@
1
- # vitepress @sugarat/theme
2
- 简约风的 [Vitepress 博客主题](https://theme.sugarat.top)
1
+ <h1 align="center"> VitePress @sugarat/theme </h1>
2
+
3
+ <p align="center">
4
+ 简约风的 <a href="https://theme.sugarat.top" target="_blank"target="_blank">VitePress 博客主题</a> 示例运行项目。
5
+ </p>
6
+
7
+ <p align="center">
8
+ <a href="https://atqq.github.io/vitepress-blog-sugar-template/" target="_blank">GitHub Pages Demo</a>
9
+ </p>
3
10
 
4
11
  ## Usage
12
+
5
13
  先安装 `pnpm`
6
14
 
7
15
  ```sh
@@ -9,21 +17,67 @@ npm i -g pnpm
9
17
  ```
10
18
 
11
19
  安装依赖
20
+
12
21
  ```sh
13
22
  pnpm install
14
23
  ```
15
24
 
16
25
  开发启动
26
+
17
27
  ```sh
18
28
  pnpm dev
19
29
  ```
20
30
 
21
31
  构建
32
+
22
33
  ```sh
23
34
  pnpm build
24
35
  ```
25
36
 
26
37
  预览产物
38
+
27
39
  ```sh
28
40
  pnpm serve
29
- ```
41
+ ```
42
+
43
+ ## Github Pages 部署
44
+
45
+ ① Github Pages 开启 Git Actions 部署支持
46
+
47
+ ![](https://img.cdn.sugarat.top/mdImg/sugar/8a2454c628d0e2abcc7a0451ddd7d2dc)
48
+
49
+ ② 复制文件 `.github/workflows/deploy.yml` 到自己的项目相同目录下
50
+
51
+ 示例项目已包含,可以直接进行下一步
52
+
53
+ ③ 修改 `docs/.vitepress/config.mts` 里的构建配置
54
+
55
+ `base` 改为 `"/仓库名/"` 即可
56
+
57
+ ```ts
58
+ // 省略无关代码
59
+ const base = '/vitepress-blog-sugar-template/'
60
+ export default defineConfig({
61
+ base,
62
+ })
63
+ ```
64
+
65
+ ④ 推送 `main` 分支即可
66
+
67
+ 需要进一步修改部署和构建配置,详见`deploy.yml` 文件。
68
+
69
+ ## Gitee Pages 部署
70
+
71
+ ① 按照 [SPA](https://help.gitee.com/services/gitee-pages/spa-support) 要求添加 `.spa` 文件在`docs/public` 目录下
72
+
73
+ 示例项目已包含,可以直接进行下一步
74
+
75
+ ② 参照 `Usage` 部分构建代码
76
+
77
+ ③ 推送构建后的页面资源到部署文档的分支
78
+
79
+ 例如`gh-pages`
80
+
81
+ ④ 参照[文档](https://help.gitee.com/services/gitee-pages/intro)选择分支和目录进行部署
82
+
83
+ *Gitee Pages 需要实名才能使用,同时需要人工审核。*
@@ -27,6 +27,7 @@ const blogTheme = getThemeConfig({
27
27
 
28
28
  // 页脚
29
29
  footer: {
30
+ // message 字段支持配置为HTML内容,配置多条可以配置为数组
30
31
  // message: '下面 的内容和图标都是可以修改的噢(当然本条内容也是可以隐藏的)',
31
32
  copyright: 'MIT License | 粥里有勺糖',
32
33
  // icpRecord: {
@@ -3,11 +3,18 @@ import { defineConfig } from 'vitepress'
3
3
  // 导入主题的配置
4
4
  import { blogTheme } from './blog-theme'
5
5
 
6
+ // 如果使用 GitHub/Gitee Pages 等公共平台部署
7
+ // 通常需要修改 base 路径,通常为“/仓库名/”
8
+ // const base = process.env.GITHUB_ACTIONS === 'true'
9
+ // ? '/vitepress-blog-sugar-template/'
10
+ // : '/'
11
+
6
12
  // Vitepress 默认配置
7
13
  // 详见文档:https://vitepress.dev/reference/site-config
8
14
  export default defineConfig({
9
15
  // 继承博客主题(@sugarat/theme)
10
16
  extends: blogTheme,
17
+ // base,
11
18
  lang: 'zh-cn',
12
19
  title: '@sugarat/theme',
13
20
  description: '粥里有勺糖的博客主题,基于 vitepress 实现',
@@ -15,6 +22,7 @@ export default defineConfig({
15
22
  // 详见:https://vitepress.dev/zh/reference/site-config#head
16
23
  head: [
17
24
  // 配置网站的图标(显示在浏览器的 tab 上)
25
+ // ['link', { rel: 'icon', href: `${base}favicon.ico` }], // 修改了 base 这里也需要同步修改
18
26
  ['link', { rel: 'icon', href: '/favicon.ico' }]
19
27
  ],
20
28
  themeConfig: {
File without changes
@@ -11,9 +11,9 @@
11
11
  },
12
12
  "dependencies": {
13
13
  "@element-plus/icons-vue": "^2.3.1",
14
- "@sugarat/theme": "^0.2.24",
14
+ "@sugarat/theme": "^0.2.25",
15
15
  "element-plus": "^2.5.3",
16
- "vue": "3.4.15"
16
+ "vue": "3.4.21"
17
17
  },
18
18
  "directories": {
19
19
  "doc": "docs"
@@ -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.40"
24
+ "vitepress": "1.0.0-rc.45"
25
25
  }
26
26
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sugarat/create-theme",
3
- "version": "0.0.46",
3
+ "version": "0.0.48",
4
4
  "description": "简约风的 Vitepress 博客主题,sugarat vitepress blog theme",
5
5
  "author": "粥里有勺糖",
6
6
  "license": "MIT",