Skip to content

[utils] Replace the uuid dependency with crypto.randomUUID() #10210

Description

@cryptodev-2s

Carried over from MetaMask/utils#289, which was open when @metamask/utils moved into core.

packages/utils declares uuid@^9.0.1 as a production dependency and @types/uuid@^9.0.8 as a dev dependency, for a single call site:

// packages/utils/src/fs.ts:244
const directoryPath = path.join(os.tmpdir(), projectName, uuidV4());

crypto.randomUUID() has been available since Node 14.17 and the package requires Node 22, so the dependency can go. That also drops @types/uuid and one entry from every consumer's tree.

fs.test.ts currently spies on the module (jest.spyOn(uuid, 'v4')), so the test needs reworking alongside it.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions