docs: 说明 test-qr 的参考实现前置条件

test-qr.mjs 需要一个 npm qrcode 作为对照(仅测试用,非运行时依赖),
但脚本与 README 都没说明如何准备,克隆后直接 npm test 会在这一步失败。
现在脚本直接打印可复制的准备命令,README 中英双语也补充了说明与
QR_ORACLE_DIR 的用法。
This commit is contained in:
2026-09-27 04:23:31 +08:00
parent dbfdfda60d
commit 304379c80c
3 changed files with 9 additions and 0 deletions
+3
View File
@@ -16,6 +16,9 @@ try {
oracle = requireFromOracle('qrcode')
} catch (error) {
console.error(`cannot load the qrcode oracle from ${oracleDir}: ${error.message}`)
console.error('prepare it once with:')
console.error(` mkdir -p ${oracleDir} && cd ${oracleDir} && npm init -y && npm i qrcode@1.5.4`)
console.error(`or point QR_ORACLE_DIR at a directory that already has it.`)
process.exit(2)
}