Skip to content

Commit

Permalink
chore: add back files that are needed
Browse files Browse the repository at this point in the history
  • Loading branch information
pizzaisdavid committed Jun 4, 2024
1 parent 7103e7e commit 6490c22
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 0 deletions.
30 changes: 30 additions & 0 deletions functions/scripts/paths.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import * as path from 'path'

export const FUNCTIONS_DIR = path.resolve(__dirname, '../')

// When passing to CLI only relative folder names used
export const EMULATOR_SEED_FOLDER = 'data/seed'
export const EMULATOR_IMPORT_FOLDER = 'data/emulated'
export const EMULATOR_EXPORT_FOLDER = 'data/exported'

// For custom scripts full paths user
export const EMULATOR_SEED_PATH = path.resolve(
FUNCTIONS_DIR,
EMULATOR_SEED_FOLDER,
)
export const EMULATOR_IMPORT_PATH = path.resolve(
FUNCTIONS_DIR,
EMULATOR_IMPORT_FOLDER,
)
export const EMULATOR_EXPORT_PATH = path.resolve(
FUNCTIONS_DIR,
EMULATOR_EXPORT_FOLDER,
)

// For compiling src folder
export const PLATFORM_ROOT_PATH = path.resolve(FUNCTIONS_DIR, '..')
export const PLATFORM_LIB_PATH = path.resolve(PLATFORM_ROOT_PATH, 'lib')
export const PLATFORM_TSCONFIG_TYPES_PATH = path.resolve(
PLATFORM_ROOT_PATH,
'tsconfig.src-types.json',
)
24 changes: 24 additions & 0 deletions functions/scripts/runtimeConfig/model.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import type { configVars } from '../../src/config/config'

/** Variables populates in the same way firebase functions:config:set does for use in testing */
export const runtimeConfigTest: configVars = {
analytics: {
tracking_code: 'fake_tracking_code',
view_id: 'fake_view_id',
},
integrations: {
discord_webhook: 'https://fake_discord_webhook.local',
discord_alert_channel_webhook:
'https://fake_discord_alert_channel_webhook.local',
slack_webhook: 'https://fake_slack_webhook.local',
patreon_client_id: 'fake_patreon_client_id',
patreon_client_secret: 'fake_patreon_client_secret',
},
service: null as any,
deployment: {
site_url: 'http://localhost:4000',
},
prerender: {
api_key: 'fake_prerender_key',
},
}
7 changes: 7 additions & 0 deletions functions/scripts/runtimeConfig/write.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { writeFileSync } from 'fs'
import { resolve } from 'path'
import { FUNCTIONS_DIR } from '../paths'
import { runtimeConfigTest } from './model'

const runtimeConfigPath = resolve(FUNCTIONS_DIR, '.runtimeconfig.json')
writeFileSync(runtimeConfigPath, JSON.stringify(runtimeConfigTest))

0 comments on commit 6490c22

Please sign in to comment.