Skip to content

Commit

Permalink
Add support for nodejs18 (in preview). (#5319)
Browse files Browse the repository at this point in the history
  • Loading branch information
taeold authored Dec 10, 2022
1 parent 934e4e5 commit 26b97ba
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
- Handle Next.js rewrites/redirects/headers incompatible with `firebase.json` in Cloud Functions (#5212)
- Filter out Next.js prerendered routes that matches rewrites/redirects/headers rules from SSG content directory (#5212)
- Warn if a web framework's package.json contains anything other than the framework default build command.
- Add support for nodejs18 for Cloud Functions for Firebase (#5319)
6 changes: 4 additions & 2 deletions schema/firebase-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,8 @@
"nodejs10",
"nodejs12",
"nodejs14",
"nodejs16"
"nodejs16",
"nodejs18"
],
"type": "string"
},
Expand Down Expand Up @@ -442,7 +443,8 @@
"nodejs10",
"nodejs12",
"nodejs14",
"nodejs16"
"nodejs16",
"nodejs18"
],
"type": "string"
},
Expand Down
3 changes: 2 additions & 1 deletion src/deploy/functions/runtimes/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import * as validate from "../validate";
import { FirebaseError } from "../../../error";

/** Supported runtimes for new Cloud Functions. */
const RUNTIMES: string[] = ["nodejs10", "nodejs12", "nodejs14", "nodejs16"];
const RUNTIMES: string[] = ["nodejs10", "nodejs12", "nodejs14", "nodejs16", "nodejs18"];
// Experimental runtimes are part of the Runtime type, but are in a
// different list to help guard against some day accidentally iterating over
// and printing a hidden runtime to the user.
Expand Down Expand Up @@ -33,6 +33,7 @@ const MESSAGE_FRIENDLY_RUNTIMES: Record<Runtime | DeprecatedRuntime, string> = {
nodejs12: "Node.js 12",
nodejs14: "Node.js 14",
nodejs16: "Node.js 16",
nodejs18: "Node.js 18",
go113: "Go 1.13",
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ const ENGINE_RUNTIMES: Record<number, runtimes.Runtime | runtimes.DeprecatedRunt
12: "nodejs12",
14: "nodejs14",
16: "nodejs16",
18: "nodejs18",
};

const ENGINE_RUNTIMES_NAMES = Object.values(ENGINE_RUNTIMES);
Expand Down
2 changes: 1 addition & 1 deletion src/firebaseConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import { RequireAtLeastOne } from "./metaprogramming";

// should be sourced from - https://github.com/firebase/firebase-tools/blob/master/src/deploy/functions/runtimes/index.ts#L15
type CloudFunctionRuntimes = "nodejs10" | "nodejs12" | "nodejs14" | "nodejs16";
type CloudFunctionRuntimes = "nodejs10" | "nodejs12" | "nodejs14" | "nodejs16" | "nodejs18";

export type Deployable = {
predeploy?: string | string[];
Expand Down

0 comments on commit 26b97ba

Please sign in to comment.