Permalink
Cannot retrieve contributors at this time
Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign up
Switch branches/tags
JanoshRiebesell-patch-1
KyleAMathews-patch-1
LeKoArts-patch-1
Partner-program
add-depn
add-docs
add-escalade-sports-case-study
add-nin-operator-to-graphql
add-plugin-documentation
add-query-var
add-testing-stub-article
berrak-community-pages
blog/gatsby-source-graphql
calcsam-patch-1
ccustom-algolia-index
change-frontpage-title
coreyward-patch-1-1
cypress-timeouts
docs-broken-relative-links
docs/gatsby-remark-images-sharp
docsearch-css
documentation-project-blogpost-new-title
fix-anchors
fix-doc
fix/typescript-reach-router
fixes-to-plugin-library
gatsby-ssr-silent-fail
graphql-filter-sort
gvarandas-patch-1
hu0p-patch-1
janosh-patch-1
link-container
m-allanson-patch-1
master
mattbag-docs-link-fix-1
mattbag-showcase-external-links
neo/move-prefixPath
old-master-2
old-master-3
old-master-4
old-master-5
old-master-6
old-master-7
old-master
page-metadata-splitting
plugin-blogpost-edit
plugin-subfont
readmeupdate
remove-asterisk
remove-backticks-from-www
remove-console-log-sidebar
remove-deps
remove-google-analytics
revert-4254-blog-documentation-project
revert-5047-update-remark
revert-workspaces
sample-branch-example
sebastienfi-wp-orderby-date-asc
starterShowcase2
tags-to-posts
test-builds
topics/plugin-sharp-fix-duotone-quality
topics/sticky-sidebar-docs
topics/updated-typescript-plus-starter
tryzniak-patch-1
update-blogpost-date
upgrade-format
v1
wdavidw-patch-1
worker
Nothing to show
vundefined
v2.0.0-alpha.20
v1.6.3
v1.6.2
v1.6.1
v1.6.0
v1.5.3
v1.5.2
v1.5.1
v1.5.0
v1.4.2
v1.4.1
v1.4.0
v1.3.2
v1.3.1
v1.3.0
v1.2.0
v1.1.0
v1.0.18-10
v1.0.18-9
v1.0.11
v1.0.9
v1.0.8
v1.0.7
v1.0.6
v1.0.5
v1.0.4
v1.0.3
v1.0.2
v1.0.1
v1.0.0-beta.7
v1.0.0-beta.6
v1.0.0-beta.5
v1.0.0-beta.4
v1.0.0-beta.3
v1.0.0-beta.2
v1.0.0-beta.1
v1.0.0-alpha.23
v1.0.0-alpha.22
v1.0.0-alpha21
v1.0.0-alpha20
v1.0.0-alpha19
v1.0.0-alpha18
v1.0.0-alpha17
v1.0.0-alpha16
v1.0.0-alpha15
v1.0.0-alpha14
v1.0.0-alpha13
v1.0.0-alpha12
v1.0.0-alpha11
v1.0.0-alpha.10
v1.0.0-alpha10
v1.0.0-alpha10-test3
v1.0.0-alpha10-test2
v1.0.0-alpha10-test1
v1.0.0-alpha.9
v1.0.0-alpha9
v1.0.0-alpha9-test1
v1.0.0-alpha.8
v1.0.0-alpha8
v1.0.0-alpha8-test4
v1.0.0-alpha8-test3
v1.0.0-alpha8-test2
v1.0.0-alpha8-test1
v1.0.0-alpha.7
v1.0.0-alpha7
v1.0.0-alpha.6
v1.0.0-alpha6
v1.0.0-alpha.5
v1.0.0-alpha5
v1.0.0-alpha.4
v1.0.0-alpha4
v1.0.0-alpha.3
v1.0.0-alpha3
v1.0.0-alpha2
v1.0.0-alpha1
v1.0.0-alpha.testing4
v1.0.0-alpha.testing3
v1.0.0-alpha.testing2
v1.0.0-alpha.testing1
v1.0.0-alpha.test8
v1.0.0-alpha.test7
v1.0.0-alpha.test6
v1.0.0-alpha.test5
v1.0.0-alpha.test4
v1.0.0-alpha.test3
v1.0.0-alpha.test2
v1.0.0-alpha.test
v1.0.0-alpha-testing-7
v1.0.0-alpha-testing-6
v1.0.0-alpha-testing-5
v1.0.0-alpha-3
v0.12.48
v0.12.47
v0.12.46
v0.12.45
v0.12.44
v0.12.43
v0.12.42
v0.12.41
Nothing to show
Find file
Copy path
Fetching contributors…
| const fs = require(`fs-extra`) | |
| exports.onCreateNode = require(`./on-node-create`) | |
| exports.setFieldsOnGraphQLNodeType = require(`./extend-node-type`) | |
| exports.onPreExtractQueries = async ({ store, getNodes }) => { | |
| const program = store.getState().program | |
| // Check if there are any ImageSharp nodes and if gatsby-image is installed. If so | |
| // add fragments for ImageSharp and gatsby-image. The fragment will cause an error | |
| // if there's not ImageSharp nodes and without gatsby-image, the fragment is useless. | |
| const nodes = getNodes() | |
| if (!nodes.some(n => n.internal.type === `ImageSharp`)) { | |
| return | |
| } | |
| let gatsbyImageDoesNotExist = true | |
| try { | |
| require.resolve(`gatsby-image`) | |
| gatsbyImageDoesNotExist = false | |
| } catch (e) { | |
| // Ignore | |
| } | |
| if (gatsbyImageDoesNotExist) { | |
| return | |
| } | |
| // We have both gatsby-image installed as well as ImageSharp nodes so let's | |
| // add our fragments to .cache/fragments. | |
| await fs.copy( | |
| require.resolve(`gatsby-transformer-sharp/src/fragments.js`), | |
| `${program.directory}/.cache/fragments/image-sharp-fragments.js` | |
| ) | |
| } |
Copy lines Copy permalink - View git blame
- Open new issue