@ng-doc/builder
Version:
<!-- PROJECT LOGO --> <br /> <div align="center"> <a href="https://github.com/ng-doc/ng-doc"> <img src="https://ng-doc.com/assets/images/ng-doc.svg?raw=true" alt="Logo" height="150px"> </a>
22 lines • 854 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.updateCache = updateCache;
const tslib_1 = require("tslib");
const fs = tslib_1.__importStar(require("fs"));
const path = tslib_1.__importStar(require("path"));
const get_cache_file_path_1 = require("./get-cache-file-path");
/**
* Updates cache for given files
* This function creates object and writes it to cache file
* @param id - unique id for cache
* @param cache - cache object
*/
function updateCache(id, cache) {
const cacheFilePath = (0, get_cache_file_path_1.getCacheFilePath)(id);
const cacheDirPath = path.dirname(cacheFilePath);
if (!fs.existsSync(cacheDirPath)) {
fs.mkdirSync(cacheDirPath, { recursive: true });
}
fs.writeFileSync(cacheFilePath, JSON.stringify(cache, null, 2));
}
//# sourceMappingURL=update-cache.js.map