1.0.7 • Published 2 years ago
gatsby-plugin-strapi-datas-mocker v1.0.7
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-mockerConfiguration
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!