File tree Expand file tree Collapse file tree 6 files changed +37
-26
lines changed Expand file tree Collapse file tree 6 files changed +37
-26
lines changed Original file line number Diff line number Diff line change @@ -89,29 +89,33 @@ DEBUG=yuque-hexo.* yuque-hexo sync
89
89
90
90
1 . 语雀同步过来的文章会生成两部分文件;
91
91
92
- - yuque.json: 从语雀 API 拉取的数据
93
- - source/_ posts/yuque/* .md: 生成的 md 文件
92
+ - yuque.json: 从语雀 API 拉取的数据
93
+ - source/_ posts/yuque/* .md: 生成的 md 文件
94
94
95
95
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: 前端
101
96
102
- ---
103
- ```
97
+ - 语雀编辑器示例,可参考[ 原文] ( https://www.yuque.com/u46795/blog/dlloc7 )
104
98
105
- - 标准 markdown 示例:
99
+ ![ image.png ] ( https://cdn.nlark.com/yuque/0/2019/png/155457/1547033073596-797e3d68-fac4-40fd-8e8d-16ea1da4b705.png )
106
100
107
- ```markdown
108
- date: 2015-04-18 00:00:00
109
- tags: [css]
110
- categories: CSS
111
- ---
112
- ```
101
+ 语雀编辑器转换成的markdown 如下(已做兼容):
113
102
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
+ > 注意:分割线不能少,兼容一个或多个属性的自定义
115
119
116
120
# Example
117
121
@@ -131,3 +135,7 @@ https://github.com/x-cold/blog/blob/master/package.json
131
135
### v1.3.1
132
136
133
137
- 修复 front-matter 处理格式问题
138
+
139
+ ### v1.4.0
140
+
141
+ - 升级项目架构,增强扩展性,支持自定义 adpter
Original file line number Diff line number Diff line change 1
1
'use strict' ;
2
2
3
3
const Command = require ( 'common-bin' ) ;
4
+ const initConfig = require ( '../config' ) ; // 初始化 config
4
5
const cleaner = require ( '../lib/cleaner' ) ;
5
6
const out = require ( '../lib/out' ) ;
6
7
@@ -11,6 +12,9 @@ class CleanCommand extends Command {
11
12
}
12
13
13
14
async run ( ) {
15
+ if ( ! initConfig ) {
16
+ process . exit ( 0 ) ;
17
+ }
14
18
cleaner . cleanPosts ( ) ;
15
19
cleaner . clearCache ( ) ;
16
20
out . info ( 'yuque-hexo clean done!' ) ;
Original file line number Diff line number Diff line change 1
1
'use strict' ;
2
2
3
3
const Command = require ( 'common-bin' ) ;
4
- const config = require ( '../config' ) ;
4
+ const initConfig = require ( '../config' ) ; // 初始化 config
5
5
const cleaner = require ( '../lib/cleaner' ) ;
6
6
const Downloader = require ( '../lib/Downloader' ) ;
7
7
const out = require ( '../lib/out' ) ;
@@ -13,11 +13,15 @@ class SyncCommand extends Command {
13
13
}
14
14
15
15
async run ( ) {
16
+ if ( ! initConfig ) {
17
+ process . exit ( 0 ) ;
18
+ }
19
+
16
20
// clear previous directory.
17
21
out . info ( 'clear previous directory.' ) ;
18
22
cleaner . cleanPosts ( ) ;
19
23
// get articles from yuque or cache
20
- const downloader = new Downloader ( config ) ;
24
+ const downloader = new Downloader ( initConfig ) ;
21
25
await downloader . autoUpdate ( ) ;
22
26
out . info ( 'yuque-hexo sync done!' ) ;
23
27
}
Original file line number Diff line number Diff line change @@ -32,7 +32,7 @@ function loadConfig() {
32
32
33
33
function loadJson ( ) {
34
34
const pkgPath = path . join ( cwd , 'package.json' ) ;
35
- out . info ( `loading config: ${ pkgPath } ` ) ;
35
+ // out.info(`loading config: ${pkgPath}`);
36
36
try {
37
37
const pkg = require ( pkgPath ) ;
38
38
return pkg ;
Original file line number Diff line number Diff line change 2
2
3
3
const path = require ( 'path' ) ;
4
4
const Command = require ( 'common-bin' ) ;
5
- const initConfig = require ( './config' ) ; // 初始化 config
6
5
7
6
class MainCommand extends Command {
8
7
constructor ( rawArgv ) {
9
8
super ( rawArgv ) ;
10
9
this . usage = 'Usage: yuque-hexo <command>' ;
11
10
12
- if ( ! initConfig ) {
13
- process . exit ( 0 ) ;
14
- }
15
-
16
11
// load sub command
17
12
this . load ( path . join ( __dirname , 'command' ) ) ;
18
13
}
Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " yuque-hexo" ,
3
- "version" : " 1.4.0 " ,
3
+ "version" : " 1.4.1 " ,
4
4
"description" : " A downloader for articles from yuque" ,
5
5
"main" : " index.js" ,
6
6
"scripts" : {
You can’t perform that action at this time.
0 commit comments