|
1 | 1 | import { localBuild as localApphostingBuild } from "@apphosting/build"; |
2 | 2 | import { OutputBundleConfig } from "@apphosting/common"; |
3 | | -import { BuildConfig, Env, Availability } from "../gcp/apphosting"; |
4 | | -import { readFileSync } from "fs"; |
5 | | -import { join } from "path"; |
6 | | -import { fileExistsSync } from "../fsutils"; |
7 | | -import { load } from "js-yaml"; |
8 | | -import { FirebaseError } from "../error"; |
9 | | - |
| 3 | +import { BuildConfig, Env } from "../gcp/apphosting"; |
10 | 4 |
|
11 | 5 | export async function localBuild( |
12 | | - projectRoot: string, framework: string): Promise<{annotations: Record<string, string>, buildConfig: BuildConfig}> { |
13 | | - |
14 | | - const apphostingBuildOutput: OutputBundleConfig = await localApphostingBuild(projectRoot, framework); |
15 | | - |
16 | | - const annotations: Record<string, string> = {}; |
17 | | - Object.entries(apphostingBuildOutput.metadata).forEach(([key, value]) => { |
18 | | - annotations[key] = String(value); |
19 | | - }); |
| 6 | + projectRoot: string, |
| 7 | + framework: string, |
| 8 | +): Promise<{ annotations: Record<string, string>; buildConfig: BuildConfig }> { |
| 9 | + const apphostingBuildOutput: OutputBundleConfig = await localApphostingBuild( |
| 10 | + projectRoot, |
| 11 | + framework, |
| 12 | + ); |
20 | 13 |
|
21 | | - const env: Env[] | undefined = apphostingBuildOutput.runConfig.environmentVariables?.map( |
22 | | - ( {variable, value, availability} : Env) => { |
23 | | - return { |
24 | | - variable, |
25 | | - value, |
26 | | - availability, |
27 | | - }; |
28 | | - }); |
| 14 | + const annotations: Record<string, string> = {}; |
| 15 | + Object.entries(apphostingBuildOutput.metadata).forEach(([key, value]) => { |
| 16 | + annotations[key] = String(value); |
| 17 | + }); |
29 | 18 |
|
30 | | - return { |
31 | | - annotations, |
32 | | - buildConfig: { |
33 | | - runCommand: apphostingBuildOutput.runConfig.runCommand, |
34 | | - env, |
35 | | - }, |
36 | | - } |
| 19 | + const env: Env[] | undefined = apphostingBuildOutput.runConfig.environmentVariables?.map( |
| 20 | + ({ variable, value, availability }: Env) => { |
| 21 | + return { |
| 22 | + variable, |
| 23 | + value, |
| 24 | + availability, |
| 25 | + }; |
| 26 | + }, |
| 27 | + ); |
37 | 28 |
|
| 29 | + return { |
| 30 | + annotations, |
| 31 | + buildConfig: { |
| 32 | + runCommand: apphostingBuildOutput.runConfig.runCommand, |
| 33 | + env, |
| 34 | + }, |
| 35 | + }; |
38 | 36 | } |
0 commit comments