Skip to content

Commit

Permalink
chore: use file option instead of path
Browse files Browse the repository at this point in the history
  • Loading branch information
jerelmiller committed Aug 13, 2020
1 parent bb5c574 commit 27c6fe9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
4 changes: 1 addition & 3 deletions gatsby-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
10 changes: 5 additions & 5 deletions plugins/gatsby-source-swiftype/gatsby-node.js
Original file line number Diff line number Diff line change
@@ -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, '{}');
}
};

Expand Down

0 comments on commit 27c6fe9

Please sign in to comment.