Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: gatsbyjs/gatsby
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: gatsby@2.24.29
Choose a base ref
...
head repository: gatsbyjs/gatsby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: gatsby@2.24.30
Choose a head ref
  • 6 commits
  • 37 files changed
  • 6 contributors

Commits on Aug 5, 2020

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    b8cac4b View commit details
  2. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    64bf6fe View commit details
  3. chore: Add Strapi benchmark (#26245)

    Co-authored-by: Rémi de Juvigny <remidejuvigny@Remis-MacBook-Pro.local>
    remidej and Rémi de Juvigny authored Aug 5, 2020

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    6afe6ce View commit details
  4. fix(gatsby): enable ipc messaging on develop (#26221)

    * add test for ipc send in develop
    
    * fix: enable onMessage for ipc on develop
    
    * Update develop.ts
    
    * Update develop.ts
    wardpeet authored Aug 5, 2020

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    a063a1f View commit details
  5. fix(gatsby-recipes): Handle string values in NPMPackageJSON + more ro…

    …bust showing of validation errors on install (#26252)
    
    * Handle string values in NPMPackageJSON + more robust showing of validation errors on install
    
    * update snapshots
    KyleAMathews authored Aug 5, 2020

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    3a5d46d View commit details
  6. chore(release): Publish

     - gatsby-admin@0.1.119
     - gatsby-cli@2.12.75
     - gatsby-recipes@0.2.5
     - gatsby-remark-code-repls@3.2.11
     - gatsby-remark-embed-snippet@4.3.14
     - gatsby@2.24.30
    KyleAMathews committed Aug 5, 2020
    Copy the full SHA
    1c72df3 View commit details
Showing with 552 additions and 42 deletions.
  1. +3 −0 benchmarks/source-strapi/.env.example
  2. +71 −0 benchmarks/source-strapi/.gitignore
  3. +4 −0 benchmarks/source-strapi/.prettierignore
  4. +4 −0 benchmarks/source-strapi/.prettierrc
  5. +22 −0 benchmarks/source-strapi/LICENSE
  6. +13 −0 benchmarks/source-strapi/README.md
  7. +7 −0 benchmarks/source-strapi/gatsby-browser.js
  8. +22 −0 benchmarks/source-strapi/gatsby-config.js
  9. +34 −0 benchmarks/source-strapi/gatsby-node.js
  10. +43 −0 benchmarks/source-strapi/package.json
  11. +12 −0 benchmarks/source-strapi/src/components/layout_1.js
  12. +12 −0 benchmarks/source-strapi/src/components/layout_2.js
  13. 0 benchmarks/source-strapi/src/images/.gitkeep
  14. +7 −0 benchmarks/source-strapi/src/pages/404.js
  15. +42 −0 benchmarks/source-strapi/src/pages/index.js
  16. +35 −0 benchmarks/source-strapi/src/templates/article.js
  17. +43 −0 benchmarks/source-strapi/update-post.js
  18. +56 −0 integration-tests/structured-logging/__tests__/ipc-send.js
  19. +4 −0 packages/gatsby-admin/CHANGELOG.md
  20. +2 −2 packages/gatsby-admin/package.json
  21. +4 −0 packages/gatsby-cli/CHANGELOG.md
  22. +2 −2 packages/gatsby-cli/package.json
  23. +6 −0 packages/gatsby-recipes/CHANGELOG.md
  24. +1 −1 packages/gatsby-recipes/package.json
  25. +19 −9 packages/gatsby-recipes/src/cli/index.js
  26. +30 −12 packages/gatsby-recipes/src/providers/npm/__snapshots__/package-json.test.js.snap
  27. +8 −4 packages/gatsby-recipes/src/providers/npm/package-json.js
  28. +4 −0 packages/gatsby-remark-code-repls/CHANGELOG.md
  29. +2 −2 packages/gatsby-remark-code-repls/package.json
  30. +4 −0 packages/gatsby-remark-embed-snippet/CHANGELOG.md
  31. +2 −2 packages/gatsby-remark-embed-snippet/package.json
  32. +6 −0 packages/gatsby/CHANGELOG.md
  33. +3 −3 packages/gatsby/package.json
  34. +15 −2 packages/gatsby/src/commands/develop.ts
  35. +7 −2 www/src/views/starter/details.js
  36. +1 −1 www/src/views/starter/header.js
  37. +2 −0 www/src/views/starter/source.js
3 changes: 3 additions & 0 deletions benchmarks/source-strapi/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
BENCHMARK_STRAPI_API_URL="<strapi url without trailing slash>"
BENCHMARK_STRAPI_DATASET="512"
BENCHMARK_STRAPI_UPDATE_TOKEN="<secret token string>"
71 changes: 71 additions & 0 deletions benchmarks/source-strapi/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# 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

# gatsby files
.cache/
public

# Mac files
.DS_Store

# Yarn
yarn-error.log
.pnp/
.pnp.js
# Yarn Integrity file
.yarn-integrity

.env
.env.local
.env.staging
.env.production
4 changes: 4 additions & 0 deletions benchmarks/source-strapi/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.cache
package.json
package-lock.json
public
4 changes: 4 additions & 0 deletions benchmarks/source-strapi/.prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"arrowParens": "avoid",
"semi": false
}
22 changes: 22 additions & 0 deletions benchmarks/source-strapi/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
The MIT License (MIT)

Copyright (c) 2015 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.

13 changes: 13 additions & 0 deletions benchmarks/source-strapi/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Strapi Will it Build Example

Provides 2 layout components (`src/components/layout_1.js` and `src/components/layout_2.js`) to simulate code changes.

Create a .env file from the template:

`cp .env.example .env`

Update data:

```sh
yarn date-update
```
7 changes: 7 additions & 0 deletions benchmarks/source-strapi/gatsby-browser.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/**
* Implement Gatsby's Browser APIs in this file.
*
* See: https://www.gatsbyjs.org/docs/browser-apis/
*/

// You can delete this file if you're not using it
22 changes: 22 additions & 0 deletions benchmarks/source-strapi/gatsby-config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
require("dotenv").config()

module.exports = {
siteMetadata: {
url: process.env.BENCHMARK_STRAPI_API_URL || "http://localhost:1337", // No trailing slash allowed!
},
plugins: [
`gatsby-plugin-benchmark-reporting`,
{
resolve: "gatsby-source-strapi",
options: {
apiURL: process.env.BENCHMARK_STRAPI_API_URL || "http://localhost:1337",
contentTypes: [
"article",
],
queryLimit: parseInt(process.env.BENCHMARK_STRAPI_DATASET),
},
},
"gatsby-transformer-sharp",
"gatsby-plugin-sharp",
],
}
34 changes: 34 additions & 0 deletions benchmarks/source-strapi/gatsby-node.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
exports.createPages = async ({ graphql, actions }) => {
const { createPage } = actions
const result = await graphql(
`
{
articles: allStrapiArticle {
edges {
node {
strapiId
id
}
}
}
}
`
)

if (result.errors) {
throw result.errors
}

// Create blog articles pages.
const articles = result.data.articles.edges

articles.forEach((article, index) => {
createPage({
path: `/article/${article.node.id}`,
component: require.resolve("./src/templates/article.js"),
context: {
id: article.node.id,
},
})
})
}
43 changes: 43 additions & 0 deletions benchmarks/source-strapi/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{
"name": "gatsby-strapi-willitbuild-front",
"private": true,
"version": "0.1.0",
"dependencies": {
"gatsby": "^2.24.27",
"gatsby-image": "^2.4.5",
"gatsby-plugin-benchmark-reporting": "^0.2.14",
"gatsby-plugin-sharp": "^2.6.24",
"gatsby-source-filesystem": "^2.3.23",
"gatsby-source-strapi": "^0.0.12",
"gatsby-transformer-sharp": "^2.5.12",
"node-fetch": "^2.6.0",
"prop-types": "^15.7.2",
"react": "^16.12.0",
"react-dom": "^16.12.0",
"sharp": "^0.25.4"
},
"devDependencies": {
"prettier": "2.0.5"
},
"keywords": [
"gatsby"
],
"license": "MIT",
"scripts": {
"build": "gatsby build",
"data-update": "NODE_ENV=production node update-post.js",
"develop": "gatsby develop",
"format": "prettier --write \"**/*.{js,jsx,json,md}\"",
"start": "npm run develop",
"serve": "gatsby serve",
"clean": "gatsby clean",
"test": "echo \"Write tests! -> https://gatsby.dev/unit-testing\" && exit 1"
},
"repository": {
"type": "git",
"url": "https://github.com/gatsbyjs/gatsby-starter-default"
},
"bugs": {
"url": "https://github.com/gatsbyjs/gatsby/issues"
}
}
12 changes: 12 additions & 0 deletions benchmarks/source-strapi/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-strapi/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
Empty file.
7 changes: 7 additions & 0 deletions benchmarks/source-strapi/src/pages/404.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import React from 'react'

const NotFound = () => (
<div>404 not found</div>
)

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

const IndexPage = () => (
<Layout>
<StaticQuery
query={graphql`
query {
allStrapiArticle {
edges {
node {
id
title
}
}
}
}
`}
render={data => (
<div>
<div>
<h1>All articles</h1>
<ul>
{data.allStrapiArticle.edges.map((article) => {
return (
<li key={article.node.id}>
<Link to={`/article/${article.node.id}`}>
<p>{article.node.title}</p>
</Link>
</li>
)
})}
</ul>
</div>
</div>
)}
/>
</Layout>
)

export default IndexPage
35 changes: 35 additions & 0 deletions benchmarks/source-strapi/src/templates/article.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import React from "react"
import { graphql } from "gatsby"
import Img from "gatsby-image"
import Layout from "../components/layout_1"

export const query = graphql`
query ArticleQuery($id: String) {
strapiArticle(id: { eq: $id }) {
title
content
image {
childImageSharp {
fluid(maxWidth: 960, quality: 90) {
...GatsbyImageSharpFluid_withWebp_tracedSVG
}
}
}
}
}
`

const Article = ({ data }) => {
const article = data.strapiArticle
return (
<Layout>
<h1>{article.title}</h1>
{article.image?.childImageSharp && (
<Img fluid={article.image.childImageSharp.fluid} />
)}
<div dangerouslySetInnerHTML={{ __html: article.content }} />
</Layout>
)
}

export default Article
43 changes: 43 additions & 0 deletions benchmarks/source-strapi/update-post.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
require("dotenv").config()

const fetch = require("node-fetch")

const getRandomArticle = async () => {
// Get random article ID
const randomIndex = Math.floor(
Math.random() * (Number(process.env.BENCHMARK_STRAPI_DATASET))
)
// Fetch article data
const articlesResponse = await fetch(
`${process.env.BENCHMARK_STRAPI_API_URL}/articles?_start=${randomIndex}&_limit=1`
)
const articles = await articlesResponse.json()
return articles[0]
}

const updateArticle = async (article) => {
// Add ! at the end of the title
const response = await fetch(
`${process.env.BENCHMARK_STRAPI_API_URL}/articles/${article.id}?token=${process.env.BENCHMARK_STRAPI_UPDATE_TOKEN}`,
{
method: 'PUT',
body: JSON.stringify({
title: article.title + '!',
}),
},
)
if (response.ok) {
console.log('update success')
} else {
console.log('update error')
}
}

const start = async () => {
// Fetch random existing article
const article = await getRandomArticle()
// Update it
await updateArticle(article)
}

start()
Loading