Skip to content

Commit

Permalink
Merge branch 'feat/get-request-headers' of https://github.com/gatsbyj…
Browse files Browse the repository at this point in the history
…s/gatsby into feat/get-request-headers
  • Loading branch information
TylerBarnes committed May 20, 2022
2 parents fe9e2d0 + 69ba76c commit a65242b
Show file tree
Hide file tree
Showing 131 changed files with 1,130 additions and 772 deletions.
23 changes: 15 additions & 8 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,8 @@ commands:
name: Upgrade React to << parameters.react_version >>
command: "REACT_VERSION=<< parameters.react_version >> TEST_PATH=<< parameters.test_path >> node ./scripts/upgrade-react"
- run:
name: Install gatsby-dev
command: yarn global add gatsby-dev-cli
name: Install gatsby-dev@next
command: yarn global add gatsby-dev-cli@next
- run:
name: Run tests (using defaults)
command: ./scripts/e2e-test.sh "<< parameters.test_path >>" "<< parameters.test_command >>"
Expand Down Expand Up @@ -344,14 +344,21 @@ jobs:
- run: # Don't allow any fallback to root dependencies
command: yarn config set pnpFallbackMode none
working_directory: /tmp/e2e-tests/gatsby-pnp
- run: # Forces to use the local packages
command: yarn link --all --private ~/project
- run: # Install before custom registry server is set
command: yarn add start-server-and-test@^1.11.0
working_directory: /tmp/e2e-tests/gatsby-pnp
- run:
command: yarn install
- run: # Set the local registry to gatsby-dev-cli registry
command: yarn config set npmRegistryServer http://localhost:4873
working_directory: /tmp/e2e-tests/gatsby-pnp
- run:
command: yarn add start-server-and-test@^1.11.0
- run: # Allow localhost registry
command: |
echo -e 'unsafeHttpWhitelist:\n - "localhost"' >> .yarnrc.yml
working_directory: /tmp/e2e-tests/gatsby-pnp
- run: # Set project dir
command: node ~/project/packages/gatsby-dev-cli/dist/index.js --set-path-to-repo ~/project
working_directory: /tmp/e2e-tests/gatsby-pnp
- run: # Copy over packages
command: node ~/project/packages/gatsby-dev-cli/dist/index.js --force-install --scan-once --external-registry
working_directory: /tmp/e2e-tests/gatsby-pnp
- run:
command: yarn build
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
describe(`duplicate scripts`, () => {
beforeEach(() => {
cy.visit(`/gatsby-script-duplicate-scripts/`)
})

it(`should execute load callbacks of duplicate scripts`, () => {
cy.get(`[data-on-load-result=duplicate-1]`).should(`have.length`, 1)
cy.get(`[data-on-load-result=duplicate-2]`).should(`have.length`, 1)
cy.get(`[data-on-load-result=duplicate-3]`).should(`have.length`, 1)
})

it(`should execute error callbacks of duplicate scripts`, () => {
cy.get(`[data-on-error-result=duplicate-1]`).should(`have.length`, 1)
cy.get(`[data-on-error-result=duplicate-2]`).should(`have.length`, 1)
cy.get(`[data-on-error-result=duplicate-3]`).should(`have.length`, 1)
})
})
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
import React, { useState } from "react"
import { Script } from "gatsby"
import { scripts } from "../../gatsby-script-scripts"
import { onLoad, onError } from "../utils/gatsby-script-callbacks"

const DuplicateScripts = () => {
const [onLoadScriptLoaded, setOnLoadScriptLoaded] = useState(false)
const [onErrorScriptLoaded, setOnErrorScriptLoaded] = useState(false)

return (
<main>
<h1>Script component e2e test</h1>

<Script
src={scripts.marked}
onLoad={() => {
onLoad(`duplicate-1`)
}}
/>
<Script
src={scripts.marked}
onLoad={() => {
onLoad(`duplicate-2`)
setOnLoadScriptLoaded(true)
}}
/>
{onLoadScriptLoaded && (
<Script
src={scripts.marked}
onLoad={() => {
onLoad(`duplicate-3`)
}}
/>
)}

<Script
src="/non-existent-script.js"
onError={() => {
onError(`duplicate-1`)
}}
/>
<Script
src="/non-existent-script.js"
onError={() => {
onError(`duplicate-2`)
setOnErrorScriptLoaded(true)
}}
/>
{onErrorScriptLoaded && (
<Script
src="/non-existent-script.js"
onError={() => {
onError(`duplicate-3`)
}}
/>
)}
</main>
)
}

export default DuplicateScripts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Cypress.config(`defaultCommandTimeout`, 30000) // Since we're asserting network requests

