[工程化/环境] 测试与构建脚本执行强依赖特定 Node.js 运行时:引入 tsx 解决跨平台与 CI 无法运行 TypeScript 脚本 #12
Labels
No Label
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
No due date set.
Blocks
#7 [Code Review] 整体代码质量、架构缺陷与技术债务全景审查报告
troytt/diablo2-web
Reference: troytt/diablo2-web#12
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
模块位置
package.json,scripts/问题背景与现象
package.json中的所有测试命令(verify:*)直接配置为node scripts/*.ts。amaro剥离特性。ERR_UNKNOWN_FILE_EXTENSION: Unknown file extension ".ts"或ERR_NO_TYPESCRIPT: Node.js is not compiled with TypeScript support。造成的影响
npm run verify:all;解决建议
devDependencies中添加tsx: "^4.x"(或利用现有的esbuild/vite-node);package.json中的node scripts/*.ts命令统一更新为tsx scripts/*.ts;README.md与开发文档中移除对特定 Node 二进制编译特性的限制说明。已修复 —
chore(scripts): 使用 tsx 运行 TypeScript 脚本(63b3962)package.json中所有node scripts/*.ts的调用已全部改为通过tsx运行,并把原先零散的npx tsx写法统一规范化。tsx作为 devDependency 引入,因此不违反本项目「运行时零依赖」的硬性约束。README / HANDOVER 中「需要特定 Node 运行时 /
--experimental-strip-types」的说法已改写为:任何 Node >= 18 均可。验证: 冷装 (
rm -rf node_modules && npm ci) 后npm run verify:all全链路通过,不再出现ERR_UNKNOWN_FILE_EXTENSION。