修改构建镜像为 cimg/ruby:3.4.9-node#468
Open
neveler wants to merge 6 commits into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
修改构建镜像为 cimg/ruby:3.4.9-node
自引入 mini_racer 之后,项目就具备了运行 js 代码的能力。鉴于 execjs 兼容多平台 js 引擎的限制,使用 execjs 执行 js 代码会有很多限制。
https://github.com/CircleCI-Public/cimg-ruby/blob/main/3.4/node/Dockerfile
因此,本 PR 旨在改用环境中自带 node 的镜像用于站点构建。
cimg/ruby:3.4.9-node: 新镜像构建环境中包含 nodejs 环境cache_dir: .jekyll-cache/v260607插件会自动删除.jekyll-cache里的文件,也会删除名称字符序小于当前缓存名称的文件夹ruby 与 node 之间的通信
通过 Ruby 的
open3调用 Node 来执行 JavaScript 脚本。通信流程如下:stdin传入一个 JSON 字符串,内容包括脚本名称、参数和唯一标识stdout接收 Node 输出,输出内容包括日志、唯一标识(分隔符)和返回值定义新 JavaScript 脚本
_plugins/scripts目录下创建<脚本名称>.js文件,并确保脚本会默认导出一个函数,该函数接收一个 json 对象作为入参,并返回一个可序列化的 json 对象 / 值。Script.call即可完成 javascript 脚本调用。https://node-docs.hmcl.workers.dev