UNPKG

dce-dev-wizard

Version:

Wizard for managing development apps at Harvard DCE.

29 lines 1.07 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const fs_1 = __importDefault(require("fs")); const print_1 = __importDefault(require("./print")); /* eslint-disable no-console */ /** * Read the package.json file * @author Gabe Abrams * @param filename * @returns package json contents */ const getPackageJSON = (filename) => { if (!fs_1.default.existsSync(filename)) { print_1.default.fatalError(`We expected ${filename} to exist but it did not. Fatal error. Now exiting.`); } // Read in current package.json file try { const stringContents = fs_1.default.readFileSync(filename, 'utf-8'); return JSON.parse(stringContents); } catch (err) { print_1.default.fatalError('\nOops! Your package.json file seems to be corrupted. Please fix it before continuing'); } }; exports.default = getPackageJSON; //# sourceMappingURL=getPackageJSON.js.map