Skip to content

Commit

Permalink
Merge branch 'master' of github.com:gatsbyjs/gatsby into fix-gatsby-s…
Browse files Browse the repository at this point in the history
…ource-contentful-srcSet
  • Loading branch information
mrseanbaines committed Jun 10, 2020
2 parents 1da5b37 + d5781c1 commit 6f407a7
Show file tree
Hide file tree
Showing 769 changed files with 42,082 additions and 17,033 deletions.
14 changes: 4 additions & 10 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -257,17 +257,11 @@ jobs:
test_path: integration-tests/gatsby-pipeline

integration_tests_gatsby_cli:
<<: *e2e-executor
executor: node
steps:
- checkout
- run:
name: Assert Changed Files
command: ./scripts/assert-changed-files.sh "packages/gatsby-cli/*|packages/gatsby/*|integration-tests/gatsby-cli/*"
- <<: *attach_to_bootstrap
- run:
name: Run tests (using defaults)
command: cd integration-tests/gatsby-cli && yarn && yarn test
- e2e-test:
test_path: integration-tests/gatsby-pipeline
trigger_pattern: packages/gatsby-cli/*|packages/gatsby/*|integration-tests/gatsby-cli/*

integration_tests_structured_logging:
executor: node
Expand Down Expand Up @@ -315,7 +309,7 @@ jobs:
command: yarn build
working_directory: ~/project/e2e-tests/gatsby-pnp
- run:
command: 'DEBUG=start-server-and-test yarn start-server-and-test "yarn develop 2>&1 | tee log.txt" :8000 "! cat log.txt | grep ''ERROR #''"'
command: 'DEBUG=start-server-and-test yarn start-server-and-test "yarn develop 2>&1 | tee log.txt" :8000 "! cat log.txt | grep -E ''ERROR #|Require stack:''"'
working_directory: ~/project/e2e-tests/gatsby-pnp

e2e_tests_gatsby-image:
Expand Down
4 changes: 2 additions & 2 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ module.exports = {
// This rule tries to prevent using `require()`. However in node code,
// there are times where this makes sense. And it specifically is causing
// problems in our tests where we often want this functionality for module
// mocking. At this point it's easier to have it off and just encouarge
// mocking. At this point it's easier to have it off and just encourage
// using top-level imports via code reviews.
"@typescript-eslint/no-var-requires": "off",
// This rule ensures that typescript types do not have semicolons
Expand Down Expand Up @@ -142,7 +142,7 @@ module.exports = {
// This ensures that we always type the return type of functions
// a high level focus of our TS setup is typing fn inputs and outputs.
"@typescript-eslint/explicit-function-return-type": "error",
// This forces us to use interfaces over types aliases for object defintions.
// This forces us to use interfaces over types aliases for object definitions.
// Type is still useful for opaque types
// e.g.,
// type UUID = string
Expand Down
1 change: 0 additions & 1 deletion .remarkrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ module.exports = {
// We would like these rules to be enabled, but they require significant content changes
// and need additional PRs to be implemented
["remark-lint-emphasis-marker", false],
["remark-lint-heading-increment", false],
["remark-lint-no-heading-punctuation", false],
["remark-lint-list-item-spacing", false],

Expand Down
2 changes: 1 addition & 1 deletion benchmarks/markdown_id/gatsby-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module.exports = {
title: `Gatsby MD Benchmark Blog`,
author: `Myle Kathews`,
description: `The MD starter blog turned into a benchmark`,
siteUrl: `https://gatsby-starter-blog-demo.netlify.com/`,
siteUrl: `https://gatsby-starter-blog-demo.netlify.app/`,
social: {
twitter: `gatsbyjs`,
},
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/markdown_slug/gatsby-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module.exports = {
title: `Gatsby MD Benchmark Blog`,
author: `Myle Kathews`,
description: `The MD starter blog turned into a benchmark`,
siteUrl: `https://gatsby-starter-blog-demo.netlify.com/`,
siteUrl: `https://gatsby-starter-blog-demo.netlify.app/`,
social: {
twitter: `gatsbyjs`,
},
Expand Down
5 changes: 5 additions & 0 deletions benchmarks/source-cosmicjs/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
BENCHMARK_COSMIC_BUCKET=
BENCHMARK_COSMIC_API_URL=
BENCHMARK_COSMIC_READ_KEY=
BENCHMARK_COSMIC_WRITE_KEY=
BENCHMARK_COSMIC_DATASET=512
70 changes: 70 additions & 0 deletions benchmarks/source-cosmicjs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# nyc test coverage
.nyc_output

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# Typescript v1 declaration files
typings/

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# dotenv environment variable files
.env.development
.env.production

# gatsby files
.cache/
public

# Mac files
.DS_Store

# Yarn
yarn-error.log
.pnp/
.pnp.js
# Yarn Integrity file
.yarn-integrity
4 changes: 4 additions & 0 deletions benchmarks/source-cosmicjs/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.cache
package.json
package-lock.json
public
7 changes: 7 additions & 0 deletions benchmarks/source-cosmicjs/.prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"endOfLine": "lf",
"semi": false,
"singleQuote": false,
"tabWidth": 2,
"trailingComma": "es5"
}
21 changes: 21 additions & 0 deletions benchmarks/source-cosmicjs/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2018 gatsbyjs

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
7 changes: 7 additions & 0 deletions benchmarks/source-cosmicjs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Cosmic JS Will it Build

Example page for Cosmic JS as a source for "Will It Build".
Should/Will be generalized into e.g. a theme.

Queries the title, body and a cover image from Cosmic JS. Creates pages for that and displays those three things as "Articles".
Those individual article pages and the homepage share a common "Layout" component (in src/components) that can be swapped (layout_1.js and layout_2.js) to simulate a code change in multiple pages.
1 change: 1 addition & 0 deletions benchmarks/source-cosmicjs/gatsby-browser.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import "./src/styles.css"
33 changes: 33 additions & 0 deletions benchmarks/source-cosmicjs/gatsby-config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
require("dotenv").config({
path: `.env.${process.env.NODE_ENV}`,
})

module.exports = {
siteMetadata: {
siteTitle: `Gatsby Cosmic JS Benchmark`,
},
plugins: [
`gatsby-plugin-benchmark-reporting`,
`gatsby-plugin-sharp`,
`gatsby-transformer-sharp`,
{
resolve: `gatsby-source-filesystem`,
options: {
name: `pages`,
path: `${__dirname}/src/pages/`,
},
},
{
resolve: `gatsby-source-cosmicjs`,
options: {
apiURL: process.env.BENCHMARK_COSMIC_API_URL,
bucketSlug: process.env.BENCHMARK_COSMIC_BUCKET,
objectTypes: [`posts`],
apiAccess: {
read_key: process.env.BENCHMARK_COSMIC_READ_KEY,
},
localMedia: true,
},
},
],
}
39 changes: 39 additions & 0 deletions benchmarks/source-cosmicjs/gatsby-node.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
const kebabCase = require(`lodash.kebabcase`)

exports.onCreateNode = ({ actions, node }) => {
const { createNodeField } = actions

if (node.internal.type === 'node__article') {
createNodeField({ node, name: "slug", value: kebabCase(node.title) })
}
}

exports.createPages = async ({ actions, graphql, reporter }) => {
const { createPage } = actions

const result = await graphql(`
{
articles: allCosmicjsPosts {
edges {
node {
slug
}
}
}
}
`)

if (result.errors) {
reporter.panicOnBuild(result.errors)
}

result.data.articles.edges.map(article => {
createPage({
path: article.node.slug,
component: require.resolve(`./src/templates/article.js`),
context: {
slug: article.node.slug,
}
})
})
}
41 changes: 41 additions & 0 deletions benchmarks/source-cosmicjs/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"name": "gatsby-cosmicjs-benchmark",
"private": true,
"description": "A simplified bare-bones starter for Gatsby",
"version": "0.1.0",
"license": "MIT",
"scripts": {
"build": "gatsby build",
"build:send": "cross-env BENCHMARK_REPORTING_URL=true gatsby build",
"develop": "gatsby develop",
"format": "prettier --write \"**/*.{js,jsx,json,md}\"",
"start": "npm run develop",
"serve": "gatsby serve",
"data-update": "NODE_ENV=production node update-post.js"
},
"dependencies": {
"cosmicjs": "^3.2.45",
"dotenv": "^8.2.0",
"gatsby": "^2.19.7",
"gatsby-image": "^2.2.40",
"gatsby-plugin-benchmark-reporting": "*",
"gatsby-plugin-sharp": "^2.4.5",
"gatsby-source-cosmicjs": "^1.1.0",
"gatsby-source-filesystem": "^2.1.48",
"gatsby-transformer-sharp": "^2.3.14",
"lodash.kebabcase": "^4.1.1",
"react": "^16.12.0",
"react-dom": "^16.12.0"
},
"devDependencies": {
"cross-env": "^7.0.0",
"prettier": "^1.19.1"
},
"repository": {
"type": "git",
"url": "https://github.com/gatsbyjs/gatsby-starter-hello-world"
},
"bugs": {
"url": "https://github.com/gatsbyjs/gatsby/issues"
}
}
12 changes: 12 additions & 0 deletions benchmarks/source-cosmicjs/src/components/layout_1.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import React from "react"

