mirror of
https://github.com/denoland/deno.git
synced 2025-02-08 07:16:56 -05:00
15 lines
418 B
TypeScript
15 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);
|