This is in alpha - use at your own risk
This source plugin aims to improve over the existing gatsby-source-shopify
by supporting incremental data fetching. This means that your first build will be just as long but subsequent builds will only need to fetch data that has changed. In my testing on a store with 1024 products, initial builds take around 90s and subsequent are around 10s.
This plugin also supports incremental builds. In order to try out incremental builds, ensure the GATSBY_EXPERIMENTAL_PAGE_BUILD_ON_DATA_CHANGES
environment variable is true
.
GATSBY_EXPERIMENTAL_PAGE_BUILD_ON_DATA_CHANGES=true yarn build --log-pages
Currently only products and collections are incrementally fetched. I have plans to support pages, blogs, and articles as well but they are lower priority (and use a completely different method).
- No longer import article comments
- Product options are no longer their own node
- No support for running images through sharp - plan to support in future
- Added deprecated messages to fields deprecated in storefront api
- Added some new fields that are not yet in
gatsby-source-shopify
- Rate limit storefront api requests (still testing - but consistent)
- Verbose logs can now be seen by adding the
--verbose
cli option - Added more relationships between nodes (product from variant)
- Incremental data fetching (obviously)
npm install gatsby-source-shopify-incremental
# or
yarn add gatsby-source-shopify-incremental
TODO
interface Config {
/**
* The *.myshopify.com domain of your Shopify store
* Required filed
* Example `my-shop.myshopify.com`
*/
myshopifyDomain: string;
/**
* A valid admin access token for your Shopify store
* It must be created by the same sales channel as the
* storefrontAccessToken
* Required scopes (Read access):
* - Products
* - Product listings
* - Resource feedback
* - Store content
* - Online Store pages
*/
adminAccessToken: string;
/**
* A valid storefront access token for your Shopify store
* It must be created by the same sales channel as the
* adminAccessToken
*/
storefrontAccessToken: string;
/**
* If your storefront domain is not the default
* *.myshopify domain
* Example `my-shop.com`
*/
storefrontShopDomain: string;
/**
* Shopify api version to use
* Optional - defaults to 2020-04
*/
apiVersion: ApiVersion;
/**
* Import Shopify collections
* Optional - defaults to true
*/
includeCollections: boolean;
/**
* Import Shopify pages
* Optional - defaults to false
*/
includePages: boolean;
/**
* Import Shopify blogs
* Optional - defaults to false
*/
includeBlogs: boolean;
/**
* Indicate if you are Shopify plus
* This will change the rate limits
* Optional - defaults to false
*/
shopifyPlus: boolean;
}
For now please reference the gatsby-source-shopify
plugin. Querying should be essentially the same.
yarn install
yarn test
- Install dependencies
yarn install
- Link the repo
yarn link
- Start the file watcher
yarn watch
- From a configured gatsby site
yarn link "gatsby-source-shopify-incremental"
Your gatsby site will now use the local version of this plugin
Additional commands:
- Run prettier
yarn format
- Update generated graphql types
yarn gen
- Build a release
yarn build
TODO