@ts-dev-tools/core
Version:
TS dev tools Core
22 lines (21 loc) • 899 B
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.getTestCacheDirPath = getTestCacheDirPath;
exports.testCacheDirExists = testCacheDirExists;
var fs_1 = require("fs");
var path_1 = require("path");
var rootDirPath = (0, path_1.resolve)(__dirname, "../../../..");
function getTestCacheDirPath(packageName, cacheName) {
if (!packageName) {
throw new Error("Package name must be provided");
}
if (!cacheName) {
throw new Error("Cache name must be provided");
}
var cacheDirPath = (0, path_1.resolve)((0, path_1.join)(rootDirPath, "node_modules/.cache/ts-dev-tools", packageName), cacheName.toLowerCase().replace(/[^a-z0-9]/g, "-"));
return cacheDirPath;
}
function testCacheDirExists(packageName, cacheName) {
var cacheDirPath = getTestCacheDirPath(packageName, cacheName);
return (0, fs_1.existsSync)(cacheDirPath);
}
;