@sugarat/create-theme 0.0.1
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/CHANGELOG.md +7 -0
- package/LICENSE +21 -0
- package/READNE.md +39 -0
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -0
- package/dist/template/README.md +29 -0
- package/dist/template/docs/.vitepress/config.ts +94 -0
- package/dist/template/docs/.vitepress/theme/assets/bg.webp +0 -0
- package/dist/template/docs/.vitepress/theme/index.ts +5 -0
- package/dist/template/docs/.vitepress/theme/style.scss +14 -0
- package/dist/template/docs/about.md +10 -0
- package/dist/template/docs/index.md +9 -0
- package/dist/template/docs/public/favicon.ico +0 -0
- package/dist/template/docs/public/logo.png +0 -0
- package/dist/template/docs/public/robots.txt +2 -0
- package/dist/template/docs/sop/quickStart.md +41 -0
- package/dist/template/package.json +23 -0
- package/package.json +25 -0
- package/public/template/README.md +29 -0
- package/public/template/docs/.vitepress/config.ts +94 -0
- package/public/template/docs/.vitepress/theme/assets/bg.webp +0 -0
- package/public/template/docs/.vitepress/theme/index.ts +5 -0
- package/public/template/docs/.vitepress/theme/style.scss +14 -0
- package/public/template/docs/about.md +10 -0
- package/public/template/docs/index.md +9 -0
- package/public/template/docs/public/favicon.ico +0 -0
- package/public/template/docs/public/logo.png +0 -0
- package/public/template/docs/public/robots.txt +2 -0
- package/public/template/docs/sop/quickStart.md +41 -0
- package/public/template/package.json +23 -0
- package/src/index.ts +34 -0
- package/tsup.config.ts +9 -0
package/CHANGELOG.md
ADDED
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2020 sugar
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/READNE.md
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# @sugarat/create-theme
|
|
2
|
+
快速创建简约风的 Vitepress 博客主题项目模板,更多细节见 https://theme.sugarat.top
|
|
3
|
+
|
|
4
|
+

