From a0713f21d0d455405baf247186e8072d01346abc Mon Sep 17 00:00:00 2001 From: Sam Hu Date: Tue, 21 Nov 2023 14:43:57 -0500 Subject: [PATCH] one file --- netlify/functions/load-game/load-game.ts | 2 +- netlify/functions/save-game/save-game.ts | 2 +- netlify/{shared/firestore.ts => shared.ts} | 4 ++-- netlify/shared/env.ts | 2 -- 4 files changed, 4 insertions(+), 6 deletions(-) rename netlify/{shared/firestore.ts => shared.ts} (87%) delete mode 100644 netlify/shared/env.ts diff --git a/netlify/functions/load-game/load-game.ts b/netlify/functions/load-game/load-game.ts index 2931889e..5aa2ad36 100644 --- a/netlify/functions/load-game/load-game.ts +++ b/netlify/functions/load-game/load-game.ts @@ -1,7 +1,7 @@ /* eslint-disable import/prefer-default-export */ import { Handler } from '@netlify/functions'; import { doc, getDoc } from 'firebase/firestore'; -import { db, gamesCollection } from '../../shared/firestore'; +import { db, gamesCollection } from '../../shared'; export const handler: Handler = async (event) => { try { diff --git a/netlify/functions/save-game/save-game.ts b/netlify/functions/save-game/save-game.ts index bb5b8fc0..c009f9cc 100644 --- a/netlify/functions/save-game/save-game.ts +++ b/netlify/functions/save-game/save-game.ts @@ -2,7 +2,7 @@ import { Handler } from '@netlify/functions'; import { humanId } from 'human-id'; import { setDoc, doc } from 'firebase/firestore'; -import { db, gamesCollection } from '../../shared/firestore'; +import { db, gamesCollection } from '../../shared'; export const handler: Handler = async (event) => { try { diff --git a/netlify/shared/firestore.ts b/netlify/shared.ts similarity index 87% rename from netlify/shared/firestore.ts rename to netlify/shared.ts index 24ba3651..79961d6a 100644 --- a/netlify/shared/firestore.ts +++ b/netlify/shared.ts @@ -1,7 +1,5 @@ -/* eslint-disable import/prefer-default-export */ import { initializeApp } from 'firebase/app'; import { getFirestore } from 'firebase/firestore'; -import { isProd } from './env'; const firebaseApp = initializeApp({ apiKey: process.env.FIRESTORE_KEY, @@ -16,3 +14,5 @@ const firebaseApp = initializeApp({ export const db = getFirestore(firebaseApp); export const gamesCollection = () => (isProd() ? 'games' : 'games-dev'); + +export const isProd = () => process.env.ENV === 'prod'; diff --git a/netlify/shared/env.ts b/netlify/shared/env.ts deleted file mode 100644 index f71986c5..00000000 --- a/netlify/shared/env.ts +++ /dev/null @@ -1,2 +0,0 @@ -/* eslint-disable import/prefer-default-export */ -export const isProd = () => process.env.ENV === 'prod';