UNPKG

@ts-dev-tools/core

Version:
22 lines (21 loc) 949 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getTestCacheDirPath = getTestCacheDirPath; exports.testCacheDirExists = testCacheDirExists; const node_fs_1 = require("node:fs"); const node_path_1 = require("node:path"); const rootDirPath = (0, node_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"); } const cacheDirPath = (0, node_path_1.resolve)((0, node_path_1.join)(rootDirPath, "node_modules/.cache/ts-dev-tools", packageName), cacheName.toLowerCase().replace(/[^a-z0-9]/g, "-")); return cacheDirPath; } function testCacheDirExists(packageName, cacheName) { const cacheDirPath = getTestCacheDirPath(packageName, cacheName); return (0, node_fs_1.existsSync)(cacheDirPath); }