gatsby-plugin-strapi-datas-mocker

1.0.7 • Public • Published
Logo NovaGaïa

Nova Strapi APIs Mocker compagnion

by NovaGaïa.

A gatsby plugin to interact with Strapi and the plugin `nova-datas-mocker`.

CHANGELOG

gatsby-plugin-strapi-datas-mocker is a complementary plugin to the Strapinova-datas-mocker.

nova-datas-mocker takes care of mocking, on demand via a simple switch, all specified Strapi APIs and gatsby-plugin-strapi-datas-mocker drives the gatsby-plugin-schema-snapshot plugin to generate/update the Gatsby schema.

With these two plugins, you will stop wasting time maintaining the shema or the gatsby-node.js of Gatsby and you will have the certainty of no more GraphQL errors.

warn:

  • Need "nova-datas-mocker": "^1.3.10" in Strapi.
  • Need "gatsby-plugin-schema-snapshot": "^3.24.0" in Gatsby (must be added by peerDepencies).

Installation

npm i gatsby-plugin-strapi-datas-mocker
or
yarn add gatsby-plugin-strapi-datas-mocker

Configuration

add this to your gatsby-config.js file

plugins: [
  // ...
  {
    resolve: `gatsby-plugin-strapi-datas-mocker`,
    options: {
      strapiURL: `strapiURL`, // required
      // gatsbyPluginSchemaSnapshotOptions is required, could be {}
      gatsbyPluginSchemaSnapshotOptions: {
        path: `schema.gql`,
        exclude: {
          plugins: [],
        },
      },
    },
  },
  // ...
]
property function default value
strapiURL Strapi URL, with port, without trailling slach required, no default value
forceUpdate Force the plugin to update Schema, without using the switch on Strapi, settings not recommanded false
gatsbyPluginSchemaSnapshotOptions The configuration of the plugin gatsby-plugin-schema-snapshot required, use {}

WARN

forceUpdate in Gatsby will not activate mocking in Strapi!


Buy Me A Coffee

Package Sidebar

Install

npm i gatsby-plugin-strapi-datas-mocker

Weekly Downloads

2

Version

1.0.7

License

MIT

Unpacked Size

38.1 kB

Total Files

8

Last publish

Collaborators

  • novagaia