text: const path = require(`path`)
  const queries = require("./src/utils/algolia")
  
  const withDefaults = require("./src/utils/DefaultOptions")
  const { seriesPath } = withDefaults({})
  require("dotenv").config()
  
  module.exports = ({}) => {
    const plugins = []
    if (process.env.GATSBY_ALGOLIA_APP_ID) {
      plugins.push({
        resolve: `gatsby-plugin-algolia`,
        options: {
          appId: process.env.GATSBY_ALGOLIA_APP_ID,
          apiKey: process.env.ALGOLIA_ADMIN_KEY,
          queries,
          chunkSize: 5000, // default: 1000
          enablePartialUpdates: true,
        },
      })
    }
    plugins.push(
      {
        resolve: `gatsby-plugin-mdx`,
        options: {
          extensions: [`.mdx`, `.md`],
          defaultLayouts: {
            default: require.resolve(`./src/components/Layout.tsx`),
          },
          gatsbyRemarkPlugins: [
            {
              resolve: `gatsby-remark-images`,
              options: {
                maxWidth: 1035,
              },
            },
            {
              resolve: `gatsby-remark-prismjs`,
              options: {
                classPrefix: `language-`,
                inlineCodeMarker: null,
                aliases: {},
              },
            },
          ],
          plugins: [`gatsby-remark-images`],
        },
      },
      {
        resolve: `gatsby-plugin-typescript`,
        options: {
          isTSX: true,
          allExtensions: true,
        },
      },
      {
        resolve: `gatsby-plugin-page-creator`,
        options: {
          path: path.join(__dirname, `src/pages`),
        },
      },
      {
        resolve: `gatsby-source-filesystem`,
        options: {
          name: `blog`,
          path: path.resolve(`blog`),
          ignore: [`**/.*`],
        },
      },
      `gatsby-transformer-sharp`,
      `gatsby-plugin-sharp`,
      {
        resolve: `gatsby-source-filesystem`,
        options: {
          path: `assets`,
          name: `assets`,
        },
      },
      `gatsby-transformer-json`,
      {
        resolve: `gatsby-source-filesystem`,
        options: {
          path: seriesPath,
          name: seriesPath,
        },
      },
      `gatsby-plugin-react-helmet`,
      `gatsby-plugin-dark-mode`,
      {
        resolve: `gatsby-plugin-compile-es6-packages`,
        options: {
          modules: [`gatsby-crudzoo`],
        },
      },
      {
        resolve: `gatsby-plugin-postcss`,
        options: {},
      },
      {
        resolve: `gatsby-plugin-purgecss`,
        options: {
          tailwind: true,
          content: [
            path.join(
              process.cwd(),
              "node_modules/gatsby-crudzoo/src/**/!(*.d).{ts,js,jsx,tsx}"
            ),
          ],
        },
      }
    )
    return {
      plugins,
    }
  }
  