mirror of
				https://github.com/actions/cache.git
				synced 2025-10-31 11:48:38 +08:00 
			
		
		
		
	Deep require is deprecated for uuid and use another syntax instead
This commit is contained in:
		
							parent
							
								
									ddbca14adb
								
							
						
					
					
						commit
						36ce21c4a4
					
				|  | @ -3,13 +3,12 @@ import * as io from "@actions/io"; | ||||||
| import { promises as fs } from "fs"; | import { promises as fs } from "fs"; | ||||||
| import * as os from "os"; | import * as os from "os"; | ||||||
| import * as path from "path"; | import * as path from "path"; | ||||||
|  | import { v4 as uuidv4 } from "uuid"; | ||||||
| 
 | 
 | ||||||
| import { Events, Outputs, State } from "../src/constants"; | import { Events, Outputs, State } from "../src/constants"; | ||||||
| import { ArtifactCacheEntry } from "../src/contracts"; | import { ArtifactCacheEntry } from "../src/contracts"; | ||||||
| import * as actionUtils from "../src/utils/actionUtils"; | import * as actionUtils from "../src/utils/actionUtils"; | ||||||
| 
 | 
 | ||||||
| import uuid = require("uuid"); |  | ||||||
| 
 |  | ||||||
| jest.mock("@actions/core"); | jest.mock("@actions/core"); | ||||||
| jest.mock("os"); | jest.mock("os"); | ||||||
| 
 | 
 | ||||||
|  | @ -226,7 +225,7 @@ test("resolvePaths with no ~ in path", async () => { | ||||||
| }); | }); | ||||||
| 
 | 
 | ||||||
| test("resolvePaths with ~ in path", async () => { | test("resolvePaths with ~ in path", async () => { | ||||||
|     const cacheDir = uuid(); |     const cacheDir = uuidv4(); | ||||||
|     const filePath = `~/${cacheDir}`; |     const filePath = `~/${cacheDir}`; | ||||||
|     // Create the following layout:
 |     // Create the following layout:
 | ||||||
|     //   ~/uuid
 |     //   ~/uuid
 | ||||||
|  |  | ||||||
|  | @ -4,7 +4,7 @@ import * as io from "@actions/io"; | ||||||
| import * as fs from "fs"; | import * as fs from "fs"; | ||||||
| import * as path from "path"; | import * as path from "path"; | ||||||
| import * as util from "util"; | import * as util from "util"; | ||||||
| import * as uuidV4 from "uuid/v4"; | import { v4 as uuidv4 } from "uuid"; | ||||||
| 
 | 
 | ||||||
| import { Events, Outputs, State } from "../constants"; | import { Events, Outputs, State } from "../constants"; | ||||||
| import { ArtifactCacheEntry } from "../contracts"; | import { ArtifactCacheEntry } from "../contracts"; | ||||||
|  | @ -30,7 +30,7 @@ export async function createTempDirectory(): Promise<string> { | ||||||
|         tempDirectory = path.join(baseLocation, "actions", "temp"); |         tempDirectory = path.join(baseLocation, "actions", "temp"); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     const dest = path.join(tempDirectory, uuidV4.default()); |     const dest = path.join(tempDirectory, uuidv4()); | ||||||
|     await io.mkdirP(dest); |     await io.mkdirP(dest); | ||||||
|     return dest; |     return dest; | ||||||
| } | } | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 BSKY
						BSKY