atian25 / yuque-exporter

export yuque to local markdown
MIT License
319 stars 36 forks source link

feature request: skip crawling and building when doc.published_at not changed #24

Closed yyj08070631 closed 1 year ago

yyj08070631 commented 1 year ago

solve #23

yyj08070631 commented 1 year ago

@dead-horse @atian25 大佬们帮忙看看~

alephpiece commented 1 year ago

这个 pr 加了之后为啥不能直接用 npm start 测试了?我在 Codespaces 里面试的。 报错:

> yuque-exporter@1.0.1 start
> npm run start:dev oneblog/test

> yuque-exporter@1.0.1 start:dev
> ts-node-esm -T src/main.ts oneblog/test

TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received undefined
    at new NodeError (node:internal/errors:387:5)
    at validateString (node:internal/validators:162:11)
    at Object.join (node:path:1172:7)
    at file:///workspaces/yuque-exporter/src/lib/doc.ts:15:48 {
  code: 'ERR_INVALID_ARG_TYPE'
}

解决 at file:///workspaces/yuque-exporter/src/lib/doc.ts:15:48 之后,再用 npm start 还是不能把 docs 下载下来。下面是报错信息最后的内容。

✔ Crawling repo detail: https://www.yuque.com/oneblog/test
ℹ Stop crawling, nothing new

ℹ Start building... 
✔ storage/test
✔ storage/test/Blog
[Error: ENOENT: no such file or directory, open 'storage/.meta/oneblog/test/docs/xxxxxxxxxxxxxxxx.json'] {
  errno: -2,
  code: 'ENOENT',
  syscall: 'open',
  path: 'storage/.meta/oneblog/test/docs/xxxxxxxxxxxxxxxx.json'
}

这个 pr 的 feature 怎么绕过?我现在只知道回退到上个 commit 能行。

DesistDaydream commented 1 year ago

为什么要合并这个 PR?很多逻辑异常,比如 src/lib/doc.ts 文件中的 docsPublishedAtPath 变量为空是很常见的现象,还有其他的在 build 阶段,无法正确创建文章。