Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chore: uuid major upgrade #26636

Merged
merged 1 commit into from
Aug 27, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/gatsby-cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
"stack-trace": "^0.0.10",
"strip-ansi": "^5.2.0",
"update-notifier": "^4.1.0",
"uuid": "3.4.0",
"uuid": "^8.3.0",
"yargs": "^15.3.1",
"yurnalist": "^1.1.2"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/gatsby-cli/src/reporter/redux/internal-actions.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-disable @typescript-eslint/camelcase */

import uuidv4 from "uuid/v4"
import { v4 as uuidv4 } from "uuid"
import { trackCli } from "gatsby-telemetry"
import signalExit from "signal-exit"
import { Dispatch } from "redux"
Expand Down
2 changes: 1 addition & 1 deletion packages/gatsby-plugin-benchmark-reporting/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"dependencies": {
"fast-glob": "^3.2.4",
"node-fetch": "^2.6.0",
"uuid": "^3.4.0"
"uuid": "^8.3.0"
},
"scripts": {
"build": "babel src --out-dir . --ignore \"**/__tests__\"",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const { performance } = require(`perf_hooks`)

const { sync: glob } = require(`fast-glob`)
const nodeFetch = require(`node-fetch`)
const uuidv4 = require(`uuid/v4`)
const { v4: uuidv4 } = require(`uuid`)
const { execSync } = require(`child_process`)
const fs = require(`fs`)

Expand Down
2 changes: 1 addition & 1 deletion packages/gatsby-plugin-sharp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"semver": "^7.3.2",
"sharp": "^0.25.1",
"svgo": "1.3.2",
"uuid": "^3.4.0"
"uuid": "^8.3.0"
},
"devDependencies": {
"@babel/cli": "^7.10.3",
Expand Down
2 changes: 1 addition & 1 deletion packages/gatsby-plugin-sharp/src/scheduler.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const uuidv4 = require(`uuid/v4`)
const { v4: uuidv4 } = require(`uuid`)
const path = require(`path`)
const fs = require(`fs-extra`)
const got = require(`got`)
Expand Down
2 changes: 1 addition & 1 deletion packages/gatsby-recipes/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
"unist-util-remove": "^2.0.0",
"unist-util-visit": "^2.0.2",
"urql": "^1.9.7",
"uuid": "^8.2.0",
"uuid": "^8.3.0",
"ws": "^7.3.0",
"xstate": "^4.9.1",
"yoga-layout-prebuilt": "^1.9.6",
Expand Down
2 changes: 1 addition & 1 deletion packages/gatsby-source-graphql/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"graphql": "^14.6.0",
"invariant": "^2.2.4",
"node-fetch": "^1.7.3",
"uuid": "^3.4.0"
"uuid": "^8.3.0"
},
"devDependencies": {
"@babel/cli": "^7.10.3",
Expand Down
2 changes: 1 addition & 1 deletion packages/gatsby-source-graphql/src/gatsby-node.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const uuidv4 = require(`uuid/v4`)
const { v4: uuidv4 } = require(`uuid`)
const { buildSchema, printSchema } = require(`gatsby/graphql`)
const {
wrapSchema,
Expand Down
2 changes: 1 addition & 1 deletion packages/gatsby-telemetry/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"is-docker": "2.0.0",
"lodash": "^4.17.15",
"node-fetch": "2.6.0",
"uuid": "3.4.0"
"uuid": "^8.3.0"
},
"devDependencies": {
"@babel/cli": "^7.10.3",
Expand Down
4 changes: 2 additions & 2 deletions packages/gatsby-telemetry/src/in-memory-store.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import uuidV4 from "uuid/v4"
import { v4 as uuidv4 } from "uuid"
import os from "os"
import { join } from "path"

Expand All @@ -13,7 +13,7 @@ export class InMemoryConfigStore {
createBaseConfig(): Record<string, unknown> {
return {
"telemetry.enabled": true,
"telemetry.machineId": `not-a-machine-id-${uuidV4()}`,
"telemetry.machineId": `not-a-machine-id-${uuidv4()}`,
}
}

Expand Down
6 changes: 3 additions & 3 deletions packages/gatsby-telemetry/src/telemetry.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import uuidV4 from "uuid/v4"
import { v4 as uuidv4 } from "uuid"
import os from "os"
import { isCI, getCIName } from "gatsby-core-utils"
import {
Expand All @@ -14,7 +14,7 @@ import { join, sep } from "path"
import isDocker from "is-docker"
import lodash from "lodash"

const typedUUIDv4 = uuidV4 as () => string
const typedUUIDv4 = uuidv4 as () => string

const finalEventRegex = /(END|STOP)$/
const dbEngine = `redux`
Expand Down Expand Up @@ -130,7 +130,7 @@ export class AnalyticsTracker {
getSessionId(): string {
const p = process as any
if (!p.gatsbyTelemetrySessionId) {
p.gatsbyTelemetrySessionId = uuidV4()
p.gatsbyTelemetrySessionId = uuidv4()
}
return p.gatsbyTelemetrySessionId
}
Expand Down
2 changes: 1 addition & 1 deletion packages/gatsby/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@
"type-of": "^2.0.1",
"url-loader": "^1.1.2",
"util.promisify": "^1.0.1",
"uuid": "^3.4.0",
"uuid": "^8.3.0",
"v8-compile-cache": "^1.1.2",
"webpack": "~4.43.0",
"webpack-dev-middleware": "^3.7.2",
Expand Down
6 changes: 5 additions & 1 deletion packages/gatsby/src/redux/__tests__/jobsv2.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
const jobsManager = require(`../../utils/jobs-manager`)
jest.spyOn(jobsManager, `enqueueJob`)
jest.spyOn(jobsManager, `removeInProgressJob`)
jest.mock(`uuid/v4`, () => () => `1234`)
jest.mock(`uuid`, () => {
return {
v4: () => `1234`,
}
})

import { jobsV2Reducer as jobsReducer } from "../reducers/jobsv2"

Expand Down
14 changes: 8 additions & 6 deletions packages/gatsby/src/utils/__tests__/jobs-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,18 @@ jest.mock(
{ virtual: true }
)

jest.mock(`uuid/v4`, () =>
jest.fn().mockImplementation(jest.requireActual(`uuid/v4`))
)
jest.mock(`uuid`, () => {
return {
v4: jest.fn().mockImplementation(jest.requireActual(`uuid`).v4),
}
})

const worker = require(`/node_modules/gatsby-plugin-test/gatsby-worker.js`)
const reporter = require(`gatsby-cli/lib/reporter`)
const hasha = require(`hasha`)
const fs = require(`fs-extra`)
const pDefer = require(`p-defer`)
const uuid = require(`uuid/v4`)
const { v4: uuidv4 } = require(`uuid`)

fs.ensureDir = jest.fn().mockResolvedValue(true)

Expand Down Expand Up @@ -83,7 +85,7 @@ describe(`Jobs manager`, () => {
worker.TEST_JOB.mockReset()
endActivity.mockClear()
pDefer.mockClear()
uuid.mockClear()
uuidv4.mockClear()
reporter.phantomActivity.mockImplementation(() => {
return {
start: jest.fn(),
Expand Down Expand Up @@ -151,7 +153,7 @@ describe(`Jobs manager`, () => {
const internalJob = createInternalJob(createMockJob(), plugin)
createInternalJob(internalJob, plugin)

expect(uuid).toHaveBeenCalledTimes(1)
expect(uuidv4).toHaveBeenCalledTimes(1)
})
})

Expand Down
2 changes: 1 addition & 1 deletion packages/gatsby/src/utils/create-node-id.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import uuidv5 from "uuid/v5"
import { v5 as uuidv5 } from "uuid"
import report from "gatsby-cli/lib/reporter"

const seedConstant = `638f7a53-c567-4eca-8fc1-b23efb1cfb2b`
Expand Down
4 changes: 2 additions & 2 deletions packages/gatsby/src/utils/jobs-manager.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import uuid from "uuid/v4"
import { v4 as uuidv4 } from "uuid"
import path from "path"
import hasha from "hasha"
import fs from "fs-extra"
Expand Down Expand Up @@ -250,7 +250,7 @@ export function createInternalJob(
})

const internalJob: InternalJob = {
id: uuid(),
id: uuidv4(),
name,
contentDigest: ``,
inputPaths: inputPathsWithContentDigest,
Expand Down
4 changes: 2 additions & 2 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -25021,7 +25021,7 @@ utils-merge@1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/utils-merge/-/utils-merge-1.0.1.tgz#9f95710f50a267947b2ccc124741c1028427e713"

uuid@3.4.0, uuid@^3.0.0, uuid@^3.0.1, uuid@^3.1.0, uuid@^3.3.2, uuid@^3.3.3, uuid@^3.4.0:
uuid@^3.0.0, uuid@^3.0.1, uuid@^3.1.0, uuid@^3.3.2, uuid@^3.3.3, uuid@^3.4.0:
version "3.4.0"
resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.4.0.tgz#b23e4358afa8a202fe7a100af1f5f883f02007ee"
integrity sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==
Expand All @@ -25031,7 +25031,7 @@ uuid@^7.0.0:
resolved "https://registry.yarnpkg.com/uuid/-/uuid-7.0.3.tgz#c5c9f2c8cf25dc0a372c4df1441c41f5bd0c680b"
integrity sha512-DPSke0pXhTZgoF/d+WSt2QaKMCFSfx7QegxEWT+JOuHF5aWrKEn0G+ztjuJg/gG8/ItK+rbPCD/yNv8yyih6Cg==

uuid@^8.2.0:
uuid@^8.3.0:
version "8.3.0"
resolved "https://registry.yarnpkg.com/uuid/-/uuid-8.3.0.tgz#ab738085ca22dc9a8c92725e459b1d507df5d6ea"
integrity sha512-fX6Z5o4m6XsXBdli9g7DtWgAx+osMsRRZFKma1mIUsLCz6vRvv+pz5VNbyu9UEDzpMWulZfvpgb/cmDXVulYFQ==
Expand Down