@sugarat/theme 0.1.0 → 0.1.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/README.md CHANGED
@@ -27,6 +27,10 @@ pnpm build
27
27
  ## Advanced Ssage
28
28
  详细配置见文档 https://theme.sugarat.top
29
29
 
30
+ ## Known bugs and workarounds
31
+ * `zlib: unexpected end of file:` clearing the cache folder (rm -rf ~/.degit)
32
+
33
+
30
34
  ## Thanks
31
35
  从以下项目中获得了灵感&经验
32
36
  * [vuepress-reco/vuepress-theme-reco-1.x](https://github.com/vuepress-reco/vuepress-theme-reco-1.x)
package/node.js CHANGED
@@ -148,10 +148,14 @@ function clearMatterContent(content) {
148
148
  return lines.slice(second___ || 0).join("\n");
149
149
  }
150
150
  function getFileBirthTime(url) {
151
- const infoStr = (0, import_child_process.execSync)(`git log -1 --pretty="%ci" ${url}`).toString("utf-8").trim();
152
151
  let date = new Date();
153
- if (infoStr) {
154
- date = new Date(infoStr);
152
+ try {
153
+ const infoStr = (0, import_child_process.execSync)(`git log -1 --pretty="%ci" ${url}`).toString("utf-8").trim();
154
+ if (infoStr) {
155
+ date = new Date(infoStr);
156
+ }
157
+ } catch (error) {
158
+ return formatDate(date);
155
159
  }
156
160
  return formatDate(date);
157
161
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sugarat/theme",
3
- "version": "0.1.0",
4
- "description": "粥里有勺糖的博客主题,sugarat vitepress blog theme",
3
+ "version": "0.1.1",
4
+ "description": "简约风的 Vitepress 博客主题,sugarat vitepress blog theme",
5
5
  "main": "src/index.ts",
6
6
  "exports": {
7
7
  "./node": {
@@ -27,7 +27,7 @@
27
27
  ],
28
28
  "author": "sugar",
29
29
  "license": "MIT",
30
- "homepage": "https://next.sugarat.top",
30
+ "homepage": "https://theme.sugarat.top",
31
31
  "bugs": {
32
32
  "url": "https://github.com/ATQQ/sugar-blog/issues"
33
33
  },
@@ -9,7 +9,7 @@
9
9
  预计:{{ readTime }} 分钟
10
10
  </span>
11
11
  </div>
12
- <div class="meta-des" ref="$des" id="hack-article-des">
12
+ <div class="meta-des 123" ref="$des" id="hack-article-des">
13
13
  <span v-if="author">
14
14
  <el-icon><UserFilled /></el-icon>
15
15
  {{ author }}
@@ -64,6 +64,7 @@ const analyze = () => {
64
64
  if (!$des.value) {
65
65
  return
66
66
  }
67
+ document.querySelectorAll('.meta-des').forEach((v) => v.remove())
67
68
  const docDomContainer = window.document.querySelector('#VPContent')
68
69
  const imgs = docDomContainer?.querySelectorAll<HTMLImageElement>(
69
70
  '.content-container .main img'
package/src/node.ts CHANGED
@@ -124,14 +124,20 @@ export function clearMatterContent(content: string) {
124
124
  }
125
125
 
126
126
  export function getFileBirthTime(url: string) {
127
- // 参考 vitepress 中的 getGitTimestamp 实现
128
- const infoStr = execSync(`git log -1 --pretty="%ci" ${url}`)
129
- .toString('utf-8')
130
- .trim()
131
127
  let date = new Date()
132
- if (infoStr) {
133
- date = new Date(infoStr)
128
+
129
+ try {
130
+ // 参考 vitepress 中的 getGitTimestamp 实现
131
+ const infoStr = execSync(`git log -1 --pretty="%ci" ${url}`)
132
+ .toString('utf-8')
133
+ .trim()
134
+ if (infoStr) {
135
+ date = new Date(infoStr)
136
+ }
137
+ } catch (error) {
138
+ return formatDate(date)
134
139
  }
140
+
135
141
  return formatDate(date)
136
142
  }
137
143