diff --git a/dist/restore/index.js b/dist/restore/index.js index 8005768..6882650 100644 --- a/dist/restore/index.js +++ b/dist/restore/index.js @@ -87392,6 +87392,7 @@ async function run() { const restoreJson = external_path_default().join(config_CARGO_HOME, "incremental-restore.json"); const restoreString = await external_fs_default().promises.readFile(restoreJson, "utf8"); const restoreData = JSON.parse(restoreString); + lib_core.debug(`restoreData: ${JSON.stringify(restoreData)}`); if (restoreData.roots.length == 0) { throw new Error("No incremental roots found"); } diff --git a/dist/save/index.js b/dist/save/index.js index d21f420..cee0247 100644 --- a/dist/save/index.js +++ b/dist/save/index.js @@ -87340,8 +87340,11 @@ async function rmRF(dirName) { async function saveMtimes(targetDirs) { - let times = new Map(); - let stack = new Array(); + let data = { + roots: [], + times: {}, + }; + let stack = []; // Collect all the incremental files for (const dir of targetDirs) { for (const maybeProfile of await external_fs_default().promises.readdir(dir)) { @@ -87353,7 +87356,7 @@ async function saveMtimes(targetDirs) { } } // Save the stack as the roots - we cache these directly - let roots = stack.slice(); + data.roots = stack.slice(); while (stack.length > 0) { const dirName = stack.pop(); const dir = await external_fs_default().promises.opendir(dirName); @@ -87364,11 +87367,11 @@ async function saveMtimes(targetDirs) { else { const fileName = external_path_default().join(dirName, dirent.name); const { mtime } = await external_fs_default().promises.stat(fileName); - times.set(fileName, mtime.getTime()); + data.times[fileName] = mtime.getTime(); } } } - return { roots, times: times }; + return data; } ;// CONCATENATED MODULE: ./src/save.ts diff --git a/src/incremental.ts b/src/incremental.ts index 2738179..4e8865a 100644 --- a/src/incremental.ts +++ b/src/incremental.ts @@ -8,13 +8,18 @@ import fs from "fs"; import path from "path"; export type MtimeData = { - roots: Array, - times: Map + roots: string[], + times: { + [key: string]: number + } }; export async function saveMtimes(targetDirs: string[]): Promise { - let times = new Map(); - let stack = new Array(); + let data: MtimeData = { + roots: [], + times: {}, + }; + let stack: string[] = []; // Collect all the incremental files for (const dir of targetDirs) { @@ -28,7 +33,7 @@ export async function saveMtimes(targetDirs: string[]): Promise { } // Save the stack as the roots - we cache these directly - let roots = stack.slice(); + data.roots = stack.slice(); while (stack.length > 0) { const dirName = stack.pop()!; @@ -40,10 +45,10 @@ export async function saveMtimes(targetDirs: string[]): Promise { } else { const fileName = path.join(dirName, dirent.name); const { mtime } = await fs.promises.stat(fileName); - times.set(fileName, mtime.getTime()); + data.times[fileName] = mtime.getTime(); } } } - return { roots, times: times }; + return data; } diff --git a/src/restore.ts b/src/restore.ts index dcd1caa..78e7975 100644 --- a/src/restore.ts +++ b/src/restore.ts @@ -71,6 +71,8 @@ async function run() { const restoreString = await fs.promises.readFile(restoreJson, "utf8"); const restoreData: MtimeData = JSON.parse(restoreString); + core.debug(`restoreData: ${JSON.stringify(restoreData)}`); + if (restoreData.roots.length == 0) { throw new Error("No incremental roots found"); }