text: require(`dotenv`).config({
    path: `.env`,
  })
  
  const thoughtsFeed = require(`./src/utils/feed`)
  const shouldAnalyseBundle = process.env.ANALYSE_BUNDLE
  const githubToken = process.env.GITHUB_TOKEN
  
  module.exports = {
    siteMetadata: {
      title: `Gatsby Themes by LekoArts`,
      titleAlt: `Free & Open Source Gatsby Themes by LekoArts`,
      siteUrl: `https://themes.lekoarts.de`,
      description: `Get high-quality and customizable Gatsby themes to quickly bootstrap your website! Choose from many professionally created and impressive designs with a wide variety of features and customization options. Use Gatsby Themes to take your project to the next level and let you and your customers take advantage of the many benefits Gatsby has to offer.`,
      headline: `Get high-quality and customizable Gatsby themes to quickly bootstrap your website`,
      language: `en`,
      image: `/banner.png`,
      author: `@lekoarts_de`,
    },
    flags: {
      LAZY_IMAGES: true,
      QUERY_ON_DEMAND: false,
    },
    plugins: [
      {
        resolve: `gatsby-source-filesystem`,
        options: {
          name: `data`,
          path: `${__dirname}/data`,
        },
      },
      {
        resolve: `gatsby-source-filesystem`,
        options: {
          name: `thoughts`,
          path: `${__dirname}/thoughts`,
        },
      },
      githubToken && {
        resolve: `gatsby-source-github-api`,
        options: {
          token: githubToken,
          variables: {},
          graphQLQuery: `
            query {
              repository(owner: "LekoArts", name: "gatsby-themes") {
                stargazers {
                  totalCount
                }
              }
            }
          `,
        },
      },
      {
        resolve: `gatsby-plugin-google-analytics`,
        options: {
          trackingId: process.env.GOOGLE_ANALYTICS_ID,
          anonymize: true,
        },
      },
      {
        resolve: `gatsby-plugin-mdx`,
        options: {
          gatsbyRemarkPlugins: [`gatsby-remark-autolink-headers`, `gatsby-remark-smartypants`],
          // TODO: Remove once this is fixed
          plugins: [`gatsby-remark-autolink-headers`, `gatsby-remark-smartypants`],
        },
      },
      {
        resolve: `gatsby-transformer-yaml`,
        options: {
          typeName: `Themes`,
        },
      },
      `gatsby-plugin-image`,
      `gatsby-plugin-catch-links`,
      `gatsby-plugin-sitemap`,
      `gatsby-plugin-react-helmet`,
      `gatsby-plugin-sharp`,
      `gatsby-transformer-sharp`,
      `gatsby-plugin-typescript`,
      `gatsby-plugin-emotion`,
      `gatsby-plugin-theme-ui`,
      {
        resolve: `gatsby-plugin-feed`,
        options: thoughtsFeed,
      },
      {
        resolve: `gatsby-plugin-manifest`,
        options: {
          name: `Free & Open Source Gatsby Themes by LekoArts`,
          short_name: `GatsbyThemes`,
          description: `Get high-quality and customizable Gatsby themes to quickly bootstrap your website! Choose from many professionally created and impressive designs with a wide variety of features and customization options. Use Gatsby Themes to take your project to the next level and let you and your customers take advantage of the many benefits Gatsby has to offer.`,
          start_url: `/`,
          background_color: `#fff`,
          theme_color: `#5A67D8`,
          display: `standalone`,
          icons: [
            {
              src: `/android-chrome-192x192.png`,
              sizes: `192x192`,
              type: `image/png`,
            },
            {
              src: `/android-chrome-512x512.png`,
              sizes: `512x512`,
              type: `image/png`,
            },
          ],
        },
      },
      `gatsby-plugin-offline`,
      `gatsby-plugin-netlify`,
      shouldAnalyseBundle && {
        resolve: `gatsby-plugin-webpack-bundle-analyser-v2`,
        options: {
          analyzerMode: `static`,
          reportFilename: `_bundle.html`,
          openAnalyzer: false,
        },
      },
    ].filter(Boolean),
  }
  