UNPKG

@zendesk/zcli-themes

Version:

zcli theme commands live here

19 lines (18 loc) 780 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const errors_1 = require("@oclif/core/lib/errors"); const fs = require("fs"); const chalk = require("chalk"); function rewriteManifest(themePath, apiVersion) { const manifestFilePath = `${themePath}/manifest.json`; try { const manifestFile = fs.readFileSync(manifestFilePath, 'utf8'); // Rewrite with "replace" for minimal diff const updatedContent = manifestFile.replace(/"api_version"\s*:\s*\d+/, `"api_version": ${apiVersion}`); fs.writeFileSync(manifestFilePath, updatedContent); } catch (error) { throw new errors_1.CLIError(chalk.red(`Failed to read or write manifest file: ${manifestFilePath}`)); } } exports.default = rewriteManifest;