@zendesk/zcli-themes
Version:
zcli theme commands live here
22 lines (21 loc) • 790 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const errors_1 = require("@oclif/core/lib/errors");
const fs = require("fs");
const chalk = require("chalk");
function getManifest(themePath) {
const manifestFilePath = `${themePath}/manifest.json`;
if (fs.existsSync(manifestFilePath)) {
const manifestFile = fs.readFileSync(manifestFilePath, 'utf8');
try {
return JSON.parse(manifestFile);
}
catch (error) {
throw new errors_1.CLIError(chalk.red(`manifest.json file was malformed at path: "${manifestFilePath}"`));
}
}
else {
throw new errors_1.CLIError(chalk.red(`Couldn't find a manifest.json file at path: "${manifestFilePath}"`));
}
}
exports.default = getManifest;