Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into muescha/fix/docs-…
Browse files Browse the repository at this point in the history
…bash-to-shell
  • Loading branch information
gatsbybot committed Apr 22, 2020
2 parents 0373819 + c8da75e commit 896ffed
Show file tree
Hide file tree
Showing 66 changed files with 667 additions and 392 deletions.
3 changes: 3 additions & 0 deletions benchmarks/markdown_id/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,10 @@
"react-dom": "^16.12.0",
"react-helmet": "^5.2.1",
"react-typography": "^0.16.19",
"ts-node": "^8.9.0",
"typeface-merriweather": "0.0.72",
"typeface-montserrat": "0.0.75",
"typescript": "^3.8.3",
"typography": "^0.16.19",
"typography-theme-wordpress-2016": "^0.16.19"
},
Expand All @@ -46,6 +48,7 @@
"bench": "rm -r markdown-pages; NUM_PAGES=${NUM_PAGES:-2000} node md.generate.js; gatsby clean; node --max_old_space_size=2000 node_modules/.bin/gatsby build",
"benchnb": "gatsby clean; node --max_old_space_size=2000 node_modules/.bin/gatsby build",
"build": "gatsby build",
"data-update": "ts-node scripts/data-update.ts",
"develop": "gatsby develop",
"start": "npm run develop",
"serve": "gatsby serve",
Expand Down
1 change: 1 addition & 0 deletions benchmarks/markdown_id/scripts/data-update.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
// noop for now, but will be created later.
3 changes: 3 additions & 0 deletions benchmarks/markdown_slug/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,10 @@
"react-dom": "^16.12.0",
"react-helmet": "^5.2.1",
"react-typography": "^0.16.19",
"ts-node": "^8.9.0",
"typeface-merriweather": "0.0.72",
"typeface-montserrat": "0.0.75",
"typescript": "^3.8.3",
"typography": "^0.16.19",
"typography-theme-wordpress-2016": "^0.16.19"
},
Expand All @@ -46,6 +48,7 @@
"bench": "rm -r markdown-pages; NUM_PAGES=${NUM_PAGES:-2000} node md.generate.js; gatsby clean; node --max_old_space_size=2000 node_modules/.bin/gatsby build",
"benchnb": "gatsby clean; node --max_old_space_size=2000 node_modules/.bin/gatsby build",
"build": "gatsby build",
"data-update": "ts-node scripts/data-update.ts",
"develop": "gatsby develop",
"start": "npm run develop",
"serve": "gatsby serve",
Expand Down
1 change: 1 addition & 0 deletions benchmarks/markdown_slug/scripts/data-update.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
// noop for now, but will be created later.
5 changes: 4 additions & 1 deletion benchmarks/markdown_table/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,16 @@
"bench": "set -x; gatsby clean; NUM_PAGES=${NUM_PAGES:-2000} gatsby build",
"develop": "gatsby develop",
"build": "gatsby build",
"data-update": "ts-node scripts/data-update.ts",
"serve": "gatsby serve"
},
"dependencies": {
"gatsby": "^2.19.5",
"gatsby-transformer-remark": "^2.6.48",
"react": "^16.12.0",
"react-dom": "^16.12.0"
"react-dom": "^16.12.0",
"ts-node": "^8.9.0",
"typescript": "^3.8.3"
},
"devDependencies": {
"faker": "^4.1.0",
Expand Down
1 change: 1 addition & 0 deletions benchmarks/markdown_table/scripts/data-update.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
// noop for now, but will be created later.
5 changes: 4 additions & 1 deletion benchmarks/mdx/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"scripts": {
"build": "gatsby build",
"build:send": "cross-env BENCHMARK_REPORTING_URL=true gatsby build",
"data-update": "ts-node scripts/data-update.ts",
"develop": "gatsby develop",
"format": "prettier --write \"**/*.{js,jsx,json,md}\"",
"postinstall": "del-cli src/articles && gatsby clean && willit --use-pregenerated-data --type=mdx --num-pages=${NUM_PAGES:-512}",
Expand All @@ -27,7 +28,9 @@
"gatsby-source-filesystem": "^2.2.3",
"gatsby-transformer-sharp": "^2.4.5",
"react": "^16.12.0",
"react-dom": "^16.12.0"
"react-dom": "^16.12.0",
"ts-node": "^8.9.0",
"typescript": "^3.8.3"
},
"devDependencies": {
"cross-env": "^7.0.0",
Expand Down
1 change: 1 addition & 0 deletions benchmarks/mdx/scripts/data-update.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
// noop for now, but will be created later.
5 changes: 4 additions & 1 deletion benchmarks/source-contentful/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"scripts": {
"clean": "gatsby clean",
"build": "gatsby build",
"data-update": "ts-node scripts/data-update.ts",
"develop": "gatsby develop",
"format": "prettier --write \"**/*.{js,jsx,json,md}\"",
"serve": "gatsby serve",
Expand All @@ -26,7 +27,9 @@
"gatsby-source-filesystem": "^2.1.48",
"gatsby-transformer-sharp": "^2.3.14",
"react": "^16.12.0",
"react-dom": "^16.12.0"
"react-dom": "^16.12.0",
"ts-node": "^8.9.0",
"typescript": "^3.8.3"
},
"devDependencies": {
"chalk": "^2.4.2",
Expand Down
1 change: 1 addition & 0 deletions benchmarks/source-contentful/scripts/data-update.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
// noop for now, but will be created later.
5 changes: 4 additions & 1 deletion benchmarks/source-datocms/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"scripts": {
"build": "gatsby build",
"build:send": "cross-env BENCHMARK_REPORTING_URL=true gatsby build",
"data-update": "ts-node scripts/data-update.ts",
"develop": "gatsby develop",
"format": "prettier --write \"**/*.{js,jsx,json,md}\"",
"serve": "gatsby serve",
Expand All @@ -22,7 +23,9 @@
"gatsby-transformer-sharp": "^2.3.14",
"lodash.kebabcase": "^4.1.1",
"react": "^16.12.0",
"react-dom": "^16.12.0"
"react-dom": "^16.12.0",
"ts-node": "^8.9.0",
"typescript": "^3.8.3"
},
"devDependencies": {
"cross-env": "^7.0.0",
Expand Down
1 change: 1 addition & 0 deletions benchmarks/source-datocms/scripts/data-update.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
// noop for now, but will be created later.
2 changes: 2 additions & 0 deletions benchmarks/source-drupal/.env.example
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
BENCHMARK_DRUPAL_BASE_URL=
BENCHMARK_DRUPAL_USERNAME=
BENCHMARK_DRUPAL_PASSWORD=
7 changes: 6 additions & 1 deletion benchmarks/source-drupal/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,27 @@
"scripts": {
"build": "gatsby build",
"build:send": "cross-env BENCHMARK_REPORTING_URL=true gatsby build",
"data-update": "ts-node scripts/data-update.ts",
"develop": "gatsby develop",
"format": "prettier --write \"**/*.{js,jsx,json,md}\"",
"start": "npm run develop",
"serve": "gatsby serve"
},
"dependencies": {
"dotenv": "^8.2.0",
"faker": "^4.1.0",
"gatsby": "^2.19.7",
"gatsby-image": "^2.2.40",
"gatsby-plugin-sharp": "^2.4.5",
"gatsby-source-drupal": "^3.3.18",
"gatsby-source-filesystem": "^2.1.48",
"gatsby-transformer-sharp": "^2.3.14",
"lodash.kebabcase": "^4.1.1",
"node-fetch": "^2.6.0",
"react": "^16.12.0",
"react-dom": "^16.12.0"
"react-dom": "^16.12.0",
"ts-node": "^8.6.2",
"typescript": "^3.8.3"
},
"devDependencies": {
"cross-env": "^7.0.0",
Expand Down
13 changes: 13 additions & 0 deletions benchmarks/source-drupal/scripts/data-update.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/usr/bin/env node

import { update } from "./updater"

require("dotenv").config({
path: `.env.${process.env.NODE_ENV}`,
})

const username = process.env.BENCHMARK_DRUPAL_USERNAME
const password = process.env.BENCHMARK_DRUPAL_PASSWORD
const server = process.env.BENCHMARK_DRUPAL_BASE_URL

update(username, password, server)
62 changes: 62 additions & 0 deletions benchmarks/source-drupal/scripts/updater.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
import fetch from "node-fetch"
import faker from "faker"

interface IArticle {
id: string
attributes: {
title: string
}
}

// Remove last word of title and replace it with a random word.
const updateTitle = (title: string): string =>
`${title.substring(0, title.lastIndexOf(` `))} ${faker.lorem.word()}`

const patchArticle = async (
username: string,
password: string,
server: string,
article: IArticle
): Promise<void> => {
const url = `${server}/jsonapi/node/article/${article.id}`

const response = await fetch(url, {
method: `PATCH`,
headers: {
"Content-Type": `application/vnd.api+json`,
Authorization: `Basic ${Buffer.from(`${username}:${password}`).toString(
`base64`
)}`,
},
body: JSON.stringify({
data: {
type: `node--article`,
id: article.id,
attributes: {
title: updateTitle(article.attributes.title),
},
},
}),
})
}

const getFirstArticle = async (server: string): Promise<IArticle> => {
const url = `${server}/jsonapi/node/article?page[limit]=1&sort=created`
const response = await fetch(url)
const body = await response.json()
return body.data[0]
}

export const update = async (
username?: string,
password?: string,
server?: string
): Promise<void> => {
if (!username || !password || !server) {
console.error(`You must pass username, password and server`)
return
}

const article = await getFirstArticle(server)
await patchArticle(username, password, server, article)
}
11 changes: 11 additions & 0 deletions benchmarks/source-drupal/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"compilerOptions": {
"typeRoots": ["./node_modules/@types", "./typings"],
"target": "ES2018" /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', or 'ESNEXT'. */,
"module": "commonjs" /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */,
"strict": true /* Enable all strict type-checking options. */,
"esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */,
"forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */,
"noImplicitAny": false
}
}
5 changes: 4 additions & 1 deletion benchmarks/source-wordpress/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"scripts": {
"build": "gatsby build",
"build:send": "cross-env BENCHMARK_REPORTING_URL=true gatsby build",
"data-update": "ts-node scripts/data-update.ts",
"develop": "gatsby develop",
"format": "prettier --write \"**/*.{js,jsx,json,md}\"",
"serve": "gatsby serve",
Expand All @@ -21,7 +22,9 @@
"gatsby-source-wordpress-experimental": "^0.0.31",
"gatsby-transformer-sharp": "^2.3.14",
"react": "^16.12.0",
"react-dom": "^16.12.0"
"react-dom": "^16.12.0",
"ts-node": "^8.9.0",
"typescript": "^3.8.3"
},
"devDependencies": {
"cross-env": "^7.0.0",
Expand Down
1 change: 1 addition & 0 deletions benchmarks/source-wordpress/scripts/data-update.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
// noop for now, but will be created later.
4 changes: 4 additions & 0 deletions packages/babel-preset-gatsby/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

## [0.3.4](https://github.com/gatsbyjs/gatsby/compare/[email protected]@0.3.4) (2020-04-22)

**Note:** Version bump only for package babel-preset-gatsby

## [0.3.3](https://github.com/gatsbyjs/gatsby/compare/[email protected]@0.3.3) (2020-04-17)

### Bug Fixes
Expand Down
2 changes: 1 addition & 1 deletion 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": "0.3.3",
"version": "0.3.4",
"author": "Philipp Spiess <[email protected]>",
"repository": {
"type": "git",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const preset = require(`../dependencies`)
import preset from "../dependencies"
import * as pathSerializer from "../utils/path-serializer"

expect.addSnapshotSerializer(pathSerializer)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
// This file is heavily based on create-react-app's implementation
// @see https://github.com/facebook/create-react-app/blob/master/packages/babel-preset-react-app/dependencies.js

const path = require(`path`)
const resolve = m => require.resolve(m)
import path from "path"

module.exports = function (api, options = {}) {
// export default is required here because it is passed directly to webpack
// via require.resolve
// This function has a better inference than would be beneficial to type, and it's relatively easy to grok.
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
export default () => {
const absoluteRuntimePath = path.dirname(
resolve(`@babel/runtime/package.json`)
require.resolve(`@babel/runtime/package.json`)
)

return {
Expand All @@ -18,7 +21,7 @@ module.exports = function (api, options = {}) {
presets: [
[
// Latest stable ECMAScript features
resolve(`@babel/preset-env`),
require.resolve(`@babel/preset-env`),
{
// Allow importing core-js in entrypoint and use browserlist to select polyfills
useBuiltIns: `usage`,
Expand All @@ -33,7 +36,7 @@ module.exports = function (api, options = {}) {
// Polyfills the runtime needed for async/await, generators, and friends
// https://babeljs.io/docs/en/babel-plugin-transform-runtime
[
resolve(`@babel/plugin-transform-runtime`),
require.resolve(`@babel/plugin-transform-runtime`),
{
corejs: false,
helpers: true,
Expand All @@ -49,7 +52,7 @@ module.exports = function (api, options = {}) {
},
],
// Adds syntax support for import()
resolve(`@babel/plugin-syntax-dynamic-import`),
require.resolve(`@babel/plugin-syntax-dynamic-import`),
],
}
}
4 changes: 4 additions & 0 deletions packages/gatsby-cli/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

## [2.11.15](https://github.com/gatsbyjs/gatsby/compare/[email protected]@2.11.15) (2020-04-22)

**Note:** Version bump only for package gatsby-cli

## [2.11.14](https://github.com/gatsbyjs/gatsby/compare/[email protected]@2.11.14) (2020-04-21)

**Note:** Version bump only for package gatsby-cli
Expand Down
4 changes: 2 additions & 2 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": "2.11.14",
"version": "2.11.15",
"author": "Kyle Mathews <[email protected]>",
"bin": {
"gatsby": "lib/index.js"
Expand All @@ -26,7 +26,7 @@
"fs-exists-cached": "^1.0.0",
"fs-extra": "^8.1.0",
"gatsby-core-utils": "^1.1.3",
"gatsby-recipes": "^0.0.11",
"gatsby-recipes": "^0.0.12",
"gatsby-telemetry": "^1.2.5",
"hosted-git-info": "^3.0.4",
"is-valid-path": "^0.1.1",
Expand Down
Loading

0 comments on commit 896ffed

Please sign in to comment.