tsro
Version:
TypeScript Remove Orphaned (tsro) is a CLI utility and library for TypeScript projects that detects and removes files containing invalid imports — imports that refer to nonexistent entities or nonexistent modules.
12 lines (11 loc) • 468 B
JavaScript
import { fileURLToPath } from "node:url";
import { dirname, join } from "node:path";
import { readFile } from "node:fs/promises";
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
export const getVersion = async () => {
const pathToPackageJson = join(__dirname, "../../package.json");
const packageJson = await readFile(pathToPackageJson, "utf8");
const { version } = JSON.parse(packageJson);
return version;
};