-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
feat(gatsby): enable modern builds for gatsby #14289
Changes from 10 commits
16f2ba1
ba811f3
7fb16a5
b2119ce
39a60a8
7a61cf7
2479897
8ffefd1
d964eb0
3c7fcb3
d801a91
8d1b31d
6eb26de
bf9ecee
b570b2d
d4523b1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# Project dependencies | ||
.cache | ||
node_modules | ||
yarn-error.log | ||
|
||
# Build directory | ||
/public | ||
.DS_Store | ||
|
||
# Cypress output | ||
cypress/videos/ | ||
cypress/screenshots/ |
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,3 @@ | ||||||
# production-runtime | ||||||
|
||||||
A Gatsby project to test our production runtime for Themes | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"baseUrl": "http://localhost:9000", | ||
"chromeWebSecurity": false | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. File can be deleted since it isn't used |
||
"name": "Using fixtures to represent data", | ||
"email": "hello@cypress.io", | ||
"body": "Fixtures are a great way to mock data for responses to routes" | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
/* global cy */ | ||
|
||
describe(`Preload`, () => { | ||
it(`preloads on first visit`, () => { | ||
cy.visit(`/`).waitForRouteChange() | ||
}) | ||
|
||
it(`preloads Gatsby Link tags`, () => {}) | ||
}) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// *********************************************************** | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Probably get rid of this folder and its contents as well |
||
// This example plugins/index.js can be used to load plugins | ||
// | ||
// You can change the location of this file or turn off loading | ||
// the plugins file with the 'pluginsFile' configuration option. | ||
// | ||
// You can read more here: | ||
// https://on.cypress.io/plugins-guide | ||
// *********************************************************** | ||
|
||
// This function is called when a project is opened or re-opened (e.g. due to | ||
// the project's config changing) | ||
|
||
module.exports = (on, config) => { | ||
// `on` is used to hook into various events Cypress emits | ||
// `config` is the resolved Cypress config | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
import "gatsby-cypress" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
if (typeof window !== `undefined`) { | ||
window.___PageComponentLifecycleCallsLog = [] | ||
} | ||
|
||
const addLogEntry = (action, location) => { | ||
const idElement = document.querySelector(`[data-testid="dom-marker"]`) | ||
window.___PageComponentLifecycleCallsLog.push({ | ||
action, | ||
pathname: location.pathname, | ||
domContent: idElement ? idElement.innerText : null, | ||
}) | ||
} | ||
|
||
exports.onPreRouteUpdate = ({ location }) => { | ||
addLogEntry(`onPreRouteUpdate`, location) | ||
} | ||
|
||
exports.onRouteUpdate = ({ location }) => { | ||
addLogEntry(`onRouteUpdate`, location) | ||
} | ||
|
||
exports.onPrefetchPathname = ({ pathname }) => { | ||
addLogEntry(`onPrefetchPathname`, pathname) | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
module.exports = { | ||
siteMetadata: { | ||
title: `Modern Builds are awesome`, | ||
description: `Testing modern builds, yeah!`, | ||
author: `Ward Peeters`, | ||
}, | ||
plugins: [], | ||
} |
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,34 @@ | ||||||
{ | ||||||
"name": "production-runtime", | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
"description": "Gatsby default starter", | ||||||
wardpeet marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
"version": "1.0.0", | ||||||
"author": "Sidhartha Chatterjee <sid@gatsbyjs.com>", | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
"dependencies": { | ||||||
"gatsby": "^2.13.14", | ||||||
"react": "^16.8.0", | ||||||
"react-dom": "^16.8.0" | ||||||
}, | ||||||
"license": "MIT", | ||||||
"scripts": { | ||||||
"build": "cross-env ENABLE_MODERN_BUILDS=1 gatsby build", | ||||||
"develop": "cross-env ENABLE_MODERN_BUILDS=1 gatsby develop", | ||||||
"format": "prettier --write \"src/**/*.js\"", | ||||||
"serve": "gatsby serve", | ||||||
"start": "npm run develop", | ||||||
"test": "cross-env CYPRESS_SUPPORT=y npm run build && npm run start-server-and-test", | ||||||
"start-server-and-test": "start-server-and-test serve http://localhost:9000 cy:run", | ||||||
"cy:open": "cypress open", | ||||||
"cy:run": "cypress run --browser chrome" | ||||||
}, | ||||||
"devDependencies": { | ||||||
"cross-env": "^5.2.0", | ||||||
"cypress": "^3.1.3", | ||||||
"gatsby-cypress": "^0.1.7", | ||||||
"prettier": "^1.15.2", | ||||||
"start-server-and-test": "^1.7.11" | ||||||
}, | ||||||
"repository": { | ||||||
"type": "git", | ||||||
"url": "https://github.com/gatsbyjs/gatsby-starter-default" | ||||||
wardpeet marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
} | ||||||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import React from "react" | ||
import { graphql, Link } from "gatsby" | ||
|
||
export default ({ data }) => ( | ||
<> | ||
<p data-testid="title">{data.site.siteMetadata.title}</p> | ||
<p data-testid="author">{data.site.siteMetadata.author}</p> | ||
|
||
<Link to="/page-2">Go to page 2</Link> | ||
</> | ||
) | ||
|
||
export const pageQuery = graphql` | ||
query { | ||
site { | ||
siteMetadata { | ||
title | ||
author | ||
} | ||
} | ||
} | ||
` |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import React from "react" | ||
|
||
export default ({ data }) => <p>Page 2</p> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.