From 27c6fe9f0a5e66e2577afacce41e3b06c1445646 Mon Sep 17 00:00:00 2001 From: Jerel Miller Date: Wed, 12 Aug 2020 20:18:49 -0700 Subject: [PATCH] chore: use file option instead of path --- gatsby-config.js | 4 +--- plugins/gatsby-source-swiftype/gatsby-node.js | 10 +++++----- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/gatsby-config.js b/gatsby-config.js index ba7ecf420..0418961d2 100644 --- a/gatsby-config.js +++ b/gatsby-config.js @@ -45,9 +45,7 @@ module.exports = { { resolve: 'gatsby-source-swiftype', options: { - path: `${__dirname}/src/data`, - filterPage: ({ page }) => - page.component === `${__dirname}/src/templates/GuideTemplate.js`, + file: `${__dirname}/src/data/related-pages.json`, }, }, 'gatsby-plugin-sass', diff --git a/plugins/gatsby-source-swiftype/gatsby-node.js b/plugins/gatsby-source-swiftype/gatsby-node.js index 97ec0b6fa..1a3a12af3 100644 --- a/plugins/gatsby-source-swiftype/gatsby-node.js +++ b/plugins/gatsby-source-swiftype/gatsby-node.js @@ -1,12 +1,12 @@ const fs = require('fs'); -const path = require('path'); exports.onPreBootstrap = ({ reporter }, pluginOptions) => { - const dataFile = path.join(pluginOptions.path, 'related-pages.json'); + const { file } = pluginOptions; - if (!fs.existsSync(dataFile)) { - reporter.info('Creating related-pages.json file'); - fs.writeFileSync(dataFile, '{}'); + if (!fs.existsSync(file)) { + reporter.info('gatsby-source-swiftype: Creating data file'); + + fs.writeFileSync(file, '{}'); } };