Skip to content

Commit 4b1be67

Browse files
authored
fix: use forked devcert to avoid pulling transitive deps from its @types/* deps, handle change in tmp package (#39343)
* fix: use forked devcert to avoid pulling transitive deps from its @types/* deps * chore: remove cpy from structured-logging test * chore: remove del-cli from cli test * chore: use gatsbyjs fork and not private one * chore: use @expo/devcert as it is being maintained * fix: create .cache directory before trying to create temp file in it
1 parent 2819391 commit 4b1be67

File tree

9 files changed

+88
-134
lines changed

9 files changed

+88
-134
lines changed

integration-tests/gatsby-cli/__tests__/new.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { GatsbyCLI } from "../test-helpers"
22
import * as fs from "fs-extra"
3-
import execa from "execa"
43
import { join } from "path"
54
import { getConfigStore } from "gatsby-core-utils"
65

@@ -9,7 +8,14 @@ jest.setTimeout(MAX_TIMEOUT)
98

109
const cwd = `execution-folder`
1110

12-
const clean = dir => execa(`yarn`, ["del-cli", dir])
11+
const clean = async dir => {
12+
try {
13+
await fs.rmdir(dir, { recursive: true })
14+
} catch {
15+
// will throw when dir doesn't exist
16+
// which is fine, we just want to ensure it's clean
17+
}
18+
}
1319

1420
describe(`gatsby new`, () => {
1521
// make folder for us to create sites into

integration-tests/gatsby-cli/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
"devDependencies": {
99
"babel-jest": "^29.3.1",
1010
"babel-preset-gatsby-package": "next",
11-
"del-cli": "^3.0.1",
1211
"execa": "^4.0.1",
1312
"fs-extra": "^9.0.0",
1413
"gatsby": "next",

integration-tests/structured-logging/__tests__/to-do.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ const EventEmitter = require(`events`)
77
const fetch = require(`node-fetch`)
88
const fs = require(`fs-extra`)
99
const path = require(`path`)
10-
const cpy = require(`cpy`)
1110
const { first, last } = require(`lodash`)
1211
// const { groupBy, filter } = require(`lodash`)
1312
const joi = require(`joi`)
@@ -380,7 +379,7 @@ describe(`develop`, () => {
380379

381380
describe(`code change`, () => {
382381
beforeAll(() => {
383-
return cpy(
382+
return fs.cp(
384383
path.join(__dirname, "../src/pages/index.js"),
385384
path.join(__dirname, "../original/"),
386385
{
@@ -428,12 +427,12 @@ describe(`develop`, () => {
428427
commonAssertionsForFailure(events)
429428
})
430429
describe(`valid`, () => {
431-
beforeAll(done => {
430+
beforeAll(async done => {
432431
clearEvents()
433432

434-
cpy(
433+
await fs.cp(
435434
path.join(__dirname, "../original/index.js"),
436-
path.join(__dirname, "../src/pages/"),
435+
path.join(__dirname, "../src/pages/index.js"),
437436
{
438437
overwrite: true,
439438
}

integration-tests/structured-logging/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
},
1818
"devDependencies": {
1919
"babel-plugin-dynamic-import-node-sync": "^2.0.1",
20-
"cpy": "^8.1.2",
2120
"fs-extra": "^10.0.0",
2221
"jest": "^29.3.1",
2322
"joi": "^17.4.0",

packages/gatsby/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
"@babel/traverse": "^7.20.13",
2020
"@babel/types": "^7.20.7",
2121
"@builder.io/partytown": "^0.7.5",
22+
"@expo/devcert": "^1.2.0",
2223
"@gatsbyjs/reach-router": "^2.0.1",
2324
"@gatsbyjs/webpack-hot-middleware": "^2.25.3",
2425
"@graphql-codegen/add": "^3.2.3",
@@ -69,7 +70,6 @@
6970
"debug": "^4.3.4",
7071
"deepmerge": "^4.3.1",
7172
"detect-port": "^1.5.1",
72-
"devcert": "^1.2.2",
7373
"dotenv": "^8.6.0",
7474
"enhanced-resolve": "^5.15.0",
7575
"error-stack-parser": "^2.1.4",

packages/gatsby/src/commands/develop.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,11 @@ class ControllableScript {
5757
}
5858
start(): void {
5959
const args: Array<string> = []
60+
61+
const dotCachePath = path.join(process.cwd(), `.cache`)
62+
fs.mkdirpSync(dotCachePath)
6063
const tmpFileName = tmp.tmpNameSync({
61-
tmpdir: path.join(process.cwd(), `.cache`),
64+
tmpdir: dotCachePath,
6265
})
6366
fs.outputFileSync(tmpFileName, this.script)
6467
this.isRunning = true

packages/gatsby/src/utils/__tests__/get-ssl-cert.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@ jest.mock(`gatsby-cli/lib/reporter`, () => {
1111
info: jest.fn(),
1212
}
1313
})
14-
jest.mock(`devcert`, () => {
14+
jest.mock(`@expo/devcert`, () => {
1515
return {
1616
certificateFor: jest.fn(),
1717
}
1818
})
1919

20-
import { certificateFor as getDevCert } from "devcert"
20+
import { certificateFor as getDevCert } from "@expo/devcert"
2121
import reporter from "gatsby-cli/lib/reporter"
2222
import { getSslCert, IGetSslCertArgs } from "../get-ssl-cert"
2323

packages/gatsby/src/utils/get-ssl-cert.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ export async function getSslCert({
8686
const mkdtemp = fs.mkdtempSync(path.join(os.tmpdir(), `home-`))
8787
process.env.HOME = mkdtemp
8888
}
89-
const getDevCert = require(`devcert`).certificateFor
89+
const getDevCert = require(`@expo/devcert`).certificateFor
9090
const { caPath, key, cert } = await getDevCert(name, {
9191
getCaPath: true,
9292
skipCertutilInstall: false,

0 commit comments

Comments
 (0)