Deno import maps and lock file
Solution 1:
You cannot directly generate a lock file based on an import map yet. But you can pass the entry file of your program along with the import map to generate a lock file.
Here's an example.
log.ts
:
import { green } from "colors";
console.log(`Status: ${green("OK")}`);
deps.json
(import map):
{
"imports": {
"colors": "https://deno.land/[email protected]/fmt/colors.ts"
}
}
Now run the following command to generate a lock file.
deno cache --import-map=deps.json --unstable --lock=lock.json --lock-write log.ts
The content of lock.json
might look like below.
{
"https://deno.land/[email protected]/fmt/colors.ts": "db22b314a2ae9430ae7460ce005e0a7130e23ae1c999157e3bb77cf55800f7e4"
}