Skip to content

Commit

Permalink
fix map definitions
Browse files Browse the repository at this point in the history
  • Loading branch information
gmichelo committed Jan 26, 2024
1 parent d856b3d commit 1e811a0
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions dist/index/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -27042,7 +27042,7 @@ async function writeCacheMetadata(cachePath, metadata) {
const namespaceFolderPath = external_path_.join(cachePath, "namespace");
const metadataFilePath = external_path_.join(namespaceFolderPath, "metadata.json");
const rawData = JSON.stringify(metadata);
external_fs_.writeFileSync(metadataFilePath, rawData, {});
external_fs_.writeFileSync(metadataFilePath, rawData);
}

;// CONCATENATED MODULE: ./src/index.ts
Expand Down Expand Up @@ -27083,10 +27083,10 @@ async function main() {
metadata.updatedAt = new Date().toISOString();
metadata.version = 1;
if (!metadata.userRequest) {
metadata.userRequest = new Map();
metadata.userRequest = {};
}
for (const p of cachePaths) {
metadata.userRequest.set(p.pathInCache, { cacheFramework: p.framework, mountTarget: [p.mountTarget], source: ActionVersion });
metadata.userRequest[p.pathInCache] = { cacheFramework: p.framework, mountTarget: [p.mountTarget], source: ActionVersion };
}
writeCacheMetadata(localCachePath, metadata);
const cacheUtilInfo = await getCacheSummaryUtil(localCachePath);
Expand Down
4 changes: 2 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,11 @@ async function main() {
metadata.updatedAt = new Date().toISOString();
metadata.version = 1;
if (!metadata.userRequest) {
metadata.userRequest = new Map<string, utils.CacheMount>();
metadata.userRequest = {};
}

for (const p of cachePaths) {
metadata.userRequest.set(p.pathInCache, {cacheFramework: p.framework, mountTarget: [p.mountTarget], source: ActionVersion});
metadata.userRequest[p.pathInCache] = {cacheFramework: p.framework, mountTarget: [p.mountTarget], source: ActionVersion};
}
utils.writeCacheMetadata(localCachePath, metadata);

Expand Down
6 changes: 3 additions & 3 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export async function getCacheUtil(cachePath: string): Promise<number> {
export interface CacheMetadata {
version?: number
updatedAt?: string
userRequest?: Map<string, CacheMount>
userRequest?: {[key: string]: CacheMount}
preExecution?: ExecutionInfo
postExecution?: ExecutionInfo
}
Expand All @@ -41,7 +41,7 @@ export interface CacheMount {
}

export interface ExecutionInfo {
usage: Map<string, number>
usage: {[key: string]: number}
}

export async function ensureCacheMetadata(cachePath: string): Promise<CacheMetadata> {
Expand All @@ -61,5 +61,5 @@ export async function writeCacheMetadata(cachePath: string, metadata: CacheMetad
const namespaceFolderPath = path.join(cachePath, "namespace");
const metadataFilePath = path.join(namespaceFolderPath, "metadata.json");
const rawData = JSON.stringify(metadata);
fs.writeFileSync(metadataFilePath, rawData, {})
fs.writeFileSync(metadataFilePath, rawData)
}

0 comments on commit 1e811a0

Please sign in to comment.