Skip to content

Commit 1a99446

Browse files
authored
Add output bundle spec to common module (#244)
* add output bundle spec to common module * Update package.json * packagelock * address comments * fix prettier * add comment * address comments * address comments * prettier * address comment
1 parent 7957560 commit 1a99446

File tree

3 files changed

+68
-2
lines changed

3 files changed

+68
-2
lines changed

package-lock.json

Lines changed: 13 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/@apphosting/common/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@apphosting/common",
3-
"version": "0.0.2",
3+
"version": "0.0.3",
44
"description": "Shared library code for App Hosting framework adapters",
55
"author": {
66
"name": "Firebase",

packages/@apphosting/common/src/index.ts

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,59 @@
11
import { spawn } from "child_process";
22

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+
357
// Options to configure the build of a framework application
458
export interface BuildOptions {
559
// command to run build script (e.g. "npm", "nx", etc.)

0 commit comments

Comments
 (0)