read-pkg.js 523 B

1234567891011121314
  1. "use strict";
  2. var __importDefault = (this && this.__importDefault) || function (mod) {
  3. return (mod && mod.__esModule) ? mod : { "default": mod };
  4. };
  5. Object.defineProperty(exports, "__esModule", { value: true });
  6. const fs_1 = __importDefault(require("fs"));
  7. const path_1 = __importDefault(require("path"));
  8. function readPkg(dir) {
  9. const pkgFile = path_1.default.resolve(dir, 'package.json');
  10. const pkgStr = fs_1.default.readFileSync(pkgFile, 'utf-8');
  11. return JSON.parse(pkgStr);
  12. }
  13. exports.readPkg = readPkg;