const Layout = ({ children }) => (
<>
<header>
<h1>Header A</h1>
</header>
<main>{children}</main>
</>
)

export default Layout
12 changes: 12 additions & 0 deletions benchmarks/source-cosmicjs/src/components/layout_2.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import React from "react"

const Layout = ({ children }) => (
<>
<header>
<h1>Header B</h1>
</header>
<main>{children}</main>
</>
)

export default Layout
38 changes: 38 additions & 0 deletions benchmarks/source-cosmicjs/src/pages/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import React from "react"
import { Link, graphql } from "gatsby"
import Layout from "../components/layout_1"

const Index = ({ data }) => {
return (
<Layout>
{data.site.siteMetadata.siteTitle}
<ul>
{data.articles.edges.map(article => (
<li>
<Link to={article.node.slug}>{article.node.title}</Link>
</li>
))}
</ul>
</Layout>
)
}

export default Index

export const query = graphql`
{
site {
siteMetadata {
siteTitle
}
}
articles: allCosmicjsPosts {
edges {
node {
title
slug
}
}
}
}
`
4 changes: 4 additions & 0 deletions benchmarks/source-cosmicjs/src/styles.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
main {
max-width: 960px;
margin: 0 auto;
}
Loading

0 comments on commit 6f407a7

Please sign in to comment.