-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(app): Client-side configuration bundling (#2036)
- Loading branch information
Showing
12 changed files
with
95 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,7 @@ on: [pull_request] | |
|
||
env: | ||
VERSION: ${{ github.event.pull_request.number }} | ||
HUSKY: 0 | ||
|
||
jobs: | ||
build: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/* SPDX-FileCopyrightText: 2014-present Kriasoft */ | ||
/* SPDX-License-Identifier: MIT */ | ||
|
||
export type EnvName = "prod" | "test" | "local"; | ||
export type Config = { | ||
app: { | ||
env: EnvName; | ||
name: string; | ||
origin: string; | ||
hostname: string; | ||
}; | ||
firebase: { | ||
projectId: string; | ||
appId: string; | ||
apiKey: string; | ||
authDomain: string; | ||
measurementId: string; | ||
}; | ||
}; | ||
|
||
export const configs = JSON.parse(import.meta.env.VITE_CONFIG); | ||
export const config: Config = | ||
location.hostname === configs.prod.hostname | ||
? configs.prod | ||
: location.hostname === configs.test.hostname | ||
? configs.test | ||
: configs.local; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,22 @@ | ||
/* SPDX-FileCopyrightText: 2014-present Kriasoft */ | ||
/* SPDX-License-Identifier: MIT */ | ||
|
||
declare const APP_NAME: string; | ||
declare const APP_HOSTNAME: string; | ||
declare const GOOGLE_CLOUD_PROJECT: string; | ||
declare const FIREBASE_APP_ID: string; | ||
declare const FIREBASE_API_KEY: string; | ||
declare const FIREBASE_AUTH_DOMAIN: string; | ||
declare const GA_MEASUREMENT_ID: string; | ||
|
||
interface Window { | ||
dataLayer: unknown[]; | ||
} | ||
|
||
interface ImportMetaEnv { | ||
/** | ||
* Client-side configuration for the production, test/QA, and local | ||
* development environments. See `core/config.ts`, `vite.config.ts`. | ||
*/ | ||
readonly VITE_CONFIG: string; | ||
} | ||
|
||
declare module "relay-runtime" { | ||
interface PayloadError { | ||
errors?: Record<string, string[] | undefined>; | ||
} | ||
} | ||
|
||
declare module "*.css"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,8 +41,5 @@ | |
"typescript": "^4.9.5", | ||
"vite": "^4.1.4", | ||
"vitest": "^0.28.5" | ||
}, | ||
"envars": { | ||
"cwd": "../env" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters