|
1 | 1 | import { spawn } from "child_process";
|
2 | 2 |
|
| 3 | +// Output bundle metadata specifications to be written to bundle.yaml |
| 4 | +export interface OutputBundleConfig { |
| 5 | + version: "v1"; |
| 6 | + serverConfig: ServerConfig; |
| 7 | + metadata: Metadata; |
| 8 | +} |
| 9 | + |
| 10 | +// Fields needed to configure the App Hosting server |
| 11 | +interface ServerConfig { |
| 12 | + // Command to start the server (e.g. "node dist/index.js"). Assume this command is run from the root dir of the workspace |
| 13 | + runCommand: string; |
| 14 | + // Environment variables set when the app is run |
| 15 | + environmentVariables?: EnvVarConfig[]; |
| 16 | + // See https://firebase.google.com/docs/reference/apphosting/rest/v1beta/projects.locations.backends.builds#runconfig for documentation on the next fields |
| 17 | + // The maximum number of concurrent requests that each server instance can receive. |
| 18 | + concurrency?: number; |
| 19 | + // The number of CPUs used in a single server instance. |
| 20 | + cpu?: number; |
| 21 | + // The amount of memory available for a server instance. |
| 22 | + memoryMiB?: number; |
| 23 | + // The limit on the minimum number of function instances that may coexist at a given time. |
| 24 | + minInstances?: number; |
| 25 | + // The limit on the maximum number of function instances that may coexist at a given time. |
| 26 | + maxInstances?: number; |
| 27 | +} |
| 28 | + |
| 29 | +// Additonal fields needed for identifying the framework and adapter being used |
| 30 | +interface Metadata { |
| 31 | + // Name of the adapter (this should be the official package name) e.g. "@apphosting/adapter-nextjs" |
| 32 | + adapterPackageName: string; |
| 33 | + // Version of the adapter, e.g. "18.0.1" |
| 34 | + adapterVersion: string; |
| 35 | + // Name of the framework that is being supported, e.g. "angular" |
| 36 | + framework: string; |
| 37 | + // Version of the framework that is being supported, e.g. "18.0.1" |
| 38 | + frameworkVersion?: string; |
| 39 | +} |
| 40 | + |
| 41 | +// Represents a single environment variable. |
| 42 | +interface EnvVarConfig { |
| 43 | + // Name of the variable |
| 44 | + variable: string; |
| 45 | + // Value associated with the variable |
| 46 | + value: string; |
| 47 | + // Where the variable will be available, for now only RUNTIME is supported |
| 48 | + availability: Availability.Runtime[]; |
| 49 | +} |
| 50 | + |
| 51 | +// Represents where environment variables are made available |
| 52 | +enum Availability { |
| 53 | + // Runtime environment variables are available on the server when the app is run |
| 54 | + Runtime, |
| 55 | +} |
| 56 | + |
3 | 57 | // Options to configure the build of a framework application
|
4 | 58 | export interface BuildOptions {
|
5 | 59 | // command to run build script (e.g. "npm", "nx", etc.)
|
|
0 commit comments