Repository navigation
Conversation
This also makes sure to prioritize the latest GA runtime over beta (preview) or experimental ones, and adds a warning for when users are using non-GA runtimes.
There was a problem hiding this comment.
Code Review
This pull request adds support for the nodejs26 (in preview) runtime for Cloud Functions. It updates the runtime selection logic to prefer GA runtimes over preview/experimental runtimes, and adds warnings when preview or experimental runtimes are used. Feedback was provided to improve the maintainability of the runtime status guard check by destructuring the friendly property and combining the beta and experimental status checks to reduce duplication.
| const { deprecationDate, decommissionDate, status } = RUNTIMES[runtime]; | ||
|
|
||
| if (status === "beta") { | ||
| utils.logLabeledWarning( | ||
| "functions", | ||
| `Runtime ${RUNTIMES[runtime].friendly} is in Preview. Pre-release runtimes may not be suitable for production workloads.`, | ||
| ); | ||
| } else if (status === "experimental") { | ||
| utils.logLabeledWarning( | ||
| "functions", | ||
| `Runtime ${RUNTIMES[runtime].friendly} is experimental. Pre-release runtimes may not be suitable for production workloads.`, | ||
| ); | ||
| } |
There was a problem hiding this comment.
We can improve the maintainability and readability of this guard check by destructuring the friendly property from RUNTIMES[runtime] alongside the other properties. Additionally, we can combine the beta and experimental status checks to reduce duplication of the warning message string.
const { friendly, deprecationDate, decommissionDate, status } = RUNTIMES[runtime];
if (status === "beta" || status === "experimental") {
const label = status === "beta" ? "is in Preview" : "is experimental";
utils.logLabeledWarning(
"functions",
`Runtime ${friendly} ${label}. Pre-release runtimes may not be suitable for production workloads.`,
);
}References
- Reduce nesting and simplify branching where possible to keep code clean and maintainable. (link)
|
Missed that invertase has a similar PR out: #11397 |
This also makes sure to prioritize the latest GA runtime over beta (preview) or experimental ones, and adds a warning for when users are using non-GA runtimes.