UNPKG

signing-enclave

Version:

A code signing and notarization tool for macOS and Windows applications. Uses Azure Key Vault for secret and certificate management.

42 lines 1.46 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.delay = void 0; exports.readJson = readJson; exports.writeJson = writeJson; exports.ensureDir = ensureDir; exports.ensureExists = ensureExists; const promises_1 = __importDefault(require("fs/promises")); async function readJson(filePath) { const fileContent = await promises_1.default.readFile(filePath, "utf-8"); return JSON.parse(fileContent); } async function writeJson(filePath, data) { const jsonString = JSON.stringify(data, null, 2); await promises_1.default.writeFile(filePath, jsonString, "utf-8"); } async function doesDirExist(dirPath) { try { const stats = await promises_1.default.stat(dirPath); return stats.isDirectory(); } catch (error) { return false; } } async function ensureDir(dirPath) { if (!(await doesDirExist(dirPath))) { await promises_1.default.mkdir(dirPath, { recursive: true }); } } async function ensureExists(filePath) { const stats = await promises_1.default.stat(filePath); if (!stats.isFile() && !stats.isDirectory()) { throw new Error(`File/Folder does not exist: ${filePath}`); } } const delay = (ms) => new Promise((resolve) => setTimeout(resolve, ms)); exports.delay = delay; //# sourceMappingURL=utils.js.map