|
|
5
|
+
|
|
6
|
+
## Scaffolding Your First Blog Project
|
|
7
|
+
|
|
8
|
+
With NPM:
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
$ npm create @sugarat/theme@latest
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
With Yarn:
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
$ yarn create @sugarat/theme
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
With PNPM:
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
$ pnpm create @sugarat/theme
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Then follow the prompts!
|
|
27
|
+
|
|
28
|
+
You can also directly specify the project name you want to use via additional command line options. For example, to scaffold a my-first-blog, run:
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
# npm
|
|
32
|
+
npm create @sugarat/theme@latest my-first-blog
|
|
33
|
+
|
|
34
|
+
# yarn
|
|
35
|
+
yarn create @sugarat/theme my-first-blog
|
|
36
|
+
|
|
37
|
+
# pnpm
|
|
38
|
+
pnpm create @sugarat/theme my-first-blog
|
|
39
|
+
```
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
var a=Object.create;var s=Object.defineProperty;var g=Object.getOwnPropertyDescriptor;var i=Object.getOwnPropertyNames;var f=Object.getPrototypeOf,u=Object.prototype.hasOwnProperty;var j=(o,e,c,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let l of i(e))!u.call(o,l)&&l!==c&&s(o,l,{get:()=>e[l],enumerable:!(n=g(e,l))||n.enumerable});return o};var t=(o,e,c)=>(c=o!=null?a(f(o)):{},j(e||!o||!o.__esModule?s(c,"default",{value:o,enumerable:!0}):c,o));var p=t(require("fs-extra")),r=t(require("path"));function d(o){let e=r.default.join(__dirname,"template");p.default.copy(e,o,c=>{if(c)console.error("An error occurred while copying template files:",c);else{console.log("\u{1F389} \u{1F389} created successfully!"),console.log(),console.log(`project in ${o}`),console.log();let n=`Done. Now run:
|
|
2
|
+
|
|
3
|
+
\u2460 cd ${r.default.parse(m).name}
|
|
4
|
+
\u2461 pnpm install
|
|
5
|
+
\u2462 pnpm run dev`;console.log(n)}})}console.log("Creating @sugarat/theme project...");console.log();var m=process.argv[2]||"my-blog";d(r.default.join(process.cwd(),m));
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["/* eslint-disable no-console */\nimport fs from 'fs-extra'\nimport path from 'path'\n\nfunction createThemeProject(destination) {\n const templatePath = path.join(__dirname, 'template')\n\n fs.copy(templatePath, destination, (err) => {\n if (err) {\n console.error('An error occurred while copying template files:', err)\n } else {\n console.log('🎉 🎉 created successfully!')\n console.log()\n\n console.log(`project in ${destination}`)\n\n console.log()\n\n const msg = `Done. Now run:\n\n ① cd ${path.parse(projectName).name}\n ② pnpm install\n ③ pnpm run dev`\n\n console.log(msg)\n }\n })\n}\n\nconsole.log('Creating @sugarat/theme project...')\nconsole.log()\n\nconst projectName = process.argv[2] || 'my-blog'\ncreateThemeProject(path.join(process.cwd(), projectName))\n"],"mappings":"2cACA,IAAAA,EAAe,uBACfC,EAAiB,mBAEjB,SAASC,EAAmBC,EAAa,CACvC,IAAMC,EAAe,EAAAC,QAAK,KAAK,UAAW,UAAU,EAEpD,EAAAC,QAAG,KAAKF,EAAcD,EAAcI,GAAQ,CAC1C,GAAIA,EACF,QAAQ,MAAM,kDAAmDA,CAAG,MAC/D,CACL,QAAQ,IAAI,2CAA6B,EACzC,QAAQ,IAAI,EAEZ,QAAQ,IAAI,cAAcJ,GAAa,EAEvC,QAAQ,IAAI,EAEZ,IAAMK,EAAM;AAAA;AAAA,eAER,EAAAH,QAAK,MAAMI,CAAW,EAAE;AAAA;AAAA,wBAI5B,QAAQ,IAAID,CAAG,CACjB,CACF,CAAC,CACH,CAEA,QAAQ,IAAI,oCAAoC,EAChD,QAAQ,IAAI,EAEZ,IAAMC,EAAc,QAAQ,KAAK,IAAM,UACvCP,EAAmB,EAAAG,QAAK,KAAK,QAAQ,IAAI,EAAGI,CAAW,CAAC","names":["import_fs_extra","import_path","createThemeProject","destination","templatePath","path","fs","err","msg","projectName"]}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# vitepress @sugarat/theme
|
|
2
|
+
简约风的 [Vitepress 博客主题](https://theme.sugarat.top)
|
|
3
|
+
|
|
4
|
+
## Usage
|
|
5
|
+
先安装 `pnpm`
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
npm i -g pnpm
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
安装依赖
|
|
12
|
+
```sh
|
|
13
|
+
pnpm install
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
开发启动
|
|
17
|
+
```sh
|
|
18
|
+
pnpm dev
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
构建
|
|
22
|
+
```sh
|
|
23
|
+
pnpm build
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
预览产物
|
|
27
|
+
```sh
|
|
28
|
+
pnpm serve
|
|
29
|
+
```
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { getThemeConfig, defineConfig } from '@sugarat/theme/node'
|
|
2
|
+
|
|
3
|
+
// 主题独有配置
|
|
4
|
+
// 详见文档: https://theme.sugarat.top/
|
|
5
|
+
const blogTheme = getThemeConfig({
|
|
6
|
+
// 文章默认作者
|
|
7
|
+
author: '粥里有勺糖',
|
|
8
|
+
// 友链
|
|
9
|
+
friend: [
|
|
10
|
+
{
|
|
11
|
+
nickname: '粥里有勺糖',
|
|
12
|
+
des: '你的指尖用于改变世界的力量',
|
|
13
|
+
avatar:
|
|
14
|
+
'https://img.cdn.sugarat.top/mdImg/MTY3NDk5NTE2NzAzMA==674995167030',
|
|
15
|
+
url: 'https://sugarat.top'
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
nickname: 'Vitepress',
|
|
19
|
+
des: 'Vite & Vue Powered Static Site Generator',
|
|
20
|
+
avatar:
|
|
21
|
+
'https://img.cdn.sugarat.top/mdImg/MTY3NDk5NTI2NzY1Ng==674995267656',
|
|
22
|
+
url: 'https://vitepress.vuejs.org/'
|
|
23
|
+
}
|
|
24
|
+
],
|
|
25
|
+
recommend: {
|
|
26
|
+
showSelf: true
|
|
27
|
+
},
|
|
28
|
+
// 开启离线的全文搜索支持(如构建报错可注释下面的配置再次尝试)
|
|
29
|
+
search: 'pagefind',
|
|
30
|
+
popover: {
|
|
31
|
+
title: '公告',
|
|
32
|
+
body: [
|
|
33
|
+
{
|
|
34
|
+
type: 'text',
|
|
35
|
+
content: 'QQ交流群:681489336 🎉🎉'
|
|
36
|
+
},
|
|
37
|
+
{ type: 'text', content: '👇公众号👇---👇 微信 👇' },
|
|
38
|
+
{
|
|
39
|
+
type: 'image',
|
|
40
|
+
src: 'https://img.cdn.sugarat.top/mdImg/MTYxNTAxODc2NTIxMA==615018765210'
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
type: 'text',
|
|
44
|
+
content: '欢迎大家加群&私信交流'
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
type: 'button',
|
|
48
|
+
content: '博客',
|
|
49
|
+
link: 'https://sugarat.top'
|
|
50
|
+
}
|
|
51
|
+
],
|
|
52
|
+
duration: 0
|
|
53
|
+
}
|
|
54
|
+
})
|
|
55
|
+
|
|
56
|
+
// Vitepress 默认配置
|
|
57
|
+
// 详见文档:https://vitepress.dev/reference/site-config
|
|
58
|
+
export default defineConfig({
|
|
59
|
+
extends: blogTheme,
|
|
60
|
+
lang: 'zh-cn',
|
|
61
|
+
title: '@sugarat/theme',
|
|
62
|
+
description: '粥里有勺糖的博客主题,基于 vitepress 实现',
|
|
63
|
+
vite: {
|
|
64
|
+
optimizeDeps: {
|
|
65
|
+
include: ['element-plus'],
|
|
66
|
+
exclude: ['@sugarat/theme']
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
lastUpdated: true,
|
|
70
|
+
themeConfig: {
|
|
71
|
+
lastUpdatedText: '上次更新于',
|
|
72
|
+
footer: {
|
|
73
|
+
message: '自定义底部内容',
|
|
74
|
+
copyright:
|
|
75
|
+
'MIT Licensed | <a target="_blank" href="https://theme.sugarat.top/"> @sugarat/theme </a>'
|
|
76
|
+
},
|
|
77
|
+
logo: '/logo.png',
|
|
78
|
+
// editLink: {
|
|
79
|
+
// pattern:
|
|
80
|
+
// 'https://github.com/ATQQ/sugar-blog/tree/master/packages/blogpress/:path',
|
|
81
|
+
// text: '去 GitHub 上编辑内容'
|
|
82
|
+
// },
|
|
83
|
+
nav: [
|
|
84
|
+
{ text: '首页', link: '/' },
|
|
85
|
+
{ text: '关于作者', link: 'https://sugarat.top/aboutme.html' }
|
|
86
|
+
],
|
|
87
|
+
socialLinks: [
|
|
88
|
+
{
|
|
89
|
+
icon: 'github',
|
|
90
|
+
link: 'https://github.com/ATQQ/sugar-blog/tree/master/packages/theme'
|
|
91
|
+
}
|
|
92
|
+
]
|
|
93
|
+
}
|
|
94
|
+
})
|
|
Binary file
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
.VPHome {
|
|
2
|
+
// 自定义首页背景图
|
|
3
|
+
&::before {
|
|
4
|
+
// 图片来源:https://zhuanlan.zhihu.com/p/54060187
|
|
5
|
+
background-image: url(./assets/bg.webp);
|
|
6
|
+
background-size: cover;
|
|
7
|
+
}
|
|
8
|
+
// 定义遮罩样式
|
|
9
|
+
background: radial-gradient(
|
|
10
|
+
ellipse,
|
|
11
|
+
rgba(var(--bg-gradient-home), 1) 0%,
|
|
12
|
+
rgba(var(--bg-gradient-home), 0) 150%
|
|
13
|
+
);
|
|
14
|
+
}
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
---
|
|
2
|
+
sticky: 999
|
|
3
|
+
description: 1分钟内完成自己的博客创建
|
|
4
|
+
tag:
|
|
5
|
+
- SOP
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# 快速上手
|
|
9
|
+
1分钟内完成自己的博客创建
|
|
10
|
+
|
|
11
|
+
## 初始化项目
|
|
12
|
+
① 拉取 Github 模板
|
|
13
|
+
```sh
|
|
14
|
+
npx degit ATQQ/sugar-blog/packages/template my-blog-demo
|
|
15
|
+
```
|
|
16
|
+
```sh
|
|
17
|
+
cd my-blog-demo
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
② 安装依赖
|
|
21
|
+
::: code-group
|
|
22
|
+
|
|
23
|
+
```sh [pnpm]
|
|
24
|
+
pnpm install
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
```sh [安装 PNPM]
|
|
28
|
+
# 如果你没有 PNPM 请先安装
|
|
29
|
+
npm i -g pnpm
|
|
30
|
+
```
|
|
31
|
+
:::
|
|
32
|
+
|
|
33
|
+
③ 开发启动
|
|
34
|
+
```sh
|
|
35
|
+
pnpm dev
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
④ 构建产物
|
|
39
|
+
```sh
|
|
40
|
+
pnpm build
|
|
41
|
+
```
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "vitepress-blog",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"private": true,
|
|
5
|
+
"scripts": {
|
|
6
|
+
"dev": "vitepress dev docs",
|
|
7
|
+
"build": "vitepress build docs",
|
|
8
|
+
"serve": "vitepress serve docs"
|
|
9
|
+
},
|
|
10
|
+
"dependencies": {
|
|
11
|
+
"@element-plus/icons-vue": "^2.1.0",
|
|
12
|
+
"@sugarat/theme": "^0.1.34",
|
|
13
|
+
"element-plus": "^2.3.4",
|
|
14
|
+
"vue": "^3.2.47"
|
|
15
|
+
},
|
|
16
|
+
"devDependencies": {
|
|
17
|
+
"sass": "^1.59.2",
|
|
18
|
+
"typescript": "^4.9.5",
|
|
19
|
+
"vitepress": "1.0.0-beta.5"
|
|
20
|
+
},
|
|
21
|
+
"author": "粥里有勺糖",
|
|
22
|
+
"license": "MIT"
|
|
23
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@sugarat/create-theme",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"bin": {
|
|
5
|
+
"create-theme": "./dist/index.js"
|
|
6
|
+
},
|
|
7
|
+
"keywords": [
|
|
8
|
+
"blog",
|
|
9
|
+
"vitepress",
|
|
10
|
+
"vitepress-blog",
|
|
11
|
+
"vitepress-theme"
|
|
12
|
+
],
|
|
13
|
+
"author": "粥里有勺糖",
|
|
14
|
+
"license": "MIT",
|
|
15
|
+
"devDependencies": {
|
|
16
|
+
"tsup": " ^6.5.0"
|
|
17
|
+
},
|
|
18
|
+
"dependencies": {
|
|
19
|
+
"fs-extra": "^11.1.1"
|
|
20
|
+
},
|
|
21
|
+
"scripts": {
|
|
22
|
+
"dev": "tsup --watch --publicDir",
|
|
23
|
+
"build": "tsup --minify --publicDir"
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# vitepress @sugarat/theme
|
|
2
|
+
简约风的 [Vitepress 博客主题](https://theme.sugarat.top)
|
|
3
|
+
|
|
4
|
+
## Usage
|
|
5
|
+
先安装 `pnpm`
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
npm i -g pnpm
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
安装依赖
|
|
12
|
+
```sh
|
|
13
|
+
pnpm install
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
开发启动
|
|
17
|
+
```sh
|
|
18
|
+
pnpm dev
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
构建
|
|
22
|
+
```sh
|
|
23
|
+
pnpm build
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
预览产物
|
|
27
|
+
```sh
|
|
28
|
+
pnpm serve
|
|
29
|
+
```
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { getThemeConfig, defineConfig } from '@sugarat/theme/node'
|
|
2
|
+
|
|
3
|
+
// 主题独有配置
|
|
4
|
+
// 详见文档: https://theme.sugarat.top/
|
|
5
|
+
const blogTheme = getThemeConfig({
|
|
6
|
+
// 文章默认作者
|
|
7
|
+
author: '粥里有勺糖',
|
|
8
|
+
// 友链
|
|
9
|
+
friend: [
|
|
10
|
+
{
|
|
11
|
+
nickname: '粥里有勺糖',
|
|
12
|
+
des: '你的指尖用于改变世界的力量',
|
|
13
|
+
avatar:
|
|
14
|
+
'https://img.cdn.sugarat.top/mdImg/MTY3NDk5NTE2NzAzMA==674995167030',
|
|
15
|
+
url: 'https://sugarat.top'
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
nickname: 'Vitepress',
|
|
19
|
+
des: 'Vite & Vue Powered Static Site Generator',
|
|
20
|
+
avatar:
|
|
21
|
+
'https://img.cdn.sugarat.top/mdImg/MTY3NDk5NTI2NzY1Ng==674995267656',
|
|
22
|
+
url: 'https://vitepress.vuejs.org/'
|
|
23
|
+
}
|
|
24
|
+
],
|
|
25
|
+
recommend: {
|
|
26
|
+
showSelf: true
|
|
27
|
+
},
|
|
28
|
+
// 开启离线的全文搜索支持(如构建报错可注释下面的配置再次尝试)
|
|
29
|
+
search: 'pagefind',
|
|
30
|
+
popover: {
|
|
31
|
+
title: '公告',
|
|
32
|
+
body: [
|
|
33
|
+
{
|
|
34
|
+
type: 'text',
|
|
35
|
+
content: 'QQ交流群:681489336 🎉🎉'
|
|
36
|
+
},
|
|
37
|
+
{ type: 'text', content: '👇公众号👇---👇 微信 👇' },
|
|
38
|
+
{
|
|
39
|
+
type: 'image',
|
|
40
|
+
src: 'https://img.cdn.sugarat.top/mdImg/MTYxNTAxODc2NTIxMA==615018765210'
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
type: 'text',
|
|
44
|
+
content: '欢迎大家加群&私信交流'
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
type: 'button',
|
|
48
|
+
content: '博客',
|
|
49
|
+
link: 'https://sugarat.top'
|
|
50
|
+
}
|
|
51
|
+
],
|
|
52
|
+
duration: 0
|
|
53
|
+
}
|
|
54
|
+
})
|
|
55
|
+
|
|
56
|
+
// Vitepress 默认配置
|
|
57
|
+
// 详见文档:https://vitepress.dev/reference/site-config
|
|
58
|
+
export default defineConfig({
|
|
59
|
+
extends: blogTheme,
|
|
60
|
+
lang: 'zh-cn',
|
|
61
|
+
title: '@sugarat/theme',
|
|
62
|
+
description: '粥里有勺糖的博客主题,基于 vitepress 实现',
|
|
63
|
+
vite: {
|
|
64
|
+
optimizeDeps: {
|
|
65
|
+
include: ['element-plus'],
|
|
66
|
+
exclude: ['@sugarat/theme']
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
lastUpdated: true,
|
|
70
|
+
themeConfig: {
|
|
71
|
+
lastUpdatedText: '上次更新于',
|
|
72
|
+
footer: {
|
|
73
|
+
message: '自定义底部内容',
|
|
74
|
+
copyright:
|
|
75
|
+
'MIT Licensed | <a target="_blank" href="https://theme.sugarat.top/"> @sugarat/theme </a>'
|
|
76
|
+
},
|
|
77
|
+
logo: '/logo.png',
|
|
78
|
+
// editLink: {
|
|
79
|
+
// pattern:
|
|
80
|
+
// 'https://github.com/ATQQ/sugar-blog/tree/master/packages/blogpress/:path',
|
|
81
|
+
// text: '去 GitHub 上编辑内容'
|
|
82
|
+
// },
|
|
83
|
+
nav: [
|
|
84
|
+
{ text: '首页', link: '/' },
|
|
85
|
+
{ text: '关于作者', link: 'https://sugarat.top/aboutme.html' }
|
|
86
|
+
],
|
|
87
|
+
socialLinks: [
|
|
88
|
+
{
|
|
89
|
+
icon: 'github',
|
|
90
|
+
link: 'https://github.com/ATQQ/sugar-blog/tree/master/packages/theme'
|
|
91
|
+
}
|
|
92
|
+
]
|
|
93
|
+
}
|
|
94
|
+
})
|
|
Binary file
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
.VPHome {
|
|
2
|
+
// 自定义首页背景图
|
|
3
|
+
&::before {
|
|
4
|
+
// 图片来源:https://zhuanlan.zhihu.com/p/54060187
|
|
5
|
+
background-image: url(./assets/bg.webp);
|
|
6
|
+
background-size: cover;
|
|
7
|
+
}
|
|
8
|
+
// 定义遮罩样式
|
|
9
|
+
background: radial-gradient(
|
|
10
|
+
ellipse,
|
|
11
|
+
rgba(var(--bg-gradient-home), 1) 0%,
|
|
12
|
+
rgba(var(--bg-gradient-home), 0) 150%
|
|
13
|
+
);
|
|
14
|
+
}
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
---
|
|
2
|
+
sticky: 999
|
|
3
|
+
description: 1分钟内完成自己的博客创建
|
|
4
|
+
tag:
|
|
5
|
+
- SOP
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# 快速上手
|
|
9
|
+
1分钟内完成自己的博客创建
|
|
10
|
+
|
|
11
|
+
## 初始化项目
|
|
12
|
+
① 拉取 Github 模板
|
|
13
|
+
```sh
|
|
14
|
+
npx degit ATQQ/sugar-blog/packages/template my-blog-demo
|
|
15
|
+
```
|
|
16
|
+
```sh
|
|
17
|
+
cd my-blog-demo
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
② 安装依赖
|
|
21
|
+
::: code-group
|
|
22
|
+
|
|
23
|
+
```sh [pnpm]
|
|
24
|
+
pnpm install
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
```sh [安装 PNPM]
|
|
28
|
+
# 如果你没有 PNPM 请先安装
|
|
29
|
+
npm i -g pnpm
|
|
30
|
+
```
|
|
31
|
+
:::
|
|
32
|
+
|
|
33
|
+
③ 开发启动
|
|
34
|
+
```sh
|
|
35
|
+
pnpm dev
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
④ 构建产物
|
|
39
|
+
```sh
|
|
40
|
+
pnpm build
|
|
41
|
+
```
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "vitepress-blog",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"private": true,
|
|
5
|
+
"scripts": {
|
|
6
|
+
"dev": "vitepress dev docs",
|
|
7
|
+
"build": "vitepress build docs",
|
|
8
|
+
"serve": "vitepress serve docs"
|
|
9
|
+
},
|
|
10
|
+
"dependencies": {
|
|
11
|
+
"@element-plus/icons-vue": "^2.1.0",
|
|
12
|
+
"@sugarat/theme": "^0.1.34",
|
|
13
|
+
"element-plus": "^2.3.4",
|
|
14
|
+
"vue": "^3.2.47"
|
|
15
|
+
},
|
|
16
|
+
"devDependencies": {
|
|
17
|
+
"sass": "^1.59.2",
|
|
18
|
+
"typescript": "^4.9.5",
|
|
19
|
+
"vitepress": "1.0.0-beta.5"
|
|
20
|
+
},
|
|
21
|
+
"author": "粥里有勺糖",
|
|
22
|
+
"license": "MIT"
|
|
23
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/* eslint-disable no-console */
|
|
2
|
+
import fs from 'fs-extra'
|
|
3
|
+
import path from 'path'
|
|
4
|
+
|
|
5
|
+
function createThemeProject(destination) {
|
|
6
|
+
const templatePath = path.join(__dirname, 'template')
|
|
7
|
+
|
|
8
|
+
fs.copy(templatePath, destination, (err) => {
|
|
9
|
+
if (err) {
|
|
10
|
+
console.error('An error occurred while copying template files:', err)
|
|
11
|
+
} else {
|
|
12
|
+
console.log('🎉 🎉 created successfully!')
|
|
13
|
+
console.log()
|
|
14
|
+
|
|
15
|
+
console.log(`project in ${destination}`)
|
|
16
|
+
|
|
17
|
+
console.log()
|
|
18
|
+
|
|
19
|
+
const msg = `Done. Now run:
|
|
20
|
+
|
|
21
|
+
① cd ${path.parse(projectName).name}
|
|
22
|
+
② pnpm install
|
|
23
|
+
③ pnpm run dev`
|
|
24
|
+
|
|
25
|
+
console.log(msg)
|
|
26
|
+
}
|
|
27
|
+
})
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
console.log('Creating @sugarat/theme project...')
|
|
31
|
+
console.log()
|
|
32
|
+
|
|
33
|
+
const projectName = process.argv[2] || 'my-blog'
|
|
34
|
+
createThemeProject(path.join(process.cwd(), projectName))
|