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.7
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.8
Choose a head ref

Commits on Jul 20, 2020

  1. Copy the full SHA
    16ee206 View commit details
  2. Start moving gatsby-telemetry to typescript (#25812)

    * Fix camelCase
    
    * Start moving gatsby-telemetry to ts
    
    * Continue converting base to typescript
    
    * Debug transpilation issues
    
    * Debug transpilation issues
    
    * Fix telemetry tests
    jamo authored Jul 20, 2020
    Copy the full SHA
    2a72ec1 View commit details
  3. Copy the full SHA
    2e6825a View commit details
  4. Copy the full SHA
    6f0d756 View commit details
  5. Detect vercel again after rebranding in gatsby-telemetry (#25883)

    * Detect vercel again after rebranding as per https://vercel.com/docs/v2/build-step
    
    * Add another Vercel NOW matcher
    jamo authored Jul 20, 2020
    Copy the full SHA
    76d97eb View commit details
  6. Copy the full SHA
    dc4db50 View commit details
  7. Copy the full SHA
    d2e356d View commit details
  8. fix: update www (#25874)

    Co-authored-by: Renovate Bot <bot@renovateapp.com>
    renovate[bot] and renovate-bot authored Jul 20, 2020
    Copy the full SHA
    ca23506 View commit details

Commits on Jul 21, 2020

  1. docs(gatsby-internals): update page -> node dependency tracking (#25606)

    * docs(gatsby-internals): update page -> node dependency tracking
    
    * Apply suggestions from code review
    
    Co-authored-by: Aisha Blake <aisha@gatsbyjs.com>
    pieh and Aisha Blake authored Jul 21, 2020
    Copy the full SHA
    09b3688 View commit details
  2. Copy the full SHA
    03379a5 View commit details
  3. fixed typo (#25896)

    dawood6 authored Jul 21, 2020
    Copy the full SHA
    3f04458 View commit details
  4. Copy the full SHA
    42d342e View commit details
  5. Added the link to 'MDX' (#25905)

    Haseeb Khan authored Jul 21, 2020
    Copy the full SHA
    9f4ead5 View commit details
  6. Update localization-i18n.md (#25902)

    Some important links for **React-intl** had broken due to update in repo whose links were given. Added the correct links to it.
    kaknut authored Jul 21, 2020
    Copy the full SHA
    d27da8c View commit details
  7. added a cookieflags option (#25907)

    Co-authored-by: Thijs van Diessen <thijs.vandiessen@incentro.com>
    thijsvandiessen and thijsvandiessen authored Jul 21, 2020
    Copy the full SHA
    3686df2 View commit details
  8. Copy the full SHA
    d404d87 View commit details
  9. Copy the full SHA
    91ad0eb View commit details
  10. Copy the full SHA
    69d4a29 View commit details
  11. Copy the full SHA
    de087b0 View commit details
  12. Copy the full SHA
    a0c70d0 View commit details
  13. feat(gatsby-admin): plugin search (#25903)

    * Copy plugin search from www into admin
    
    * Move to Combobox search
    
    * Cleanup
    
    * TypeScript cleanup
    
    * add algolia types
    
    * Fix syntax
    mxstbr authored Jul 21, 2020
    Copy the full SHA
    0506123 View commit details
  14. fix: Restore CLI port in use prompt feature (#25863)

    * fix: Restore CLI port in use prompt feature
    
    Seems like it got accidentally removed during a big PR?
    
    * fix: Ensure port var types are the same
    
    The CLI option and default value for `port` is a string, despite the TypeScript typing the arg to `number`.
    
    Unclear if `port` should be a `number` elsewhere, so checking for and converting to a number within the utility.
    polarathene authored Jul 21, 2020
    Copy the full SHA
    fc2f6f0 View commit details
  15. Fix/follow up 25863 (#25915)

    * fix: Restore CLI port in use prompt feature
    
    Seems like it got accidentally removed during a big PR?
    
    * fix: Ensure port var types are the same
    
    The CLI option and default value for `port` is a string, despite the TypeScript typing the arg to `number`.
    
    Unclear if `port` should be a `number` elsewhere, so checking for and converting to a number within the utility.
    
    * Force program.port to a number early
    
    Co-authored-by: polarathene <5098581+polarathene@users.noreply.github.com>
    blainekasten and polarathene authored Jul 21, 2020
    Copy the full SHA
    99a573c View commit details
  16. chore(release): Publish

     - babel-preset-gatsby@0.5.3
     - gatsby-admin@0.1.97
     - gatsby-cli@2.12.64
     - gatsby-core-utils@1.3.13
     - gatsby-page-utils@0.2.18
     - gatsby-plugin-google-analytics@2.3.13
     - gatsby-plugin-manifest@2.4.20
     - gatsby-plugin-mdx@1.2.28
     - gatsby-plugin-offline@3.2.20
     - gatsby-plugin-page-creator@2.3.18
     - gatsby-plugin-preload-fonts@1.2.18
     - gatsby-plugin-sharp@2.6.21
     - gatsby-recipes@0.1.54
     - gatsby-remark-images@3.3.20
     - gatsby-source-contentful@2.3.29
     - gatsby-source-drupal@3.5.24
     - gatsby-source-filesystem@2.3.21
     - gatsby-source-shopify@3.2.23
     - gatsby-source-wordpress@3.3.24
     - gatsby-telemetry@1.3.21
     - gatsby-transformer-remark@2.8.26
     - gatsby-transformer-sqip@2.3.21
     - gatsby@2.24.8
    blainekasten committed Jul 21, 2020
    Copy the full SHA
    b0953b0 View commit details
Showing with 850 additions and 407 deletions.
  1. +1 −1 README.md
  2. +1 −1 dictionary.txt
  3. +4 −4 docs/blog/2020-07-20-Khaled-Garbaya-Life-After-Recipes/index.md
  4. +1 −1 docs/docs/building-a-contact-form.md
  5. +1 −1 docs/docs/localization-i18n.md
  6. +19 −24 docs/docs/page-node-dependencies.md
  7. +15 −0 docs/sites.yml
  8. +1 −1 examples/using-css-modules/src/pages/index.js
  9. +4 −0 packages/babel-preset-gatsby/CHANGELOG.md
  10. +2 −2 packages/babel-preset-gatsby/package.json
  11. +7 −0 packages/gatsby-admin/CHANGELOG.md
  12. +6 −2 packages/gatsby-admin/package.json
  13. +106 −0 packages/gatsby-admin/src/components/plugin-search.tsx
  14. +1 −0 packages/gatsby-admin/src/components/providers.tsx
  15. +30 −94 packages/gatsby-admin/src/pages/index.tsx
  16. +4 −0 packages/gatsby-cli/CHANGELOG.md
  17. +4 −4 packages/gatsby-cli/package.json
  18. +4 −0 packages/gatsby-core-utils/CHANGELOG.md
  19. +1 −1 packages/gatsby-core-utils/package.json
  20. +4 −2 packages/gatsby-core-utils/src/ci.ts
  21. +4 −0 packages/gatsby-page-utils/CHANGELOG.md
  22. +2 −2 packages/gatsby-page-utils/package.json
  23. +4 −0 packages/gatsby-plugin-google-analytics/CHANGELOG.md
  24. +1 −0 packages/gatsby-plugin-google-analytics/README.md
  25. +1 −1 packages/gatsby-plugin-google-analytics/package.json
  26. +1 −0 packages/gatsby-plugin-google-analytics/src/gatsby-ssr.js
  27. +4 −0 packages/gatsby-plugin-manifest/CHANGELOG.md
  28. +2 −2 packages/gatsby-plugin-manifest/package.json
  29. +4 −0 packages/gatsby-plugin-mdx/CHANGELOG.md
  30. +2 −2 packages/gatsby-plugin-mdx/package.json
  31. +4 −0 packages/gatsby-plugin-offline/CHANGELOG.md
  32. +2 −2 packages/gatsby-plugin-offline/package.json
  33. +4 −0 packages/gatsby-plugin-page-creator/CHANGELOG.md
  34. +2 −2 packages/gatsby-plugin-page-creator/package.json
  35. +4 −0 packages/gatsby-plugin-preload-fonts/CHANGELOG.md
  36. +2 −2 packages/gatsby-plugin-preload-fonts/package.json
  37. +4 −0 packages/gatsby-plugin-sharp/CHANGELOG.md
  38. +2 −2 packages/gatsby-plugin-sharp/package.json
  39. +4 −0 packages/gatsby-recipes/CHANGELOG.md
  40. +1 −1 packages/gatsby-recipes/README.md
  41. +3 −3 packages/gatsby-recipes/package.json
  42. +4 −0 packages/gatsby-remark-images/CHANGELOG.md
  43. +2 −2 packages/gatsby-remark-images/package.json
  44. +4 −0 packages/gatsby-source-contentful/CHANGELOG.md
  45. +4 −4 packages/gatsby-source-contentful/package.json
  46. +4 −0 packages/gatsby-source-drupal/CHANGELOG.md
  47. +2 −2 packages/gatsby-source-drupal/package.json
  48. +4 −0 packages/gatsby-source-filesystem/CHANGELOG.md
  49. +2 −2 packages/gatsby-source-filesystem/package.json
  50. +11 −0 packages/gatsby-source-shopify/CHANGELOG.md
  51. +15 −0 packages/gatsby-source-shopify/README.md
  52. +2 −2 packages/gatsby-source-shopify/package.json
  53. +132 −60 packages/gatsby-source-shopify/src/__tests__/__snapshots__/index.js.snap
  54. +1 −0 packages/gatsby-source-shopify/src/__tests__/fixtures/shop-details.json
  55. +1 −0 packages/gatsby-source-shopify/src/constants.js
  56. +52 −20 packages/gatsby-source-shopify/src/gatsby-node.js
  57. +5 −1 packages/gatsby-source-shopify/src/nodes.js
  58. +10 −0 packages/gatsby-source-shopify/src/queries.js
  59. +4 −0 packages/gatsby-source-wordpress/CHANGELOG.md
  60. +2 −2 packages/gatsby-source-wordpress/package.json
  61. +4 −0 packages/gatsby-telemetry/CHANGELOG.md
  62. +2 −2 packages/gatsby-telemetry/package.json
  63. +1 −1 packages/gatsby-telemetry/src/__tests__/{is-truthy.js → is-truthy.ts}
  64. +2 −2 packages/gatsby-telemetry/src/__tests__/{telemetry.js → telemetry.ts}
  65. +19 −0 packages/gatsby-telemetry/src/create-flush.ts
  66. +8 −0 packages/gatsby-telemetry/src/declarations.d.ts
  67. +1 −1 packages/gatsby-telemetry/src/event-storage.js
  68. +0 −17 packages/gatsby-telemetry/src/flush.js
  69. +0 −42 packages/gatsby-telemetry/src/index.js
  70. +57 −0 packages/gatsby-telemetry/src/index.ts
  71. +1 −3 packages/gatsby-telemetry/src/{is-truthy.js → is-truthy.ts}
  72. +1 −1 packages/gatsby-telemetry/src/repository-id.ts
  73. +0 −10 packages/gatsby-telemetry/src/send.js
  74. +10 −0 packages/gatsby-telemetry/src/send.ts
  75. +6 −10 packages/gatsby-telemetry/src/{showAnalyticsNotification.js → show-analytics-notification.ts}
  76. +77 −43 packages/gatsby-telemetry/src/{telemetry.js → telemetry.ts}
  77. +4 −0 packages/gatsby-transformer-remark/CHANGELOG.md
  78. +2 −2 packages/gatsby-transformer-remark/package.json
  79. +4 −0 packages/gatsby-transformer-sqip/CHANGELOG.md
  80. +2 −2 packages/gatsby-transformer-sqip/package.json
  81. +8 −0 packages/gatsby/CHANGELOG.md
  82. +6 −6 packages/gatsby/package.json
  83. +15 −0 packages/gatsby/src/commands/develop.ts
  84. +2 −3 packages/gatsby/src/utils/detect-port-in-use-and-prompt.ts
  85. +5 −1 packages/gatsby/src/utils/get-static-dir.ts
  86. +5 −5 www/package.json
  87. +74 −4 yarn.lock
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -73,7 +73,7 @@ Gatsby is a modern web framework for blazing fast websites.
to load your data, then develop using Gatsby’s uniform GraphQL interface.

- **Performance Is Baked In.** Ace your performance audits by default. Gatsby automates code
splitting, image optimization, inlining critical styles, lazy-loading, and prefetching resources,
splitting, image optimization, inlining critical styles, lazy-loading, prefetching resources,
and more to ensure your site is fast — no manual tuning required.

- **Host at Scale for Pennies.** Gatsby sites don’t require servers so you can host your entire
2 changes: 1 addition & 1 deletion dictionary.txt
Original file line number Diff line number Diff line change
@@ -372,7 +372,7 @@ CodeName
Codenames
codeowner
codeowners
Codepen
CodePen
CodeSandbox
codesplitting
collegial
Original file line number Diff line number Diff line change
@@ -36,23 +36,23 @@ npm install tailwindcss gatsby-plugin-postcss

2. Add `gatsby-plugin-postcss` to your `gatsby-config.js` file

```javascript
```javascript:title=gatsby-config.js
{
plugins: [`gatsby-plugin-postcss`]
}
```

3. Create a `postcss.config.js` file and add the following snippet to it:

```javascript
```javascript:title=postcss.config.js
module.exports = {
plugins: [require("tailwindcss"), require("autoprefixer")],
}
```

4. Create a `tailwind.config.js` file and add the following snippet to it:

```javascript
```javascript:title=tailwind.config.js
module.exports = {
purge: ["./src/**/*.js"],
theme: {
@@ -65,7 +65,7 @@ module.exports = {

5. Create a `tailwind.css` file and add the following snippet to it:

```css
```css:title=tailwind.css
@tailwind base;
@tailwind components;
@tailwind utilities;
2 changes: 1 addition & 1 deletion docs/docs/building-a-contact-form.md
Original file line number Diff line number Diff line change
@@ -68,7 +68,7 @@ Getform is a form backend platform which offers a free-plan for handling form su

Once you've made the code changes to your form, you can head over to the contact page on your site and start submitting data to the form. The submissions will then be visible on the Getform dashboard. You can add multiple email addresses to receive email notifications for the forms created, as well as manipulate the data you see on Getform using Zapier and Webhooks options that are offered.

You can find more info on the registration process and form setup on the [Getform website](https://getform.io/) and find code examples (AJAX, reCAPTCHA etc) on their [Codepen](https://codepen.io/getform).
You can find more info on the registration process and form setup on the [Getform website](https://getform.io/) and find code examples (AJAX, reCAPTCHA etc) on their [CodePen](https://codepen.io/getform).

### Netlify

2 changes: 1 addition & 1 deletion docs/docs/localization-i18n.md
Original file line number Diff line number Diff line change
@@ -30,7 +30,7 @@ URL - /**en**/about

React-intl is a part of the FormatJS set of i18n libraries and provides support for over 150+ languages. It builds on JavaScript's [Internationalization API](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl) providing enhanced APIs and components. React-intl uses React context and HOCs (Higher Order Components) to provide translations allowing you to dynamically load language modules as you need them. There are also polyfill options available for older browsers that do not support the base JavaScript i18n API.

More detailed information about react-intl's [APIs](https://github.com/formatjs/react-intl/blob/master/docs/API.md) and [components](https://github.com/formatjs/react-intl/blob/master/docs/Components.md), including [demos](https://github.com/formatjs/react-intl/tree/master/examples), are available in the [documentation](https://github.com/formatjs/react-intl/tree/master/docs).
More detailed information about react-intl's [APIs](https://github.com/formatjs/formatjs/blob/main/website/docs/react-intl/api.md) and [components](https://github.com/formatjs/formatjs/blob/main/website/docs/react-intl/components.md), including [demos](https://github.com/formatjs/formatjs/tree/main/packages/react-intl/examples), are available in the [documentation](https://github.com/formatjs/formatjs/tree/main/website/docs/react-intl).

### react-i18next

43 changes: 19 additions & 24 deletions docs/docs/page-node-dependencies.md
Original file line number Diff line number Diff line change
@@ -2,28 +2,33 @@
title: Page -> Node Dependency Tracking
---

> This documentation isn't up to date with the latest [schema customization changes](/docs/schema-customization).
>
> Outdated areas are:
>
> - `createPageDependency` is not the only way to mutate dependencies now
> - other helpers exist now
>
> You can help by making a PR to [update this documentation](https://github.com/gatsbyjs/gatsby/issues/14228).
In almost every GraphQL Resolver, you'll see the [createPageDependency](https://github.com/gatsbyjs/gatsby/blob/master/packages/gatsby/src/redux/actions/add-page-dependency.ts#L5), or [getNodeAndSavePathDependency](https://github.com/gatsbyjs/gatsby/blob/master/packages/gatsby/src/redux/nodes.ts#L108) functions. These are responsible for recording which nodes are depended on by which pages. In `develop` mode, when a node's content is changed the pages whose queries depend on that node will be re-run. This is one of the things that makes `develop` so awesome.
Gatsby keeps a record of used nodes for each query result. This makes it possible to cache and reuse results from previous runs if used nodes didn't change and, conversely, is used to determine which query results are stale and need to be rerun.

## How dependencies are recorded

Recording of Page -> Node dependencies are handled by the [createPageDependency](https://github.com/gatsbyjs/gatsby/blob/master/packages/gatsby/src/redux/actions/add-page-dependency.ts#L5) action. It takes the page (in the form of its `path`), and either a `nodeId`, or `connection`.
### `CREATE_COMPONENT_DEPENDENCY` action and `createPageAction` action creator

The internal `CREATE_COMPONENT_DEPENDENCY` action handles the recording of Page -> Node dependencies. It takes the `path` (page path for page queries or internal id for static queries), and either a `nodeId`, or `connection`.

Passing `nodeId` tells Gatsby that the page depends specifically on this node. So, if the node is changed, then the page's query needs to be re-executed.

`connection` is a Type string. E.g. `MarkdownRemark`, or `File`. Calling `createPageDependency` with a page path and a `connection` tells Gatsby that this page depends on all nodes of this type. Therefore if any node of this type changes (e.g. a change to a markdown node), then this page must be rebuilt. This variant is only called from [run-sift.js](https://github.com/gatsbyjs/gatsby/blob/master/packages/gatsby/src/redux/run-sift.js) when a query such as `allFile`, or `allMarkdownRemark` is run. See [Schema Connections](/docs/schema-connections/) for more info.
`connection` is a Type string. E.g. `MarkdownRemark`, or `File`. Calling `createPageDependency` with a `path` and a `connection` tells Gatsby that this page depends on all nodes of this type. Therefore if any node of this type changes (e.g. a change to a markdown node), then this page must be rebuilt. Using connection fields (e.g. `allMarkdownRemark`) is one of the cases when this variant is used.

`CREATE_COMPONENT_DEPENDENCY` action is conditionally dispatched by the internal `createPageAction` action creator. Action creator checks if we already have given dependencies stored to avoid emitting no-op actions. `createPageAction` is a low level internal API that is then used by higher level APIs.

### Higher level abstractions

#### Node Model

[Node Model](/docs/node-model/) is an API used in GraphQL resolvers to retrieve nodes from the data store. It's used internally in resolvers provided by Gatsby core and it can be used in resolvers provided by plugins via `context.nodeModel`. It calls `createPageAction` under the hood because Node Model is aware of the path of the query as well as the nodes being retrieved.

#### `getNodeAndSavePathDependency` helper

[`getNodeAndSavePathDependency`](/docs/node-api-helpers/#getNodeAndSavePathDependency) is a convenience wrapper around `getNode` and `createPageDependency`. It is not used internally. It's a legacy API for plugins to record data dependencies and is equivalent to `nodeModel.getNodeById`. The Node Model variant should be used instead as its API is less error prone. (Node Model is `path` aware and doesn't require you to pass it.)

## How dependencies are stored

Page -> Node dependencies are tracked via the `componentDataDependencies` redux namespace. `createPageDependency` is the only way to mutate it. The namespace is comprised of two sub structures:
Page -> Node dependencies are tracked via the `componentDataDependencies` redux namespace.

```javascript
{
@@ -62,14 +67,4 @@ Page -> Node dependencies are tracked via the `componentDataDependencies` redux

## How dependency information is used

Page -> Node dependencies are used entirely during query execution to figure out which nodes are "dirty", and therefore which page's queries need to be re-executed. This occurs in `query/index.js` in the [findIdsWithoutDataDependencies](https://github.com/gatsbyjs/gatsby/blob/master/packages/gatsby/src/query/index.js#L39) and [popNodeQueries](https://github.com/gatsbyjs/gatsby/blob/master/packages/gatsby/src/query/index.js#L71) functions. This is described in greater detail in the [Query Execution](/docs/query-execution/) docs.

## Other forms

### add-page-dependency.ts

[redux/actions/add-page-dependency.js](https://github.com/gatsbyjs/gatsby/blob/master/packages/gatsby/src/redux/actions/add-page-dependency.ts) is a wrapper around the `createPageDependency` action that performs some additional performance optimizations. It should be used instead of the raw action.

### getNodeAndSavePathDependency action

The [getNodeAndSavePathDependency](https://github.com/gatsbyjs/gatsby/blob/master/packages/gatsby/src/redux/nodes.ts#L108) action simply calls `getNode`, and then calls `createPageDependency` using that result. It is a programmer convenience.
Page -> Node dependencies are used entirely during query execution to figure out which nodes are "dirty" and to figure out which queries don't have any dependencies yet. "Dirty" nodes are used to determine which query results are stale and need to be re-executed. Finding queries without dependencies is used as a heuristic to determine which queries haven't run yet and therefore need to run.
15 changes: 15 additions & 0 deletions docs/sites.yml
Original file line number Diff line number Diff line change
@@ -11471,3 +11471,18 @@
built_by: HiringSolved
built_by_url: https://hiringsolved.com/home/
featured: false
- title: MongoDB Developer Hub
url: https://developer.mongodb.com
main_url: https://developer.mongodb.com
description: >
The MongoDB Developer Hub serves as the central location for all MongoDB developer content, programs, and resources.
categories:
- Blog
- Data
- Education
- Learning
- Programming
- Technology
- Web Development
built_by: MongoDB
featured: false
2 changes: 1 addition & 1 deletion examples/using-css-modules/src/pages/index.js
Original file line number Diff line number Diff line change
@@ -27,7 +27,7 @@ class IndexComponent extends React.Component {
className={indexStyles.link}
href="https://github.com/gatsbyjs/gatsby/tree/master/examples/using-css-modules"
>
cODe for eXAMple sIte on GiTHUb
Code for example site on GitHub
</a>
</p>
</div>
4 changes: 4 additions & 0 deletions packages/babel-preset-gatsby/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.5.3](https://github.com/gatsbyjs/gatsby/compare/babel-preset-gatsby@0.5.2...babel-preset-gatsby@0.5.3) (2020-07-21)

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

## [0.5.2](https://github.com/gatsbyjs/gatsby/compare/babel-preset-gatsby@0.5.1...babel-preset-gatsby@0.5.2) (2020-07-09)

### Features
4 changes: 2 additions & 2 deletions 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.5.2",
"version": "0.5.3",
"author": "Philipp Spiess <hello@philippspiess.com>",
"repository": {
"type": "git",
@@ -21,7 +21,7 @@
"babel-plugin-dynamic-import-node": "^2.3.3",
"babel-plugin-macros": "^2.8.0",
"babel-plugin-transform-react-remove-prop-types": "^0.4.24",
"gatsby-core-utils": "^1.3.12",
"gatsby-core-utils": "^1.3.13",
"gatsby-legacy-polyfills": "^0.0.2"
},
"peerDependencies": {
7 changes: 7 additions & 0 deletions packages/gatsby-admin/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -3,6 +3,13 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

## [0.1.97](https://github.com/gatsbyjs/gatsby/compare/gatsby-admin@0.1.96...gatsby-admin@0.1.97) (2020-07-21)

### Features

- **gatsby-admin:** list all pages of site ([#25744](https://github.com/gatsbyjs/gatsby/issues/25744)) ([a0c70d0](https://github.com/gatsbyjs/gatsby/commit/a0c70d0))
- **gatsby-admin:** plugin search ([#25903](https://github.com/gatsbyjs/gatsby/issues/25903)) ([0506123](https://github.com/gatsbyjs/gatsby/commit/0506123))

## [0.1.96](https://github.com/gatsbyjs/gatsby/compare/gatsby-admin@0.1.95...gatsby-admin@0.1.96) (2020-07-20)

**Note:** Version bump only for package gatsby-admin
8 changes: 6 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.96",
"version": "0.1.97",
"main": "index.js",
"author": "Max Stoiber",
"license": "MIT",
@@ -13,20 +13,24 @@
"devDependencies": {
"@emotion/core": "^10.0.28",
"@emotion/styled": "^10.0.27",
"@types/react-instantsearch-dom": "^5.2.6",
"@typescript-eslint/eslint-plugin": "^2.28.0",
"@typescript-eslint/parser": "^2.28.0",
"csstype": "^2.6.10",
"formik": "^2.1.4",
"gatsby": "^2.24.7",
"gatsby": "^2.24.8",
"gatsby-interface": "0.0.173",
"gatsby-plugin-typescript": "^2.4.16",
"gatsby-source-graphql": "^2.6.2",
"lodash-es": "^4.17.15",
"ncp": "^2.0.0",
"nodemon": "^2.0.4",
"react": "^16.12.0",
"react-dom": "^16.12.0",
"react-helmet": "^6.1.0",
"react-icons": "^3.10.0",
"react-instantsearch-dom": "^5.7.0",
"remove-markdown": "^0.3.0",
"strict-ui": "^0.1.3",
"subscriptions-transport-ws": "^0.9.16",
"theme-ui": "^0.4.0-alpha.3",
106 changes: 106 additions & 0 deletions packages/gatsby-admin/src/components/plugin-search.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
/* @jsx jsx */
import { jsx } from "strict-ui"
import { Spinner } from "theme-ui"
import {
InstantSearch,
Configure,
RefinementList,
ToggleRefinement,
connectAutoComplete,
} from "react-instantsearch-dom"
import {
Combobox,
ComboboxInput,
ComboboxPopover,
ComboboxList,
ComboboxOption,
} from "gatsby-interface"
import { useMutation } from "urql"

const SearchCombobox: React.FC<{
onSelect: (value: string) => void
}> = connectAutoComplete(({ hits, currentRefinement, refine, onSelect }) => (
<Combobox onSelect={onSelect}>
<ComboboxInput
sx={{ width: `20em` }}
aria-labelledby="plugin-search-label"
onChange={(e): void => refine(e.target.value)}
value={currentRefinement}
/>
<ComboboxPopover>
<ComboboxList aria-labelledby="plugin-search-label">
{hits.map(hit => (
<ComboboxOption
key={hit.objectID}
selected={false}
value={hit.name}
></ComboboxOption>
))}
</ComboboxList>
</ComboboxPopover>
</Combobox>
))

// the search bar holds the Search component in the InstantSearch widget
const PluginSearchInput: React.FC<{}> = () => {
const [{ fetching }, installGatbyPlugin] = useMutation(`
mutation installGatsbyPlugin($name: String!) {
createNpmPackage(npmPackage: {
name: $name,
dependencyType: "production"
}) {
id
name
}
createGatsbyPlugin(gatsbyPlugin: {
name: $name
}) {
id
name
}
}
`)

return (
<div>
<InstantSearch
apiKey="ae43b69014c017e05950a1cd4273f404"
appId="OFCNCOG2CU"
indexName="npm-search"
>
<div style={{ display: `none` }}>
<Configure analyticsTags={[`gatsby-plugins`]} />
<RefinementList
attribute="keywords"
transformItems={(items: Array<any>): Array<any> =>
items.map(({ count, ...item }) => {
return {
...item,
count: count || 0,
}
})
}
defaultRefinement={[`gatsby-component`, `gatsby-plugin`]}
/>
<ToggleRefinement
attribute="deprecated"
value={false}
label="No deprecated plugins"
defaultRefinement={true}
/>
</div>
{fetching ? (
<Spinner />
) : (
<SearchCombobox
onSelect={(value): void => {
installGatbyPlugin({ name: value })
}}
/>
)}
</InstantSearch>
</div>
)
}

export default PluginSearchInput
1 change: 1 addition & 0 deletions packages/gatsby-admin/src/components/providers.tsx
Original file line number Diff line number Diff line change
@@ -28,6 +28,7 @@ const theme = {
"100%": `100%`,
"16px": `16px`,
"15em": `15em`,
"20em": `20em`,
initial: `initial`,
},
}
Loading