Skip to content

Commit 0fc26f3

Browse files
committed
chore: remove loading pkg tips
Change-Id: I518e93a2e4c922feb5e5267876cee94d3da61a2d
1 parent 80e7192 commit 0fc26f3

File tree

6 files changed

+37
-26
lines changed

6 files changed

+37
-26
lines changed

README.md

Lines changed: 25 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -89,29 +89,33 @@ DEBUG=yuque-hexo.* yuque-hexo sync
8989

9090
1. 语雀同步过来的文章会生成两部分文件;
9191

92-
- yuque.json: 从语雀 API 拉取的数据
93-
- source/_posts/yuque/*.md: 生成的 md 文件
92+
- yuque.json: 从语雀 API 拉取的数据
93+
- source/_posts/yuque/*.md: 生成的 md 文件
9494

9595
2. 支持配置front-matter, 语雀编辑器编写示例如下:
96-
- 语雀编辑器示例,可参考[原文](https://www.yuque.com/u46795/blog/dlloc7)
97-
![image.png](https://cdn.nlark.com/yuque/0/2019/png/155457/1547033073596-797e3d68-fac4-40fd-8e8d-16ea1da4b705.png)
98-
语雀编辑器转换成的markdown 如下(已做兼容):
99-
```markdown
100-
tags: [hexo, node]<br />date: 2018-06-09<br />categories: 前端
10196

102-
---
103-
```
97+
- 语雀编辑器示例,可参考[原文](https://www.yuque.com/u46795/blog/dlloc7)
10498

105-
- 标准 markdown 示例:
99+
![image.png](https://cdn.nlark.com/yuque/0/2019/png/155457/1547033073596-797e3d68-fac4-40fd-8e8d-16ea1da4b705.png)
106100

107-
```markdown
108-
date: 2015-04-18 00:00:00
109-
tags: [css]
110-
categories: CSS
111-
---
112-
```
101+
语雀编辑器转换成的markdown 如下(已做兼容):
113102

114-
> 注意:分割线不能少,兼容一个或多个属性的自定义
103+
```markdown
104+
tags: [hexo, node]<br />date: 2018-06-09<br />categories: 前端
105+
106+
---
107+
```
108+
109+
- 标准 markdown 示例:
110+
111+
```markdown
112+
date: 2015-04-18 00:00:00
113+
tags: [css]
114+
categories: CSS
115+
---
116+
```
117+
118+
> 注意:分割线不能少,兼容一个或多个属性的自定义
115119
116120
# Example
117121

@@ -131,3 +135,7 @@ https://github.com/x-cold/blog/blob/master/package.json
131135
### v1.3.1
132136

133137
- 修复 front-matter 处理格式问题
138+
139+
### v1.4.0
140+
141+
- 升级项目架构,增强扩展性,支持自定义 adpter

command/clean.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
'use strict';
22

33
const Command = require('common-bin');
4+
const initConfig = require('../config'); // 初始化 config
45
const cleaner = require('../lib/cleaner');
56
const out = require('../lib/out');
67

@@ -11,6 +12,9 @@ class CleanCommand extends Command {
1112
}
1213

1314
async run() {
15+
if (!initConfig) {
16+
process.exit(0);
17+
}
1418
cleaner.cleanPosts();
1519
cleaner.clearCache();
1620
out.info('yuque-hexo clean done!');

command/sync.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
'use strict';
22

33
const Command = require('common-bin');
4-
const config = require('../config');
4+
const initConfig = require('../config'); // 初始化 config
55
const cleaner = require('../lib/cleaner');
66
const Downloader = require('../lib/Downloader');
77
const out = require('../lib/out');
@@ -13,11 +13,15 @@ class SyncCommand extends Command {
1313
}
1414

1515
async run() {
16+
if (!initConfig) {
17+
process.exit(0);
18+
}
19+
1620
// clear previous directory.
1721
out.info('clear previous directory.');
1822
cleaner.cleanPosts();
1923
// get articles from yuque or cache
20-
const downloader = new Downloader(config);
24+
const downloader = new Downloader(initConfig);
2125
await downloader.autoUpdate();
2226
out.info('yuque-hexo sync done!');
2327
}

config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ function loadConfig() {
3232

3333
function loadJson() {
3434
const pkgPath = path.join(cwd, 'package.json');
35-
out.info(`loading config: ${pkgPath}`);
35+
// out.info(`loading config: ${pkgPath}`);
3636
try {
3737
const pkg = require(pkgPath);
3838
return pkg;

index.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,12 @@
22

33
const path = require('path');
44
const Command = require('common-bin');
5-
const initConfig = require('./config'); // 初始化 config
65

76
class MainCommand extends Command {
87
constructor(rawArgv) {
98
super(rawArgv);
109
this.usage = 'Usage: yuque-hexo <command>';
1110

12-
if (!initConfig) {
13-
process.exit(0);
14-
}
15-
1611
// load sub command
1712
this.load(path.join(__dirname, 'command'));
1813
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "yuque-hexo",
3-
"version": "1.4.0",
3+
"version": "1.4.1",
44
"description": "A downloader for articles from yuque",
55
"main": "index.js",
66
"scripts": {

0 commit comments

Comments
 (0)