mirror of
https://github.com/denoland/deno.git
synced 2024-12-22 23:34:47 -05:00
14 lines
418 B
TypeScript
14 lines
418 B
TypeScript
import { readFileSync } from "deno";
|
|
|
|
let data = readFileSync("package.json");
|
|
if (!data.byteLength) {
|
|
throw Error(`Expected positive value for data.byteLength ${data.byteLength}`);
|
|
}
|
|
|
|
const decoder = new TextDecoder("utf-8");
|
|
const json = decoder.decode(data);
|
|
const pkg = JSON.parse(json);
|
|
if (pkg.name !== "deno") {
|
|
throw Error(`Expected "deno" but got "${pkg.name}"`)
|
|
}
|
|
console.log("package.name ", pkg.name);
|