Skip to content

Commit

Permalink
Remove usage of uuid module
Browse files Browse the repository at this point in the history
It's no longer necessary as UUIDs are built into Node since v14. Closes #365.
  • Loading branch information
domenic committed Oct 2, 2023
1 parent bc73c7d commit 30f1d52
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 24 deletions.
5 changes: 3 additions & 2 deletions __tests__/process-agreement.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
"use strict";

// Fake the UUID generator so it is deterministic for snapshot testing.
jest.mock("uuid", () => {
jest.mock("crypto", () => {
return {
v4() {
...jest.requireActual("crypto"),
randomUUID() {
return "1d8ab899-4d91-48b8-acfa-bf9cde5ad909";
}
};
Expand Down
4 changes: 2 additions & 2 deletions lib/process-agreement.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
"use strict";
const { URL } = require("url");
const uuidv4 = require("uuid").v4;
const { randomUUID } = require("crypto");
const { BadRequest } = require("http-errors");
const workstreamsData = require("../sg/db.json").workstreams;
const gitHubIDRegExp = require("github-username-regex");

const allWorkstreamIDs = new Set(workstreamsData.map(workstream => workstream.id));

module.exports = body => {
const id = uuidv4();
const id = randomUUID();
const type = getType(body);

const publicData = {
Expand Down
16 changes: 1 addition & 15 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 1 addition & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,11 @@
"koa-bodyparser": "^4.4.1",
"koa-handlebars": "^2.0.0",
"listify": "^1.0.3",
"twitter-api-v2": "^1.15.1",
"uuid": "^9.0.0"
"twitter-api-v2": "^1.15.1"
},
"devDependencies": {
"eslint": "^8.48.0",
"jest": "^29.6.4",
"minipass-fetch": "^3.0.4"
},
"volta": {
"node": "16.13.0"
}
}

0 comments on commit 30f1d52

Please sign in to comment.