This script extracts DENO_DIR
location from deno info
command.
To run this, --allow-run
permission is required.
ref: https://deno.land/manual/getting_started/setup_your_environment#environment-variables
This script extracts DENO_DIR
location from deno info
command.
To run this, --allow-run
permission is required.
ref: https://deno.land/manual/getting_started/setup_your_environment#environment-variables
// `--allow-run` permission is required | |
export async function getDenoDir() { | |
const p = Deno.run({ | |
cmd: ["deno", "info"], | |
stdout: "piped", | |
stderr: "piped", | |
}); | |
const output = await p.output(); | |
p.close(); | |
return new TextDecoder() | |
.decode(output) | |
.split("\n") | |
.filter((line) => line.includes("DENO_DIR"))[0] | |
.replace(/^[^"]*"|"$/g, ""); | |
} |