包成 main 函数对齐 check-i18n 风格 #3397

评审偏好。脚本执行逻辑挪进 main() 再调用,与 scripts/check-i18n.js 顶层结构对齐,行为不变。
This commit is contained in:
hrz 2026-10-07 09:21:08 +08:00
parent 08c573a542
commit f943ab5fe4

View file

@ -1,14 +1,18 @@
const fs = require('fs'); const fs = require('fs');
const path = require('path'); const path = require('path');
const target = path.resolve(__dirname, '..', 'node_modules', 'v-code-diff', 'package.json'); function main() {
const target = path.resolve(__dirname, '..', 'node_modules', 'v-code-diff', 'package.json');
if (!fs.existsSync(target)) { if (!fs.existsSync(target)) {
console.error( console.error(
'[v-code-diff] missing dependency.\n' + '[v-code-diff] missing dependency.\n' +
' npm install did not place v-code-diff under node_modules.\n' + ' npm install did not place v-code-diff under node_modules.\n' +
' Fix: cd main/manager-web && npm install v-code-diff@^1.16.0\n' + ' Fix: cd main/manager-web && npm install v-code-diff@^1.16.0\n' +
' Ref: https://github.com/xinnan-tech/xiaozhi-esp32-server/issues/3389' ' Ref: https://github.com/xinnan-tech/xiaozhi-esp32-server/issues/3389'
); );
process.exit(1); process.exit(1);
}
} }
main();