@vtex/gatsby-source-store
TypeScript icon, indicating that this package has built-in type declarations

1.5.21-avon.0 • Public • Published

gatsby-source-store

Plugin for sourcing the API data layer into Gatsby.

Install

yarn add @vtex/gatsby-source-store @faststore/api

How to use

// In your gatsby-config.js
const { getSchema } = require('@faststore/api')

const options = {
  platform: 'vtex',
  account: 'my-vtex-account',
  environment: 'vtexcommercestable'
}

module.exports = {
  plugins: [
    // other plugins ...
    {
      resolve: '@vtex/gatsby-source-store',
      options: {
        getSchema: () => getSchema(options)
      }
    },
  ],
}

Options

This plugin brings additional options for you to control how the nodes are sourced.

Options type effect
sourceProducts boolean false for not sourcing products
sourceCollections boolean false for not sourcing collections
maxNumProducts number max number of products to source
maxNumCollections number max number of collections to source

Tip: While sourcing large ecommerces, add the maxNumProducts and maxNumCollections so you can develop without waiting for the whole dataset to be downloaded. Maybe try something like:

const { getSchema } = require('@faststore/api')

const options = {
  platform: 'vtex',
  account: 'my-vtex-account',
  environment: 'vtexcommercestable'
}

const isProduction = process.env.NODE_ENV === 'production'

module.exports = {
  plugins: [
    // other plugins ...
    {
      resolve: '@vtex/gatsby-source-store',
      options: {
        getSchema: () => getSchema(options)
        // Sourcing less products in development for better DX
        maxNumProducts: isProduction ? undefined : 100,
        maxNumCollections: isProduction ? undefined : 100,
      }
    },
  ],
}

How to contribute

Feel free to open issues in our repo. Also, there is a general contributing guideline in there

/@vtex/gatsby-source-store/

    Package Sidebar

    Install

    npm i @vtex/gatsby-source-store

    Weekly Downloads

    2

    Version

    1.5.21-avon.0

    License

    MIT

    Unpacked Size

    291 kB

    Total Files

    25

    Last publish

    Collaborators

    • jardelymaris
    • denissilvavtex
    • eduardocesb
    • enzomerca
    • vinhags
    • zaedyvtex
    • filafb
    • bastotec
    • arthurtriis1vtex
    • geraldo.fernandes
    • georgebrindeiro
    • filipewl
    • emersonvtex
    • rodrigo.albuquerque
    • viniciuslouzadavtex
    • npedrosovtex
    • myllena.alves
    • mendescamara
    • mauro.takeda
    • lpolon
    • gianvittorio
    • eduardoformiga
    • vcnovaes
    • dpzvtex
    • vtexlab-user
    • wender
    • natamelo
    • mairatma
    • mayzabel
    • augusto.lazaro
    • rafarubim
    • gustavorosolem
    • arthurepc
    • jeymisson
    • victorhmp
    • lurian
    • arturpimentel
    • anitavincent
    • brunojdo
    • lucasecdb
    • matheusps
    • emersonlaurentino
    • viniagostini
    • lucasaarcoverde
    • lariciamota
    • icazevedo
    • fabits
    • mateuspontes
    • gmantiqueira
    • vitorlgomes
    • rodolfoams
    • policarpo
    • marcelovicentegc
    • maianabt
    • jeffersontuc
    • hiagolcm
    • william.silva