describe(`duplicate scripts`, () => {
beforeEach(() => {
cy.visit(`/gatsby-script-duplicate-scripts/`)
})

it(`should execute load callbacks of duplicate scripts`, () => {
cy.get(`[data-on-load-result=duplicate-1]`).should(`have.length`, 1)
cy.get(`[data-on-load-result=duplicate-2]`).should(`have.length`, 1)
cy.get(`[data-on-load-result=duplicate-3]`).should(`have.length`, 1)
})

it(`should execute error callbacks of duplicate scripts`, () => {
cy.get(`[data-on-error-result=duplicate-1]`).should(`have.length`, 1)
cy.get(`[data-on-error-result=duplicate-2]`).should(`have.length`, 1)
cy.get(`[data-on-error-result=duplicate-3]`).should(`have.length`, 1)
})
})
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
import React, { useState } from "react"
import { Script } from "gatsby"
import { scripts } from "../../gatsby-script-scripts"
import { onLoad, onError } from "../utils/gatsby-script-callbacks"

const DuplicateScripts = () => {
const [onLoadScriptLoaded, setOnLoadScriptLoaded] = useState(false)
const [onErrorScriptLoaded, setOnErrorScriptLoaded] = useState(false)

return (
<main>
<h1>Script component e2e test</h1>

<Script
src={scripts.marked}
onLoad={() => {
onLoad(`duplicate-1`)
}}
/>
<Script
src={scripts.marked}
onLoad={() => {
onLoad(`duplicate-2`)
setOnLoadScriptLoaded(true)
}}
/>
{onLoadScriptLoaded && (
<Script
src={scripts.marked}
onLoad={() => {
onLoad(`duplicate-3`)
}}
/>
)}

<Script
src="/non-existent-script.js"
onError={() => {
onError(`duplicate-1`)
}}
/>
<Script
src="/non-existent-script.js"
onError={() => {
onError(`duplicate-2`)
setOnErrorScriptLoaded(true)
}}
/>
{onErrorScriptLoaded && (
<Script
src="/non-existent-script.js"
onError={() => {
onError(`duplicate-3`)
}}
/>
)}
</main>
)
}

