Skip to content

Commit 8e10e1c

Browse files
imjoshinwardpeet
andauthoredSep 8, 2022
fix: ci pipeline (#36544) (#36568)
Co-authored-by: Michal Piechowiak <misiek.piechowiak@gmail.com> (cherry picked from commit 1125e58) Co-authored-by: Ward Peeters <ward@coding-tech.com>

File tree

27 files changed

+194
-366
lines changed

27 files changed

+194
-366
lines changed
 

‎.circleci/config.yml

+4-2
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ commands:
169169
command: "REACT_VERSION=<< parameters.react_version >> TEST_PATH=<< parameters.test_path >> node ./scripts/upgrade-react"
170170
- run:
171171
name: Install gatsby-dev@next
172-
command: yarn global add gatsby-dev-cli@next
172+
command: yarn global add gatsby-dev-cli@next --ignore-engines
173173
- run:
174174
name: Run tests (using defaults)
175175
command: ./scripts/e2e-test.sh "<< parameters.test_path >>" "<< parameters.test_command >>"
@@ -280,7 +280,9 @@ jobs:
280280
test_path: integration-tests/gatsby-pipeline
281281

282282
integration_tests_gatsby_cli:
283-
executor: node
283+
executor:
284+
name: node
285+
image: "14.16.0"
284286
steps:
285287
- e2e-test:
286288
test_path: integration-tests/gatsby-cli

‎e2e-tests/contentful/package.json

+5-1
Original file line numberDiff line numberDiff line change
@@ -46,5 +46,9 @@
4646
"repository": {
4747
"type": "git",
4848
"url": "https://github.com/gatsbyjs/gatsby-starter-default"
49+
},
50+
"//": "we need to add fixed version of @types/responsible because it's 14.16+ and the package is configured wrongly",
51+
"resolutions": {
52+
"responselike": "^2.0.0"
4953
}
50-
}
54+
}

‎e2e-tests/development-runtime/package.json

+4
Original file line numberDiff line numberDiff line change
@@ -75,5 +75,9 @@
7575
"repository": {
7676
"type": "git",
7777
"url": "https://github.com/gatsbyjs/gatsby"
78+
},
79+
"//": "we need to add fixed version of @types/responsible because it's 14.16+ and the package is configured wrongly",
80+
"resolutions": {
81+
"responselike": "^2.0.0"
7882
}
7983
}

‎e2e-tests/mdx/package.json

+4
Original file line numberDiff line numberDiff line change
@@ -46,5 +46,9 @@
4646
"is-ci": "^2.0.0",
4747
"prettier": "2.0.4",
4848
"start-server-and-test": "^1.7.1"
49+
},
50+
"//": "we need to add fixed version of @types/responsible because it's 14.16+ and the package is configured wrongly",
51+
"resolutions": {
52+
"responselike": "^2.0.0"
4953
}
5054
}

‎e2e-tests/path-prefix/package.json

+4
Original file line numberDiff line numberDiff line change
@@ -51,5 +51,9 @@
5151
"repository": {
5252
"type": "git",
5353
"url": "https://github.com/gatsbyjs/gatsby-starter-default"
54+
},
55+
"//": "we need to add fixed version of @types/responsible because it's 14.16+ and the package is configured wrongly",
56+
"resolutions": {
57+
"responselike": "^2.0.0"
5458
}
5559
}

‎e2e-tests/production-runtime/package.json

+6-2
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@
2727
],
2828
"license": "MIT",
2929
"scripts": {
30-
"build": "cross-env GATSBY_PREFIXED_FROM_COMMAND_LINE=YES FROM_COMMAND_LINE=YES CYPRESS_SUPPORT=y gatsby build",
31-
"build:offline": "cross-env GATSBY_PREFIXED_FROM_COMMAND_LINE=YES FROM_COMMAND_LINE=YES TEST_PLUGIN_OFFLINE=y CYPRESS_SUPPORT=y gatsby build",
30+
"build": "cross-env GATSBY_PREFIXED_FROM_COMMAND_LINE=YES FROM_COMMAND_LINE=YES CYPRESS_SUPPORT=y NODE_OPTIONS='--require ./polyfill-node-protocol-imports.js' gatsby build",
31+
"build:offline": "cross-env GATSBY_PREFIXED_FROM_COMMAND_LINE=YES FROM_COMMAND_LINE=YES TEST_PLUGIN_OFFLINE=y CYPRESS_SUPPORT=y NODE_OPTIONS='--require ./polyfill-node-protocol-imports.js' gatsby build",
3232
"develop": "cross-env CYPRESS_SUPPORT=y gatsby develop",
3333
"format": "prettier --write '**/*.js' --ignore-path .gitignore",
3434
"serve": "gatsby serve",
@@ -65,5 +65,9 @@
6565
"repository": {
6666
"type": "git",
6767
"url": "https://github.com/gatsbyjs/gatsby-starter-default"
68+
},
69+
"//": "we need to add fixed version of @types/responsible because it's 14.16+ and the package is configured wrongly",
70+
"resolutions": {
71+
"responselike": "^2.0.0"
6872
}
6973
}

‎e2e-tests/themes/package.json

+5-1
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,9 @@
44
"gatsby-theme-about",
55
"production-runtime",
66
"development-runtime"
7-
]
7+
],
8+
"//": "we need to add fixed version of @types/responsible because it's 14.16+ and the package is configured wrongly",
9+
"resolutions": {
10+
"responselike": "^2.0.0"
11+
}
812
}

‎e2e-tests/trailing-slash/package.json

+4
Original file line numberDiff line numberDiff line change
@@ -38,5 +38,9 @@
3838
"npm-run-all": "^4.1.5",
3939
"prettier": "^2.5.1",
4040
"start-server-and-test": "^1.14.0"
41+
},
42+
"//": "we need to add fixed version of @types/responsible because it's 14.16+ and the package is configured wrongly",
43+
"resolutions": {
44+
"responselike": "^2.0.0"
4145
}
4246
}

‎e2e-tests/visual-regression/package.json

+4
Original file line numberDiff line numberDiff line change
@@ -41,5 +41,9 @@
4141
"repository": {
4242
"type": "git",
4343
"url": "https://github.com/gatsbyjs/gatsby-starter-default"
44+
},
45+
"//": "we need to add fixed version of @types/responsible because it's 14.16+ and the package is configured wrongly",
46+
"resolutions": {
47+
"responselike": "^2.0.0"
4448
}
4549
}

‎integration-tests/artifacts/package.json

+4
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,9 @@
2020
"devDependencies": {
2121
"fs-extra": "^10.1.0",
2222
"jest": "^27.2.1"
23+
},
24+
"//": "we need to add fixed version of @types/responsible because it's 14.16+ and the package is configured wrongly",
25+
"resolutions": {
26+
"responselike": "^2.0.0"
2327
}
2428
}

‎integration-tests/cache-resilience/package.json

+4
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,9 @@
2626
"lodash": "^4.17.20",
2727
"slash": "^3.0.0",
2828
"snapshot-diff": "^0.6.1"
29+
},
30+
"//": "we need to add fixed version of @types/responsible because it's 14.16+ and the package is configured wrongly",
31+
"resolutions": {
32+
"responselike": "^2.0.0"
2933
}
3034
}

‎integration-tests/functions/package.json

+4
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,9 @@
3232
"gatsby-plugin-gatsby-cloud": "next",
3333
"react": "^17.0.2",
3434
"react-dom": "^17.0.2"
35+
},
36+
"//": "we need to add fixed version of @types/responsible because it's 14.16+ and the package is configured wrongly",
37+
"resolutions": {
38+
"responselike": "^2.0.0"
3539
}
3640
}

‎integration-tests/gatsby-cli/package.json

+4
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,9 @@
2323
"repository": {
2424
"type": "git",
2525
"url": "https://github.com/gatsbyjs/gatsby-starter-default"
26+
},
27+
"//": "we need to add fixed version of @types/responsible because it's 14.16+ and the package is configured wrongly",
28+
"resolutions": {
29+
"responselike": "^2.0.0"
2630
}
2731
}

‎integration-tests/gatsby-pipeline/package.json

+4
Original file line numberDiff line numberDiff line change
@@ -41,5 +41,9 @@
4141
},
4242
"engines": {
4343
"node": ">=12.13.0"
44+
},
45+
"//": "we need to add fixed version of @types/responsible because it's 14.16+ and the package is configured wrongly",
46+
"resolutions": {
47+
"responselike": "^2.0.0"
4448
}
4549
}

‎integration-tests/gatsby-source-wordpress/package.json

+4
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,9 @@
2727
"jest": "^27.2.1",
2828
"node-fetch": "^2.6.1",
2929
"rimraf": "^3.0.2"
30+
},
31+
"//": "we need to add fixed version of @types/responsible because it's 14.16+ and the package is configured wrongly",
32+
"resolutions": {
33+
"responselike": "^2.0.0"
3034
}
3135
}

‎integration-tests/head-function-export/package.json

+4
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,9 @@
2626
"gatsby": "next",
2727
"react": "^17.0.2",
2828
"react-dom": "^17.0.2"
29+
},
30+
"//": "we need to add fixed version of @types/responsible because it's 14.16+ and the package is configured wrongly",
31+
"resolutions": {
32+
"responselike": "^2.0.0"
2933
}
3034
}

‎integration-tests/images/package.json

+5-1
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,9 @@
2323
"babel-jest": "^27.2.1",
2424
"jest": "^27.2.1",
2525
"pixelmatch": "^5.2.1"
26+
},
27+
"//": "we need to add fixed version of @types/responsible because it's 14.16+ and the package is configured wrongly",
28+
"resolutions": {
29+
"responselike": "^2.0.0"
2630
}
27-
}
31+
}

‎integration-tests/long-term-caching/package.json

+5-1
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,9 @@
1717
"devDependencies": {
1818
"babel-plugin-dynamic-import-node-sync": "^2.0.1",
1919
"jest": "^27.2.1"
20+
},
21+
"//": "we need to add fixed version of @types/responsible because it's 14.16+ and the package is configured wrongly",
22+
"resolutions": {
23+
"responselike": "^2.0.0"
2024
}
21-
}
25+
}

‎integration-tests/node-manifest/package.json

+4
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,9 @@
2020
"jest": "^27.2.1",
2121
"rimraf": "^3.0.2",
2222
"urling": "^1.0.7"
23+
},
24+
"//": "we need to add fixed version of @types/responsible because it's 14.16+ and the package is configured wrongly",
25+
"resolutions": {
26+
"responselike": "^2.0.0"
2327
}
2428
}

‎integration-tests/ssr/package.json

+4
Original file line numberDiff line numberDiff line change
@@ -45,5 +45,9 @@
4545
"test": "cross-env GATSBY_EXPERIMENTAL_DEV_SSR=true npm-run-all -s build capture-prod-dsg-and-ssr start-dev-server",
4646
"test-output": "node test-output.js",
4747
"test:jest": "jest --runInBand"
48+
},
49+
"//": "we need to add fixed version of @types/responsible because it's 14.16+ and the package is configured wrongly",
50+
"resolutions": {
51+
"responselike": "^2.0.0"
4852
}
4953
}

‎integration-tests/structured-logging/package.json

+5-1
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,9 @@
2323
"joi": "^17.4.0",
2424
"lodash": "^4.17.20",
2525
"node-fetch": "^2.6.1"
26+
},
27+
"//": "we need to add fixed version of @types/responsible because it's 14.16+ and the package is configured wrongly",
28+
"resolutions": {
29+
"responselike": "^2.0.0"
2630
}
27-
}
31+
}

‎packages/babel-preset-gatsby/src/optimize-hook-destructuring.ts

+6-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,12 @@ export default function ({
5656
path.parent.id.elements.reduce(
5757
(acc: Array<BabelTypes.ObjectProperty>, element, i) => {
5858
if (element) {
59-
acc.push(t.objectProperty(t.numericLiteral(i), element))
59+
acc.push(
60+
t.objectProperty(
61+
t.numericLiteral(i),
62+
element as BabelTypes.Identifier
63+
)
64+
)
6065
}
6166
return acc
6267
},

‎packages/gatsby-plugin-mdx/src/remark-infer-toc-meta.ts

+49-23
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,16 @@ import type { IMdxVFile } from "./types"
1010
import type { Options, toc } from "mdast-util-toc"
1111
import type { visit } from "unist-util-visit"
1212

13-
type TocNodeType = BlockContent | DefinitionContent | ListItem
13+
interface ITocNodeEntry {
14+
url?: string
15+
title?: string
16+
}
17+
18+
type TocNodeType =
19+
| ITocNodeEntry
20+
| {
21+
items: Array<TocNodeType>
22+
}
1423

1524
interface IRemarkTocOptions {
1625
maxDepth?: Options["maxDepth"]
@@ -25,33 +34,50 @@ const remarkInferTocMeta: Plugin<[IRemarkTocOptions]> = options => {
2534
}
2635

2736
const processToC = (
28-
node: TocNodeType,
29-
current: Partial<TocNodeType>
30-
): Partial<TocNodeType> => {
37+
node: BlockContent | DefinitionContent | ListItem | null,
38+
current: TocNodeType
39+
): TocNodeType => {
3140
if (!node) {
3241
return {}
33-
} else if (node.type === `paragraph`) {
34-
visit(node, item => {
35-
if (item.type === `link`) {
36-
current.url = item.url
37-
}
38-
if (item.type === `text`) {
39-
current.title = item.value
40-
}
41-
})
42-
return current
43-
} else if (Array.isArray(node.children)) {
44-
if (node.type === `list`) {
45-
current.items = node.children.map(i => processToC(i, {}))
42+
}
43+
44+
switch (node.type) {
45+
case `paragraph`: {
46+
const typedCurrent = current as ITocNodeEntry
47+
48+
visit(node, item => {
49+
if (item.type === `link`) {
50+
typedCurrent.url = item.url
51+
}
52+
if (item.type === `text`) {
53+
typedCurrent.title = item.value
54+
}
55+
})
56+
4657
return current
47-
} else if (node.type === `listItem`) {
48-
const heading = processToC(node.children[0], {})
49-
if (node.children.length > 1) {
50-
processToC(node.children[1], heading)
58+
}
59+
60+
case `list`: {
61+
const typedCurrent = current as { items: Array<TocNodeType> }
62+
63+
typedCurrent.items = node.children.map(item => processToC(item, {}))
64+
65+
return typedCurrent
66+
}
67+
68+
case `listItem`: {
69+
if (node.children.length) {
70+
const heading = processToC(node.children[0], {})
71+
72+
if (node.children.length > 1) {
73+
processToC(node.children[1], heading)
74+
}
75+
76+
return heading
5177
}
52-
return heading
5378
}
5479
}
80+
5581
return {}
5682
}
5783

@@ -62,7 +88,7 @@ const remarkInferTocMeta: Plugin<[IRemarkTocOptions]> = options => {
6288
mdxFile.data.meta = {}
6389
}
6490

65-
mdxFile.data.meta.toc = processToC(generatedToC.map as TocNodeType, {})
91+
mdxFile.data.meta.toc = processToC(generatedToC.map, {})
6692
}
6793
}
6894

‎packages/gatsby-plugin-mdx/src/remark-mdx-html-plugin.ts

+10-8
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
import type { Node } from "unist-util-visit"
2-
import type { Definition } from "mdast"
31
import toHast from "mdast-util-to-hast"
4-
52
import { cachedImport } from "./cache-helpers"
63

4+
import type { Node } from "unist-util-visit"
5+
import type { Definition, Literal } from "mdast"
6+
import type { MdxJsxAttribute, MdxJsxFlowElement } from "mdast-util-mdx"
7+
78
// This plugin replaces html nodes with JSX divs that render given HTML via dangerouslySetInnerHTML
89
// We have to find out if this is really a good idea, but its processing footprint is very low
910
// compared to other solutions that would traverse the given HTML.
@@ -33,9 +34,10 @@ export const remarkMdxHtmlPlugin = () =>
3334
return
3435
}
3536

36-
node.type = `mdxJsxFlowElement`
37-
node.name = `div`
38-
node.attributes = [
37+
const typedNode = node as MdxJsxFlowElement
38+
typedNode.type = `mdxJsxFlowElement`
39+
typedNode.name = `div`
40+
typedNode.attributes = [
3941
{
4042
type: `mdxJsxAttribute`,
4143
name: `dangerouslySetInnerHTML`,
@@ -61,7 +63,7 @@ export const remarkMdxHtmlPlugin = () =>
6163
},
6264
value: {
6365
type: `Literal`,
64-
value: node.value,
66+
value: (node as Literal).value,
6567
},
6668
kind: `init`,
6769
},
@@ -73,7 +75,7 @@ export const remarkMdxHtmlPlugin = () =>
7375
},
7476
},
7577
},
76-
},
78+
} as MdxJsxAttribute,
7779
]
7880
})
7981

‎packages/gatsby-plugin-mdx/src/remark-path-prefix-plugin.ts

+7-6
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,15 @@ export const remarkPathPlugin = ({ pathPrefix }: { pathPrefix: string }) =>
1515
`unist-util-visit`
1616
)
1717

18-
visit(markdownAST, [`link`, `definition`], node => {
18+
visit(markdownAST, [`link`, `definition`], (node: Node) => {
19+
const typedNode = node as { url?: string }
1920
if (
20-
node.url &&
21-
typeof node.url === `string` &&
22-
node.url.startsWith(`/`) &&
23-
!node.url.startsWith(`//`)
21+
typedNode.url &&
22+
typeof typedNode.url === `string` &&
23+
typedNode.url.startsWith(`/`) &&
24+
!typedNode.url.startsWith(`//`)
2425
) {
25-
node.url = withPathPrefix(node.url, pathPrefix)
26+
typedNode.url = withPathPrefix(typedNode.url, pathPrefix)
2627
}
2728
})
2829
return markdownAST

‎packages/gatsby/src/utils/webpack/bundle.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ export function build(webpackConfig: webpack.Configuration): Promise<{
3535
export function watch(
3636
webpackConfig: webpack.Configuration,
3737
onWatch: (
38-
err: Error | webpack.WebpackError | undefined,
38+
err: Error | webpack.WebpackError | undefined | null,
3939
stats: webpack.Stats | undefined
4040
) => void,
4141
watchOptions: webpack.Watching["watchOptions"] = {}

‎yarn.lock

+30-318
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)
Please sign in to comment.