Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

最新版本在GitHub Actions上生成会导致首页文章排序错误 #30

Closed
leirock opened this issue Apr 5, 2020 · 3 comments
Closed

Comments

@leirock
Copy link

leirock commented Apr 5, 2020

在本地 yarn upgrade 后,hexo-generator-indexedyarn.lock 中的内容变成如下内容,然后在在GitHub Actions上生成会导致首页文章排序错误,会有一篇文章跳到最前面,即使删去该文章也会出错,但是同样的问题在本地无法复现。

hexo-generator-indexed@^1.0.1:
  version "1.1.0"
  resolved "https://registry.yarnpkg.com/hexo-generator-indexed/-/hexo-generator-indexed-1.1.0.tgz#b8dbb75334d2bafd91ab3f62fa963b099780b394"
  integrity sha512-S2CZZMVyUcTkNaSZFdAIt6HJb56UBMirOhnSQk7Z14EmMh0+BAffpFGqgPtQ644S5HP4wZeC1Nreu+FZhqx7Nw==
  dependencies:
    hexo-pagination "1.0.0"

当我手动编辑 yarn.lock,回退为以下内容后正常:

hexo-generator-indexed@^1.0.1:
  version "1.0.1"
  resolved "https://registry.yarnpkg.com/hexo-generator-indexed/-/hexo-generator-indexed-1.0.1.tgz#f9b1ccc04f6e511f93e5850d442d7dd5d770562a"
  integrity sha512-ZzuVDmiiu7SIJg1Mgtl+5hyucyTq9owRR5q0oYsPZOAOionmy3RtAp6sFxp8dH1MNJyENq4q6+uE80CIh0CpxQ==
  dependencies:
    hexo-pagination "1.0.0"
    lodash "^4.17.15"

目前临时性改为 Hexo 默认的排序插件 hexo-generator-index 替代。

node -v

v13.9.0

hexo -v

hexo: 4.2.0
hexo-cli: 3.1.0
os: Darwin 19.4.0 darwin x64
node: 13.9.0
v8: 7.9.317.25-node.28
uv: 1.34.2
zlib: 1.2.11
brotli: 1.0.7
ares: 1.15.0
modules: 79
nghttp2: 1.40.0
napi: 5
llhttp: 2.0.4
openssl: 1.1.1d
cldr: 36.0
icu: 65.1
tz: 2019c
unicode: 12.1

  "dependencies": {
    "hexo": "^4.2.0",
    "hexo-all-minifier": "^0.5.3",
    "hexo-generator-category": "^1.0.0",
    "hexo-generator-feed": "^2.2.0",
    "hexo-generator-indexed": "^1.0.1",
    "hexo-generator-searchdb": "^1.2.1",
    "hexo-generator-seo-friendly-sitemap": "^0.0.25",
    "hexo-generator-tag": "^1.0.0",
    "hexo-related-popular-posts": "^4.0.0",
    "hexo-renderer-ejs": "^1.0.0",
    "hexo-renderer-marked": "^2.0.0",
    "hexo-renderer-stylus": "^1.1.0",
    "hexo-server": "^1.0.0",
    "image-size": "^0.8.1"
  }
@stevenjoezhang
Copy link
Member

应该是和 Node.js 版本相关的。根据文档, Node.js 12 更换了排序算法,新的算法是稳定的。因此问题可能由于本地环境与 GitHub Actions 上的 Node.js 版本不同导致。

@leirock
Copy link
Author

leirock commented Apr 6, 2020

应该是吧,不过好像 GitHub Actions 上的 Node.js 版本没有默认安装 13.x ?所以没有去具体测试(自己安装似乎耗时较长),我后来选择用 hexo-generator-index 插件替代了,目前看没什么问题。

@leirock leirock closed this as completed Apr 8, 2020
@stevenjoezhang
Copy link
Member

stevenjoezhang commented Apr 26, 2020

根据 sticky 属性排序文章的特性可能会在未来某个版本加入到 hexo-generator-index 中。

更新:见 hexojs/hexo-generator-index#51

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants