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.56
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.57
Choose a head ref
  • 9 commits
  • 32 files changed
  • 7 contributors

Commits on Sep 9, 2020

  1. Update yarn.lock

    sidharthachatterjee committed Sep 9, 2020
    Copy the full SHA
    c39bf21 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
    a264c45 View commit details

Commits on Sep 10, 2020

  1. fix(gatsby-recipes): renable e2e test for npm package resource & fix …

    …dev/prod resource bug (#26699)
    
    * Add test for installing dev & prod packages & fix bugs for it
    
    * normalize package.json
    
    * Update snapshots
    
    * restore resolve-cwd
    
    * Make mock installs async
    
    * Back out mock-package-install
    
    * fix lock
    
    * Revert changes
    
    * Fix reading package.json + split fixtures so they don't accidentally read each others work which screws up snapshots
    
    * Removed 'root' from lock keys as that wasn't necessary — fix was splitting up fixtures
    
    * Use smaller packages
    
    * meaningless change to trigger tests again for flaky test
    
    * Update packages/gatsby-recipes/src/providers/npm/package.js
    
    Co-authored-by: Matt Kane <matt@gatsbyjs.com>
    
    * Update packages/gatsby-recipes/src/providers/gatsby/plugin.js
    
    Co-authored-by: Ward Peeters <ward@coding-tech.com>
    
    Co-authored-by: gatsbybot <mathews.kyle+gatsbybot@gmail.com>
    Co-authored-by: Matt Kane <matt@gatsbyjs.com>
    Co-authored-by: Ward Peeters <ward@coding-tech.com>
    4 people authored Sep 10, 2020

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    6d963af 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
    cb2c3ff View commit details
  3. fix(gatsby): Run actions while recreating pages and draining mutation…

    … queue (#26847)
    
    * Run API while recreating pages
    
    * We don't mark nodes dirt when creating pages, as we'll always create sitepages and rebuild the schema after
    ascorbic authored Sep 10, 2020

    Verified

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

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    ddddc40 View commit details
  5. fix(gatsby): do not initialize cache in onPreInit API (#26810)

    Co-authored-by: gatsbybot <mathews.kyle+gatsbybot@gmail.com>
    vladar and gatsbybot authored Sep 10, 2020

    Verified

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

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

     - gatsby-admin@0.1.146
     - gatsby-cli@2.12.95
     - gatsby-plugin-sharp@2.6.35
     - gatsby-recipes@0.2.24
     - gatsby-source-contentful@2.3.45
     - gatsby-transformer-sqip@2.3.35
     - gatsby@2.24.57
    ascorbic committed Sep 10, 2020
    Copy the full SHA
    a389c0e View commit details
Showing with 507 additions and 291 deletions.
  1. +4 −0 packages/gatsby-admin/CHANGELOG.md
  2. +2 −2 packages/gatsby-admin/package.json
  3. +4 −0 packages/gatsby-cli/CHANGELOG.md
  4. +2 −2 packages/gatsby-cli/package.json
  5. +4 −0 packages/gatsby-plugin-sharp/CHANGELOG.md
  6. +3 −3 packages/gatsby-plugin-sharp/package.json
  7. +4 −4 packages/gatsby-plugin-sharp/src/process-file.js
  8. +6 −0 packages/gatsby-recipes/CHANGELOG.md
  9. +2 −1 packages/gatsby-recipes/package.json
  10. +3 −3 packages/gatsby-recipes/src/providers/gatsby/plugin.js
  11. +66 −0 packages/gatsby-recipes/src/providers/npm/__snapshots__/package.test.js.snap
  12. 0 packages/gatsby-recipes/src/providers/npm/fixtures/{ → package-json}/package.json
  13. +4 −0 packages/gatsby-recipes/src/providers/npm/fixtures/scripts/package.json
  14. +1 −1 packages/gatsby-recipes/src/providers/npm/package-json.test.js
  15. +30 −18 packages/gatsby-recipes/src/providers/npm/package.js
  16. +15 −3 packages/gatsby-recipes/src/providers/npm/package.test.js
  17. +1 −1 packages/gatsby-recipes/src/providers/npm/script.test.js
  18. +4 −0 packages/gatsby-source-contentful/CHANGELOG.md
  19. +2 −2 packages/gatsby-source-contentful/package.json
  20. +4 −0 packages/gatsby-transformer-sqip/CHANGELOG.md
  21. +2 −2 packages/gatsby-transformer-sqip/package.json
  22. +8 −0 packages/gatsby/CHANGELOG.md
  23. +2 −2 packages/gatsby/package.json
  24. +0 −3 packages/gatsby/src/state-machines/data-layer/actions.ts
  25. +0 −2 packages/gatsby/src/state-machines/data-layer/index.ts
  26. +8 −2 packages/gatsby/src/state-machines/develop/index.ts
  27. +8 −0 packages/gatsby/src/state-machines/waiting/actions.ts
  28. +6 −4 packages/gatsby/src/state-machines/waiting/index.ts
  29. +67 −2 packages/gatsby/src/utils/__tests__/api-runner-node.js
  30. +21 −1 packages/gatsby/src/utils/api-runner-node.js
  31. +4 −0 renovate.json5
  32. +220 −233 yarn.lock
4 changes: 4 additions & 0 deletions packages/gatsby-admin/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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.1.146](https://github.com/gatsbyjs/gatsby/compare/gatsby-admin@0.1.145...gatsby-admin@0.1.146) (2020-09-10)

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

## [0.1.145](https://github.com/gatsbyjs/gatsby/compare/gatsby-admin@0.1.144...gatsby-admin@0.1.145) (2020-09-09)

**Note:** Version bump only for package gatsby-admin
4 changes: 2 additions & 2 deletions packages/gatsby-admin/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "gatsby-admin",
"version": "0.1.145",
"version": "0.1.146",
"main": "index.js",
"author": "Max Stoiber",
"license": "MIT",
@@ -19,7 +19,7 @@
"csstype": "^2.6.10",
"feedback-fish": "^0.1.12",
"formik": "^2.1.4",
"gatsby": "^2.24.56",
"gatsby": "^2.24.57",
"gatsby-interface": "0.0.183",
"gatsby-plugin-typescript": "^2.4.19",
"gatsby-plugin-webfonts": "^1.1.3",
4 changes: 4 additions & 0 deletions packages/gatsby-cli/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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.12.95](https://github.com/gatsbyjs/gatsby/compare/gatsby-cli@2.12.94...gatsby-cli@2.12.95) (2020-09-10)

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

## [2.12.94](https://github.com/gatsbyjs/gatsby/compare/gatsby-cli@2.12.93...gatsby-cli@2.12.94) (2020-09-09)

**Note:** Version bump only for package gatsby-cli
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.12.94",
"version": "2.12.95",
"author": "Kyle Mathews <mathews.kyle@gmail.com>",
"bin": {
"gatsby": "cli.js"
@@ -24,7 +24,7 @@
"fs-exists-cached": "^1.0.0",
"fs-extra": "^8.1.0",
"gatsby-core-utils": "^1.3.19",
"gatsby-recipes": "^0.2.23",
"gatsby-recipes": "^0.2.24",
"gatsby-telemetry": "^1.3.32",
"hosted-git-info": "^3.0.4",
"ink": "^2.7.1",
4 changes: 4 additions & 0 deletions packages/gatsby-plugin-sharp/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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.6.35](https://github.com/gatsbyjs/gatsby/compare/gatsby-plugin-sharp@2.6.34...gatsby-plugin-sharp@2.6.35) (2020-09-10)

**Note:** Version bump only for package gatsby-plugin-sharp

## [2.6.34](https://github.com/gatsbyjs/gatsby/compare/gatsby-plugin-sharp@2.6.33...gatsby-plugin-sharp@2.6.34) (2020-09-09)

**Note:** Version bump only for package gatsby-plugin-sharp
6 changes: 3 additions & 3 deletions packages/gatsby-plugin-sharp/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "gatsby-plugin-sharp",
"description": "Wrapper of the Sharp image manipulation library for Gatsby plugins",
"version": "2.6.34",
"version": "2.6.35",
"author": "Kyle Mathews <mathews.kyle@gmail.com>",
"bugs": {
"url": "https://github.com/gatsbyjs/gatsby/issues"
@@ -14,8 +14,8 @@
"gatsby-core-utils": "^1.3.19",
"got": "^10.7.0",
"imagemin": "^7.0.1",
"imagemin-mozjpeg": "^8.0.0",
"imagemin-pngquant": "^6.0.1",
"imagemin-mozjpeg": "^9.0.0",
"imagemin-pngquant": "^9.0.1",
"lodash": "^4.17.19",
"mini-svg-data-uri": "^1.2.3",
"potrace": "^2.1.8",
8 changes: 4 additions & 4 deletions packages/gatsby-plugin-sharp/src/process-file.js
Original file line number Diff line number Diff line change
@@ -194,10 +194,10 @@ const compressPng = (pipeline, outputPath, options) =>
.buffer(sharpBuffer, {
plugins: [
imageminPngquant({
quality: `${options.pngQuality || options.quality}-${Math.min(
(options.pngQuality || options.quality) + 25,
100
)}`, // e.g. 40-65
quality: [
(options.pngQuality || options.quality) / 100,
Math.min(((options.pngQuality || options.quality) + 25) / 100, 1),
], // e.g. [0.4, 0.65]
speed: options.pngCompressionSpeed
? options.pngCompressionSpeed
: undefined,
6 changes: 6 additions & 0 deletions packages/gatsby-recipes/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -3,6 +3,12 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

## [0.2.24](https://github.com/gatsbyjs/gatsby/compare/gatsby-recipes@0.2.23...gatsby-recipes@0.2.24) (2020-09-10)

### Bug Fixes

- **gatsby-recipes:** renable e2e test for npm package resource & fix dev/prod resource bug ([#26699](https://github.com/gatsbyjs/gatsby/issues/26699)) ([6d963af](https://github.com/gatsbyjs/gatsby/commit/6d963af6d86cd5e9acf4db0d4be6b1ef37fb8dcf))

## [0.2.23](https://github.com/gatsbyjs/gatsby/compare/gatsby-recipes@0.2.22...gatsby-recipes@0.2.23) (2020-09-09)

### Bug Fixes
3 changes: 2 additions & 1 deletion packages/gatsby-recipes/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "gatsby-recipes",
"description": "Core functionality for Gatsby Recipes",
"version": "0.2.23",
"version": "0.2.24",
"author": "Kyle Mathews <mathews.kyle@gmail.com>",
"bugs": {
"url": "https://github.com/gatsbyjs/gatsby/issues"
@@ -75,6 +75,7 @@
"remark-parse": "^6.0.3",
"remark-stringify": "^8.1.0",
"resolve-cwd": "^3.0.0",
"resolve-from": "^5.0.0",
"semver": "^7.3.2",
"single-trailing-newline": "^1.0.0",
"strip-ansi": "^6.0.0",
6 changes: 3 additions & 3 deletions packages/gatsby-recipes/src/providers/gatsby/plugin.js
Original file line number Diff line number Diff line change
@@ -99,8 +99,8 @@ const getNameForPlugin = node => {
return null
}

const getDescriptionForPlugin = async name => {
const pkg = await readPackageJSON({}, name)
const getDescriptionForPlugin = async (root, name) => {
const pkg = await readPackageJSON(root, name)

return pkg?.description || ``
}
@@ -245,7 +245,7 @@ const read = async ({ root }, id) => {

if (plugin) {
const [description, readme] = await Promise.all([
getDescriptionForPlugin(id),
getDescriptionForPlugin(root, id),
getReadmeForPlugin(id),
])
const { shadowedFiles, shadowableFiles } = listShadowableFilesForTheme(
Original file line number Diff line number Diff line change
@@ -1,5 +1,71 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`npm package resource e2e npm package resource test: NPMPackage create 1`] = `
Object {
"_message": "Installed NPM package is-sorted@1.0.0",
"description": "A small module to check if an Array is sorted",
"id": "is-sorted",
"name": "is-sorted",
"version": "1.0.0",
}
`;

exports[`npm package resource e2e npm package resource test: NPMPackage create plan 1`] = `
Object {
"currentState": undefined,
"describe": "Install is-sorted@1.0.0",
"newState": "is-sorted@1.0.0",
}
`;

exports[`npm package resource e2e npm package resource test: NPMPackage destroy 1`] = `
Object {
"_message": "Installed NPM package is-sorted@1.0.2",
"description": "A small module to check if an Array is sorted",
"id": "is-sorted",
"name": "is-sorted",
"version": "1.0.2",
}
`;

exports[`npm package resource e2e npm package resource test: NPMPackage update 1`] = `
Object {
"_message": "Installed NPM package is-sorted@1.0.2",
"description": "A small module to check if an Array is sorted",
"id": "is-sorted",
"name": "is-sorted",
"version": "1.0.2",
}
`;

exports[`npm package resource e2e npm package resource test: NPMPackage update plan 1`] = `
Object {
"currentState": "is-sorted@1.0.0",
"describe": "Install is-sorted@1.0.2",
"newState": "is-sorted@1.0.2",
}
`;

exports[`npm package resource installs 2 resources, one prod & one dev 1`] = `
Object {
"_message": "Installed NPM package div@2.0.0",
"description": "&lt;Div row&gt; Use flexbox with ease in React! &lt;/Div&gt;",
"id": "div",
"name": "div",
"version": "2.0.0",
}
`;

exports[`npm package resource installs 2 resources, one prod & one dev 2`] = `
Object {
"_message": "Installed NPM package is-odd@3.0.1",
"description": "Returns true if the given number is odd, and is an integer that does not exceed the JavaScript MAXIMUM_SAFE_INTEGER.",
"id": "is-odd",
"name": "is-odd",
"version": "3.0.1",
}
`;

exports[`package manager client commands generates the correct commands for npm 1`] = `
Array [
"install",
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"name": "test",
"scripts": {}
}
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@ const path = require(`path`)
const pkgJson = require(`./package-json`)
const resourceTestHelper = require(`../resource-test-helper`)

const root = path.join(__dirname, `fixtures`)
const root = path.join(__dirname, `fixtures`, `package-json`)

const name = `husky`
const initialValue = JSON.stringify(
48 changes: 30 additions & 18 deletions packages/gatsby-recipes/src/providers/npm/package.js
Original file line number Diff line number Diff line change
@@ -4,18 +4,31 @@ const Joi = require(`@hapi/joi`)
const path = require(`path`)
const fs = require(`fs-extra`)
const { getConfigStore } = require(`gatsby-core-utils`)
const resolveCwd = require(`resolve-cwd`)
const resolveFrom = require(`resolve-from`)
const lock = require(`../lock`)

const packageMangerConfigKey = `cli.packageManager`
const PACKAGE_MANGER = getConfigStore().get(packageMangerConfigKey) || `yarn`

const resourceSchema = require(`../resource-schema`)

const readPackageJson = async (root, pkg) => {
let obj
try {
const fullPath = resolveFrom(root, path.join(pkg, `package.json`))
const contents = await fs.readFile(fullPath, `utf8`)
obj = JSON.parse(contents)
} catch (e) {
// ignore
}
return obj
}

const getPackageNames = packages => packages.map(n => `${n.name}@${n.version}`)

// Generate install commands
const generateClientComands = ({ packageManager, depType, packageNames }) => {
let commands = []
const commands = []
if (packageManager === `yarn`) {
commands.push(`add`)
// Needed for Yarn Workspaces and is a no-opt elsewhere.
@@ -48,7 +61,7 @@ const executeInstalls = async root => {
const depType = installs[0].resource.dependencyType
const packagesToInstall = types[depType]
installs = installs.filter(
i => !_.some(packagesToInstall, p => i.resource.id === p.resource.id)
i => !packagesToInstall.some(p => i.resource.name === p.resource.name)
)

const pkgs = packagesToInstall.map(p => p.resource)
@@ -60,6 +73,7 @@ const executeInstalls = async root => {
packageManager: PACKAGE_MANGER,
})

const release = await lock(`package.json`)
try {
await execa(PACKAGE_MANGER, commands, {
cwd: root,
@@ -75,12 +89,13 @@ const executeInstalls = async root => {
)
})
}
release()

packagesToInstall.forEach(p => p.outsideResolve())

// Run again if there's still more installs.
if (installs.length > 0) {
executeInstalls()
executeInstalls(root)
}

return undefined
@@ -118,22 +133,19 @@ const create = async ({ root }, resource) => {
}

const read = async ({ root }, id) => {
let packageJSON
try {
packageJSON = JSON.parse(
await fs.readFile(resolveCwd(path.join(id, `package.json`)))
)
} catch (e) {
const pkg = await readPackageJson(root, id)

if (pkg) {
return {
id,
name: id,
description: pkg.description,
version: pkg.version,
_message: `Installed NPM package ${id}@${pkg.version}`,
}
} else {
return undefined
}

return {
id: packageJSON.name,
name: packageJSON.name,
description: packageJSON.description,
version: packageJSON.version,
_message: `Installed NPM package ${packageJSON.name}@${packageJSON.version}`,
}
}

const schema = {
18 changes: 15 additions & 3 deletions packages/gatsby-recipes/src/providers/npm/package.test.js
Original file line number Diff line number Diff line change
@@ -8,15 +8,15 @@ const resourceTestHelper = require(`../resource-test-helper`)

const root = path.join(os.tmpdir(), uuid.v4())
fs.mkdirSync(root)
const pkgResource = { name: `glob` }
const pkgResource = { name: `div` }

test(`plan returns a description`, async () => {
const result = await pkg.plan({ root }, pkgResource)

expect(result.describe).toEqual(expect.stringContaining(`Install glob`))
expect(result.describe).toEqual(expect.stringContaining(`Install div`))
})

describe.skip(`npm package resource`, () => {
describe(`npm package resource`, () => {
test(`e2e npm package resource test`, async () => {
await resourceTestHelper({
resourceModule: pkg,
@@ -26,6 +26,18 @@ describe.skip(`npm package resource`, () => {
partialUpdate: { name: `is-sorted`, version: `1.0.2` },
})
})
test(`installs 2 resources, one prod & one dev`, async () => {
await Promise.all([
pkg.create({ root }, { name: `div` }),
pkg.create({ root }, { name: `is-odd`, dependencyType: `development` }),
])

const divResource = await pkg.read({ root }, `div`)
const isOddResource = await pkg.read({ root }, `is-odd`)

expect(divResource).toMatchSnapshot()
expect(isOddResource).toMatchSnapshot()
}, 20000)
})

describe(`package manager client commands`, () => {
2 changes: 1 addition & 1 deletion packages/gatsby-recipes/src/providers/npm/script.test.js
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@ const path = require(`path`)
const script = require(`./script`)
const resourceTestHelper = require(`../resource-test-helper`)

const root = path.join(__dirname, `fixtures`)
const root = path.join(__dirname, `fixtures`, `scripts`)

describe(`npm script resource`, () => {
test(`e2e script resource test`, async () => {
4 changes: 4 additions & 0 deletions packages/gatsby-source-contentful/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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.3.45](https://github.com/gatsbyjs/gatsby/compare/gatsby-source-contentful@2.3.44...gatsby-source-contentful@2.3.45) (2020-09-10)

**Note:** Version bump only for package gatsby-source-contentful

## [2.3.44](https://github.com/gatsbyjs/gatsby/compare/gatsby-source-contentful@2.3.43...gatsby-source-contentful@2.3.44) (2020-09-09)

**Note:** Version bump only for package gatsby-source-contentful
Loading