export default DuplicateScripts
6 changes: 3 additions & 3 deletions packages/babel-plugin-remove-graphql-queries/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "babel-plugin-remove-graphql-queries",
"version": "4.15.0-next.1",
"version": "4.16.0-next.0",
"author": "Jason Quense <monastic.panic@gmail.com>",
"repository": {
"type": "git",
Expand All @@ -10,12 +10,12 @@
"homepage": "https://github.com/gatsbyjs/gatsby/tree/master/packages/babel-plugin-remove-graphql-queries#readme",
"dependencies": {
"@babel/runtime": "^7.15.4",
"gatsby-core-utils": "^3.15.0-next.1"
"gatsby-core-utils": "^3.16.0-next.0"
},
"devDependencies": {
"@babel/cli": "^7.15.4",
"@babel/core": "^7.15.5",
"babel-preset-gatsby-package": "^2.15.0-next.0",
"babel-preset-gatsby-package": "^2.16.0-next.0",
"cross-env": "^7.0.3"
},
"peerDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/babel-preset-gatsby-package/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "babel-preset-gatsby-package",
"version": "2.15.0-next.0",
"version": "2.16.0-next.0",
"author": "Philipp Spiess <hello@philippspiess.com>",
"repository": {
"type": "git",
Expand Down
8 changes: 4 additions & 4 deletions packages/babel-preset-gatsby/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "babel-preset-gatsby",
"version": "2.15.0-next.2",
"version": "2.16.0-next.0",
"author": "Philipp Spiess <hello@philippspiess.com>",
"repository": {
"type": "git",
Expand All @@ -22,8 +22,8 @@
"babel-plugin-dynamic-import-node": "^2.3.3",
"babel-plugin-macros": "^3.1.0",
"babel-plugin-transform-react-remove-prop-types": "^0.4.24",
"gatsby-core-utils": "^3.15.0-next.1",
"gatsby-legacy-polyfills": "^2.15.0-next.1"
"gatsby-core-utils": "^3.16.0-next.0",
"gatsby-legacy-polyfills": "^2.16.0-next.0"
},
"peerDependencies": {
"@babel/core": "^7.11.6",
Expand All @@ -38,7 +38,7 @@
},
"devDependencies": {
"@babel/cli": "^7.15.4",
"babel-preset-gatsby-package": "^2.15.0-next.0",
"babel-preset-gatsby-package": "^2.16.0-next.0",
"cross-env": "^7.0.3",
"slash": "^3.0.0"
},
Expand Down
4 changes: 2 additions & 2 deletions packages/create-gatsby/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "create-gatsby",
"version": "2.15.0-next.2",
"version": "2.16.0-next.0",
"main": "lib/index.js",
"bin": "cli.js",
"license": "MIT",
Expand Down Expand Up @@ -28,7 +28,7 @@
"eslint": "^7.32.0",
"execa": "^5.1.1",
"fs-extra": "^10.1.0",
"gatsby-plugin-utils": "^3.9.0-next.2",
"gatsby-plugin-utils": "^3.10.0-next.0",
"joi": "^17.4.2",
"microbundle": "^0.14.2",
"node-fetch": "^2.6.6",
Expand Down
10 changes: 5 additions & 5 deletions packages/gatsby-cli/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "gatsby-cli",
"description": "Gatsby command-line interface for creating new sites and running Gatsby commands",
"version": "4.15.0-next.2",
"version": "4.16.0-next.0",
"author": "Kyle Mathews <mathews.kyle@gmail.com>",
"bin": {
"gatsby": "cli.js"
Expand All @@ -26,13 +26,13 @@
"common-tags": "^1.8.2",
"configstore": "^5.0.1",
"convert-hrtime": "^3.0.0",
"create-gatsby": "^2.15.0-next.2",
"create-gatsby": "^2.16.0-next.0",
"envinfo": "^7.8.1",
"execa": "^5.1.1",
"fs-exists-cached": "^1.0.0",
"fs-extra": "^10.1.0",
"gatsby-core-utils": "^3.15.0-next.1",
"gatsby-telemetry": "^3.15.0-next.1",
"gatsby-core-utils": "^3.16.0-next.0",
"gatsby-telemetry": "^3.16.0-next.0",
"hosted-git-info": "^3.0.8",
"is-valid-path": "^0.1.1",
"joi": "^17.4.2",
Expand Down Expand Up @@ -64,7 +64,7 @@
"@rollup/plugin-replace": "^2.4.2",
"@types/hosted-git-info": "^3.0.2",
"@types/yargs": "^15.0.14",
"babel-preset-gatsby-package": "^2.15.0-next.0",
"babel-preset-gatsby-package": "^2.16.0-next.0",
"cross-env": "^7.0.3",
"ink": "^3.2.0",
"ink-spinner": "^4.0.3",
Expand Down
4 changes: 2 additions & 2 deletions packages/gatsby-codemods/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "gatsby-codemods",
"version": "3.15.0-next.0",
"version": "3.16.0-next.0",
"description": "A collection of codemod scripts for use with JSCodeshift that help migrate to newer versions of Gatsby.",
"main": "index.js",
"scripts": {
Expand Down Expand Up @@ -36,7 +36,7 @@
},
"devDependencies": {
"@babel/cli": "^7.15.4",
"babel-preset-gatsby-package": "^2.15.0-next.0",
"babel-preset-gatsby-package": "^2.16.0-next.0",
"cross-env": "^7.0.3"
},
"engines": {
Expand Down
4 changes: 2 additions & 2 deletions packages/gatsby-core-utils/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "gatsby-core-utils",
"version": "3.15.0-next.1",
"version": "3.16.0-next.0",
"description": "A collection of gatsby utils used in different gatsby packages",
"keywords": [
"gatsby",
Expand Down Expand Up @@ -62,7 +62,7 @@
"@babel/cli": "^7.15.4",
"@babel/core": "^7.15.5",
"@types/ci-info": "2.0.0",
"babel-preset-gatsby-package": "^2.15.0-next.0",
"babel-preset-gatsby-package": "^2.16.0-next.0",
"cross-env": "^7.0.3",
"is-uuid": "^1.0.2",
"msw": "^0.38.2",
Expand Down
4 changes: 2 additions & 2 deletions packages/gatsby-cypress/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "gatsby-cypress",
"version": "2.15.0-next.0",
"version": "2.16.0-next.0",
"description": "Cypress tools for Gatsby projects",
"main": "index.js",
"repository": {
Expand All @@ -20,7 +20,7 @@
"devDependencies": {
"@babel/cli": "^7.15.4",
"@babel/core": "^7.15.5",
"babel-preset-gatsby-package": "^2.15.0-next.0",
"babel-preset-gatsby-package": "^2.16.0-next.0",
"cross-env": "^7.0.3"
},
"keywords": [
Expand Down
2 changes: 1 addition & 1 deletion packages/gatsby-design-tokens/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "gatsby-design-tokens",
"version": "4.15.0-next.0",
"version": "4.16.0-next.0",
"description": "Gatsby Design Tokens",
"main": "dist/index.js",
"module": "dist/index.esm.js",
Expand Down
4 changes: 4 additions & 0 deletions packages/gatsby-dev-cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,3 +79,7 @@ Copy all modules/files in the gatsby source repo in packages/
#### `--force-install`

Disable copying files into node_modules and force usage of local npm repository.

#### `--external-registry`

Run `yarn add` commands without the `--registry` flag. This is helpful when using yarn 2/3 and you need to use `yarn config set npmRegistryServer http://localhost:4873` and `echo -e 'unsafeHttpWhitelist:\n - "localhost"' >> .yarnrc.yml` before running `gatsby-dev-cli`.
4 changes: 2 additions & 2 deletions packages/gatsby-dev-cli/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "gatsby-dev-cli",
"description": "CLI helpers for contributors working on Gatsby",
"version": "4.15.0-next.0",
"version": "4.16.0-next.0",
"author": "Kyle Mathews <mathews.kyle@gmail.com>",
"bin": {
"gatsby-dev": "./dist/index.js"
Expand All @@ -27,7 +27,7 @@
"devDependencies": {
"@babel/cli": "^7.15.4",
"@babel/core": "^7.15.5",
"babel-preset-gatsby-package": "^2.15.0-next.0",
"babel-preset-gatsby-package": "^2.16.0-next.0",
"cross-env": "^7.0.3"
},
"homepage": "https://github.com/gatsbyjs/gatsby/tree/master/packages/gatsby-dev-cli#readme",
Expand Down

0 comments on commit a65242b

Please sign in to comment.