deno vendor
,供應相依性
deno vendor <specifiers>...
將下載指定模組的所有遠端相依性到本機的 vendor
資料夾。例如
# Vendor the remote dependencies of main.ts
$ deno vendor main.ts
# Example file system tree
$ tree
.
├── main.ts
└── vendor
├── deno.land
├── import_map.json
└── raw.githubusercontent.com
# Check the directory into source control
$ git add -u vendor
$ git commit
若要接著在程式中使用供應的相依性,只要將 --import-map=vendor/import_map.json
加入 Deno 呼叫中即可。你也可以將 --no-remote
加入呼叫中,以完全停用遠端模組的擷取,確保使用供應目錄中的模組。
deno run --no-remote --import-map=vendor/import_map.json main.ts
請注意,在供應時,你可以指定多個模組和遠端模組。
deno vendor main.ts test.deps.ts https://deno.land/std/path/mod.ts
執行 deno vendor --help
以取得更多詳細資料。