Skip to content

Commit

Permalink
chore: remove loading pkg tips
Browse files Browse the repository at this point in the history
Change-Id: I518e93a2e4c922feb5e5267876cee94d3da61a2d
  • Loading branch information
x-cold committed Feb 1, 2019
1 parent 80e7192 commit 0fc26f3
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 26 deletions.
42 changes: 25 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,29 +89,33 @@ DEBUG=yuque-hexo.* yuque-hexo sync

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

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

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

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

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

```markdown
date: 2015-04-18 00:00:00
tags: [css]
categories: CSS
---
```
语雀编辑器转换成的markdown 如下(已做兼容):

> 注意:分割线不能少,兼容一个或多个属性的自定义
```markdown
tags: [hexo, node]<br />date: 2018-06-09<br />categories: 前端

---
```

- 标准 markdown 示例:

```markdown
date: 2015-04-18 00:00:00
tags: [css]
categories: CSS
---
```

> 注意:分割线不能少,兼容一个或多个属性的自定义
# Example

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

- 修复 front-matter 处理格式问题

### v1.4.0

- 升级项目架构,增强扩展性,支持自定义 adpter
4 changes: 4 additions & 0 deletions command/clean.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
'use strict';

const Command = require('common-bin');
const initConfig = require('../config'); // 初始化 config
const cleaner = require('../lib/cleaner');
const out = require('../lib/out');

Expand All @@ -11,6 +12,9 @@ class CleanCommand extends Command {
}

async run() {
if (!initConfig) {
process.exit(0);
}
cleaner.cleanPosts();
cleaner.clearCache();
out.info('yuque-hexo clean done!');
Expand Down
8 changes: 6 additions & 2 deletions command/sync.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict';

const Command = require('common-bin');
const config = require('../config');
const initConfig = require('../config'); // 初始化 config
const cleaner = require('../lib/cleaner');
const Downloader = require('../lib/Downloader');
const out = require('../lib/out');
Expand All @@ -13,11 +13,15 @@ class SyncCommand extends Command {
}

async run() {
if (!initConfig) {
process.exit(0);
}

// clear previous directory.
out.info('clear previous directory.');
cleaner.cleanPosts();
// get articles from yuque or cache
const downloader = new Downloader(config);
const downloader = new Downloader(initConfig);
await downloader.autoUpdate();
out.info('yuque-hexo sync done!');
}
Expand Down
2 changes: 1 addition & 1 deletion config.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ function loadConfig() {

function loadJson() {
const pkgPath = path.join(cwd, 'package.json');
out.info(`loading config: ${pkgPath}`);
// out.info(`loading config: ${pkgPath}`);
try {
const pkg = require(pkgPath);
return pkg;
Expand Down
5 changes: 0 additions & 5 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,12 @@

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

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

if (!initConfig) {
process.exit(0);
}

// load sub command
this.load(path.join(__dirname, 'command'));
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "yuque-hexo",
"version": "1.4.0",
"version": "1.4.1",
"description": "A downloader for articles from yuque",
"main": "index.js",
"scripts": {
Expand Down

0 comments on commit 0fc26f3

Please sign in to comment.