From f17838b485d68be96255338a6ba464f11d9b54ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Souchet=20C=C3=A9line?= <4921914+csouchet@users.noreply.github.com> Date: Thu, 29 Dec 2022 15:28:48 +0100 Subject: [PATCH] [INFRA] Convert gatsby-config.js to gatsby-config.ts (#774) Support added in gatsby@4.9.0 --- gatsby-config.js => gatsby-config.ts | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) rename gatsby-config.js => gatsby-config.ts (89%) diff --git a/gatsby-config.js b/gatsby-config.ts similarity index 89% rename from gatsby-config.js rename to gatsby-config.ts index 180e34cb2..a4464f197 100644 --- a/gatsby-config.js +++ b/gatsby-config.ts @@ -14,19 +14,21 @@ * limitations under the License. */ -const colors = require('./src/theme/colors.json'); +import type { GatsbyConfig } from 'gatsby'; +import dotenv from 'dotenv'; + +import colors from './src/theme/colors.json'; // Only the variables prefixed by 'GATSBY_' can be available in browser code -require('dotenv').config({ - path: `.env.${process.env.NODE_ENV}`, -}); +dotenv.config({ path: `.env.${process.env.NODE_ENV}` }); -const robotsPolicy = { userAgent: '*' }; +type RobotsPolicy = { userAgent: string; allow?: string; disallow?: string[] }; +const robotsPolicy: RobotsPolicy = { userAgent: '*' }; process.env.GATSBY_ROBOTS_ENABLED === 'true' ? (robotsPolicy.allow = '/') : (robotsPolicy.disallow = ['/']); -module.exports = { +const config: GatsbyConfig = { siteMetadata: { title: 'Process Analytics', siteUrl: 'https://process-analytics.dev', @@ -100,3 +102,5 @@ module.exports = { }, ], }; + +export default config;