From 4ec9e72d2488f84c47f74e436def2cbccd7c3c5d Mon Sep 17 00:00:00 2001 From: Daniel Freytag Date: Wed, 27 Dec 2023 11:15:23 +0100 Subject: [PATCH] refact: remove `uuid` --- package.json | 3 +-- packages/storage-wrapper/save.js | 4 ++-- yarn.lock | 17 ++++++++--------- 3 files changed, 11 insertions(+), 13 deletions(-) diff --git a/package.json b/package.json index 73a7531..73417f3 100644 --- a/package.json +++ b/package.json @@ -28,8 +28,7 @@ "aws-sdk": "2.1520.0", "luxon": "3.4.4", "node-crc": "swrlab/node-crc#v2.1.0", - "undici": "6.0.1", - "uuid": "9.0.1" + "undici": "6.0.1" }, "devDependencies": { "@swrlab/eslint-plugin-swr": "^0.3.0", diff --git a/packages/storage-wrapper/save.js b/packages/storage-wrapper/save.js index a50bfb8..00ea505 100644 --- a/packages/storage-wrapper/save.js +++ b/packages/storage-wrapper/save.js @@ -8,7 +8,7 @@ // load node utils const os = require('os') const pathUtil = require('path') -const { v4: uuidv4 } = require('uuid') +const { randomUUID } = require('crypto') const saveLocalFile = (that, uri, buffer) => new Promise((resolve, reject) => { @@ -59,7 +59,7 @@ module.exports = async function (uri, buffer, logPrefix, resumable) { path = structure.join('/') // save to local file - const tempFilePath = pathUtil.resolve(os.tmpdir(), uuidv4()) + const tempFilePath = pathUtil.resolve(os.tmpdir(), randomUUID()) await saveLocalFile(this, tempFilePath, buffer) // log progress diff --git a/yarn.lock b/yarn.lock index 4edc4bd..9c87f30 100644 --- a/yarn.lock +++ b/yarn.lock @@ -292,7 +292,6 @@ __metadata: node-crc: "swrlab/node-crc#v2.1.0" prettier: "npm:^3.1.1" undici: "npm:6.0.1" - uuid: "npm:9.0.1" languageName: unknown linkType: soft @@ -4406,21 +4405,21 @@ __metadata: languageName: node linkType: hard -"uuid@npm:9.0.1, uuid@npm:^9.0.0": - version: 9.0.1 - resolution: "uuid@npm:9.0.1" +"uuid@npm:^8.0.0": + version: 8.3.2 + resolution: "uuid@npm:8.3.2" bin: uuid: dist/bin/uuid - checksum: 1607dd32ac7fc22f2d8f77051e6a64845c9bce5cd3dd8aa0070c074ec73e666a1f63c7b4e0f4bf2bc8b9d59dc85a15e17807446d9d2b17c8485fbc2147b27f9b + checksum: bcbb807a917d374a49f475fae2e87fdca7da5e5530820ef53f65ba1d12131bd81a92ecf259cc7ce317cbe0f289e7d79fdfebcef9bfa3087c8c8a2fa304c9be54 languageName: node linkType: hard -"uuid@npm:^8.0.0": - version: 8.3.2 - resolution: "uuid@npm:8.3.2" +"uuid@npm:^9.0.0": + version: 9.0.1 + resolution: "uuid@npm:9.0.1" bin: uuid: dist/bin/uuid - checksum: bcbb807a917d374a49f475fae2e87fdca7da5e5530820ef53f65ba1d12131bd81a92ecf259cc7ce317cbe0f289e7d79fdfebcef9bfa3087c8c8a2fa304c9be54 + checksum: 1607dd32ac7fc22f2d8f77051e6a64845c9bce5cd3dd8aa0070c074ec73e666a1f63c7b4e0f4bf2bc8b9d59dc85a15e17807446d9d2b17c8485fbc2147b27f9b languageName: node linkType: hard