Comparing version 3.0.3-alpha.0 to 3.0.4-alpha.0
@@ -1,5 +0,5 @@ | ||
export declare function computeHash(): Promise<string>; | ||
export declare function rehydrateFromCache(): Promise<void>; | ||
export declare function isCacheHit(): Promise<boolean>; | ||
export declare function populateCache(): Promise<void>; | ||
export declare function computeHash(cwd: string): Promise<string>; | ||
export declare function rehydrateFromCache(cwd: string): Promise<void>; | ||
export declare function isCacheHit(cwd: string): Promise<boolean>; | ||
export declare function populateCache(cwd: string): Promise<void>; | ||
//# sourceMappingURL=api.d.ts.map |
@@ -13,4 +13,4 @@ "use strict"; | ||
*/ | ||
async function computeHash() { | ||
const config = backfill_config_1.createConfig(); | ||
async function computeHash(cwd) { | ||
const config = backfill_config_1.createConfig(cwd); | ||
const { outputGlob, packageRoot } = config; | ||
@@ -25,6 +25,6 @@ const hasher = new backfill_hasher_1.Hasher({ packageRoot, outputGlob }, "ci-pipeline"); | ||
*/ | ||
async function rehydrateFromCache() { | ||
const config = backfill_config_1.createConfig(); | ||
async function rehydrateFromCache(cwd) { | ||
const config = backfill_config_1.createConfig(cwd); | ||
const { cacheStorageConfig, internalCacheFolder, outputGlob, packageRoot } = config; | ||
const cacheStorage = backfill_cache_1.getCacheStorageProvider(cacheStorageConfig, internalCacheFolder); | ||
const cacheStorage = backfill_cache_1.getCacheStorageProvider(cacheStorageConfig, path.join(cwd, internalCacheFolder)); | ||
const hasher = new backfill_hasher_1.Hasher({ packageRoot, outputGlob }, "ci-pipeline"); | ||
@@ -42,6 +42,6 @@ const hash = await hasher.createPackageHash(); | ||
*/ | ||
async function isCacheHit() { | ||
async function isCacheHit(cwd) { | ||
try { | ||
fs.statSync(path.join(process.cwd(), "node_modules", "cache-hit.json")); | ||
const content = await fs.promises.readFile(path.join(process.cwd(), "node_modules", "cache-hit.json")); | ||
fs.statSync(path.join(cwd, "node_modules", "cache-hit.json")); | ||
const content = await fs.promises.readFile(path.join(cwd, "node_modules", "cache-hit.json")); | ||
return JSON.parse(content.toString()); | ||
@@ -56,7 +56,8 @@ } | ||
* Store the cache to the cache storage. | ||
* | ||
*/ | ||
async function populateCache() { | ||
const config = backfill_config_1.createConfig(); | ||
async function populateCache(cwd) { | ||
const config = backfill_config_1.createConfig(cwd); | ||
const { cacheStorageConfig, internalCacheFolder, outputGlob, packageRoot } = config; | ||
const cacheStorage = backfill_cache_1.getCacheStorageProvider(cacheStorageConfig, internalCacheFolder); | ||
const cacheStorage = backfill_cache_1.getCacheStorageProvider(cacheStorageConfig, path.join(cwd, internalCacheFolder), cwd); | ||
const hasher = new backfill_hasher_1.Hasher({ packageRoot, outputGlob }, "ci-pipeline"); | ||
@@ -67,2 +68,2 @@ const hash = await hasher.createPackageHash(); | ||
exports.populateCache = populateCache; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYXBpLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vc3JjL2FwaS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLHFEQUF5QztBQUN6QyxxREFBK0M7QUFDL0MsbURBQXlEO0FBQ3pELHlCQUF5QjtBQUN6QixvQ0FBb0M7QUFDcEMsNkJBQTZCO0FBRTdCOzs7R0FHRztBQUNJLEtBQUssVUFBVSxXQUFXO0lBQy9CLE1BQU0sTUFBTSxHQUFHLDhCQUFZLEVBQUUsQ0FBQztJQUM5QixNQUFNLEVBQ0osVUFBVSxFQUNWLFdBQVcsRUFDWixHQUFHLE1BQU0sQ0FBQztJQUNYLE1BQU0sTUFBTSxHQUFHLElBQUksd0JBQU0sQ0FDdkIsRUFBRSxXQUFXLEVBQUUsVUFBVSxFQUFFLEVBQzNCLGFBQWEsQ0FDZCxDQUFDO0lBQ0YsTUFBTSxJQUFJLEdBQUcsTUFBTSxNQUFNLENBQUMsaUJBQWlCLEVBQUUsQ0FBQztJQUM5QyxPQUFPLElBQUksQ0FBQztBQUNkLENBQUM7QUFaRCxrQ0FZQztBQUVEOztHQUVH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xFQUNWLFdBQVcsRUFDWixHQUFHLE1BQU0sQ0FBQztJQUNYLE1BQU0sWUFBWSxHQUFHLHdDQUF1QixDQUMxQyxrQkFBa0IsRUFDbEIsSUFBSSxDQUFDLElBQUksQ0FBQyxHQUFHLEVBQUUsbUJBQW1CLENBQUMsRUFDbkMsR0FBRyxDQUNKLENBQUM7SUFDRixNQUFNLE1BQU0sR0FBRyxJQUFJLHdCQUFNLENBQUMsRUFBRSxXQUFXLEVBQUUsVUFBVSxFQUFFLEVBQUUsYUFBYSxDQUFDLENBQUM7SUFFdEUsTUFBTSxJQUFJLEdBQUcsTUFBTSxNQUFNLENBQUMsaUJBQWlCLEVBQUUsQ0FBQztJQUM5QyxNQUFNLFlBQVksQ0FBQyxHQUFHLENBQUMsSUFBSSxFQUFFLFVBQVUsQ0FBQyxDQUFDO0FBQzNDLENBQUM7QUFqQkQsc0NBaUJDIn0= |
@@ -10,3 +10,3 @@ { | ||
}, | ||
"version": "3.0.3-alpha.0", | ||
"version": "3.0.4-alpha.0", | ||
"main": "lib/index.js", | ||
@@ -24,5 +24,5 @@ "bin": { | ||
"anymatch": "^3.0.3", | ||
"backfill-cache": "^3.0.3-alpha.0", | ||
"backfill-cache": "^3.0.4-alpha.0", | ||
"backfill-config": "^3.0.3-alpha.0", | ||
"backfill-hasher": "^3.0.3-alpha.0", | ||
"backfill-hasher": "^3.0.4-alpha.0", | ||
"backfill-logger": "^3.0.3-alpha.0", | ||
@@ -49,3 +49,3 @@ "backfill-utils-dotenv": "^3.0.1-alpha.0", | ||
}, | ||
"gitHead": "0edd878be38a6f3af6e9fa07b84a8d1f1513760c" | ||
"gitHead": "2fd97508d44b640c445e2766b2226a195beb8386" | ||
} |
@@ -13,4 +13,6 @@ import { Hasher } from "backfill-hasher"; | ||
*/ | ||
export async function computeHash(): Promise<string> { | ||
const config = createConfig(); | ||
export async function computeHash( | ||
cwd: string = process.cwd() | ||
): Promise<string> { | ||
const config = createConfig(cwd); | ||
const { outputGlob, packageRoot } = config; | ||
@@ -25,4 +27,6 @@ const hasher = new Hasher({ packageRoot, outputGlob }, "ci-pipeline"); | ||
*/ | ||
export async function rehydrateFromCache(): Promise<void> { | ||
const config = createConfig(); | ||
export async function rehydrateFromCache( | ||
cwd: string = process.cwd() | ||
): Promise<void> { | ||
const config = createConfig(cwd); | ||
const { | ||
@@ -36,3 +40,3 @@ cacheStorageConfig, | ||
cacheStorageConfig, | ||
internalCacheFolder | ||
path.join(cwd, internalCacheFolder) | ||
); | ||
@@ -55,7 +59,9 @@ const hasher = new Hasher({ packageRoot, outputGlob }, "ci-pipeline"); | ||
*/ | ||
export async function isCacheHit(): Promise<boolean> { | ||
export async function isCacheHit( | ||
cwd: string = process.cwd() | ||
): Promise<boolean> { | ||
try { | ||
fs.statSync(path.join(process.cwd(), "node_modules", "cache-hit.json")); | ||
fs.statSync(path.join(cwd, "node_modules", "cache-hit.json")); | ||
const content = await fs.promises.readFile( | ||
path.join(process.cwd(), "node_modules", "cache-hit.json") | ||
path.join(cwd, "node_modules", "cache-hit.json") | ||
); | ||
@@ -72,4 +78,4 @@ return JSON.parse(content.toString()); | ||
*/ | ||
export async function populateCache() { | ||
const config = createConfig(); | ||
export async function populateCache(cwd: string = process.cwd()) { | ||
const config = createConfig(cwd); | ||
const { | ||
@@ -83,3 +89,4 @@ cacheStorageConfig, | ||
cacheStorageConfig, | ||
internalCacheFolder | ||
path.join(cwd, internalCacheFolder), | ||
cwd | ||
); | ||
@@ -86,0 +93,0 @@ const hasher = new Hasher({ packageRoot, outputGlob }, "ci-pipeline"); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
241029
1026
+ Addedbackfill-cache@3.0.4-alpha.0(transitive)
+ Addedbackfill-hasher@3.0.4-api.0(transitive)
- Removedbackfill-cache@3.0.3-alpha.0(transitive)
- Removedbackfill-hasher@3.0.3-alpha.0(transitive)