diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index ff1e1a4..68815ca 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -13,9 +13,9 @@ jobs: bun_ci: uses: cross-org/workflows/.github/workflows/bun-ci.yml@main with: - jsr_dependencies: "@cross/test @std/assert @cross/runtime @std/path @cross/dir @std/ulid" + jsr_dependencies: "@cross/test @std/assert @cross/runtime @std/path @cross/dir" node_ci: uses: cross-org/workflows/.github/workflows/node-ci.yml@main with: - jsr_dependencies: "@cross/test @std/assert @cross/runtime @std/path @cross/dir @std/ulid" + jsr_dependencies: "@cross/test @std/assert @cross/runtime @std/path @cross/dir" test_target: "src/**/*.test.ts" \ No newline at end of file diff --git a/deno.json b/deno.json index 2aaac76..798a8c3 100644 --- a/deno.json +++ b/deno.json @@ -12,8 +12,7 @@ "@cross/runtime": "jsr:@cross/runtime@^1.0.0", "@cross/test": "jsr:@cross/test@^0.0.9", "@std/assert": "jsr:@std/assert@^0.220.1", - "@std/path": "jsr:@std/path@^0.220.1", - "@std/ulid": "jsr:@std/ulid@^0.220.1" + "@std/path": "jsr:@std/path@^0.220.1" }, "publish": { "exclude": [".github", "*.test.ts"] diff --git a/src/ops/mktempdir.ts b/src/ops/mktempdir.ts index 2c22378..5b80769 100644 --- a/src/ops/mktempdir.ts +++ b/src/ops/mktempdir.ts @@ -1,5 +1,4 @@ import { dir } from "@cross/dir"; -import { ulid } from "@std/ulid"; import { join } from "@std/path"; import { mkdir } from "./mkdir.ts"; @@ -12,11 +11,13 @@ import { mkdir } from "./mkdir.ts"; */ export async function mktempdir(prefix?: string): Promise { const tempBaseDir = await dir("tmp"); - let uuid = ulid(); - if (prefix) { - uuid = `${prefix}-${uuid}`; - } - const tempDirPath = join(tempBaseDir, uuid.toString()); + + // Generate a unique identifier without relying on something else + // does not need to be cryptographically perfect + const timestamp = performance.now().toString(36); + const randomPart = Math.random().toString(36).substring(2); // Remove '0.' + const uniqueName = `${prefix ? `${prefix}-` : ""}${timestamp}-${randomPart}`; + const tempDirPath = join(tempBaseDir, uniqueName); await mkdir(tempDirPath, { recursive: true }); return tempDirPath; }