Deno.json任务是否支持类似npm的pre*、post*前置/后置脚本?
Deno Tasks 是否支持 pre*/post* 自动脚本?
Deno 目前的 deno.json 任务系统不支持 npm 那种自动触发 pre*/post* 前置/后置脚本的功能。
你现在用的手动调用方式是当前的标准解决方案——直接在主任务里显式执行前置任务,比如你在 test 任务里写的 deno task pretest && deno test ...,这种写法完全没问题,可以满足需求。
你的配置示例:
{ "tasks": { "start": "deno run -A --unstable --watch=static/,routes/ dev.ts", "pretest": "jq -s '.[0] * .[1]' import_map.json unit.test.import_map.json > unit.test.import_map.gen.json", "test": "deno task pretest && deno test --allow-read --watch --import-map=unit.test.import_map.gen.json" }, "importMap": "./import_map.json", "compilerOptions": { "jsx": "react-jsx", "jsxImportSource": "preact" } }
内容的提问来源于stack exchange,提问作者Norfeldt
相关产品推荐
相关产品推荐

