-
Notifications
You must be signed in to change notification settings - Fork 192
Update version for @apphosting/common #387
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
annajowang
commented
Aug 18, 2025
- Support adapter builds and add tests.
- Clean up
- get test working with esm
- clean
- clean
- more config fixes
- clean
- move OutputBundleConfig to fix lint
- disable eslint
- lint
- dumb fix found
- fix disable comment maybe
- please disable this lint check
- fix a mistake AI did not catch
- Update version for common package
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Summary of Changes
Hello @annajowang, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!
This pull request primarily focuses on enhancing the @apphosting/build
package by introducing robust end-to-end testing for framework adapter builds and generalizing the local build process. It also includes a version bump for the @apphosting/common
package and refines development dependencies to streamline the build environment.
Highlights
- Enhanced Local Build Process: The
apphosting-local-build
command has been enhanced to accept a--framework
option, allowing for more flexible and generic local builds across different frameworks. - Comprehensive E2E Testing: New end-to-end tests have been introduced to rigorously validate the
bundle.yaml
generation for both Next.js and Angular applications, ensuring the correctness of framework adapter outputs. - Dynamic Adapter Version Resolution: The build process now dynamically fetches the latest framework adapter version directly from npm, ensuring that builds consistently utilize the most up-to-date adapters.
- Dependency Streamlining: Several development dependencies were removed from
@apphosting/build
, andtypescript
was explicitly added, contributing to a more streamlined and focused dependency tree. - Package Version Updates: The
@apphosting/common
package has been updated to version0.0.8
, and the@apphosting/build
package to0.1.1
, reflecting ongoing development and improvements.
Using Gemini Code Assist
The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.
Invoking Gemini
You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command>
or @gemini-code-assist <command>
. Below is a summary of the supported commands.
Feature | Command | Description |
---|---|---|
Code Review | /gemini review |
Performs a code review for the current pull request in its current state. |
Pull Request Summary | /gemini summary |
Provides a summary of the current pull request in its current state. |
Comment | @gemini-code-assist | Responds in comments when explicitly tagged, both in issue comments and review comments. |
Help | /gemini help |
Displays a list of available commands. |
Customization
To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/
folder in the base of the repository. Detailed instructions can be found here.
Limitations & Feedback
Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.
You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.
Footnotes
-
Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request introduces a significant feature: adapter-based builds for different frameworks, along with end-to-end tests to validate them. It also includes version bumps and dependency cleanups. My review focuses on improving type safety and robustness in the new test files and build scripts. I've identified a few areas where using more specific types and safer patterns can prevent potential runtime errors and improve code clarity.
import pkg from "@apphosting/common"; | ||
import { scenarios } from "./scenarios.ts"; | ||
import fsExtra from "fs-extra"; | ||
import { parse as parseYaml } from "yaml"; | ||
|
||
const { readFileSync } = fsExtra; | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
const { OutputBundleConfig } = pkg; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This way of importing a type is confusing and can lead to runtime errors. Since OutputBundleConfig
is only used as a type, you can use a type-only import, which is safer and clearer. This also allows you to remove the eslint-disable
and the runtime destructuring.
import pkg from "@apphosting/common"; | |
import { scenarios } from "./scenarios.ts"; | |
import fsExtra from "fs-extra"; | |
import { parse as parseYaml } from "yaml"; | |
const { readFileSync } = fsExtra; | |
// eslint-disable-next-line @typescript-eslint/no-unused-vars | |
const { OutputBundleConfig } = pkg; | |
import type { OutputBundleConfig } from "@apphosting/common"; | |
import { scenarios } from "./scenarios.ts"; | |
import fsExtra from "fs-extra"; | |
import { parse as parseYaml } from "yaml"; | |
const { readFileSync } = fsExtra; |
|
||
const __dirname = dirname(fileURLToPath(import.meta.url)); | ||
|
||
const errors: any[] = []; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
} | ||
} | ||
if (errors.length) { | ||
console.error(errors); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
interface Scenario { | ||
inputs: string[]; | ||
expectedBundleYaml: {}; | ||
tests?: string[]; // List of test files to run | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using {}
as a type is not very descriptive and is similar to any
. It's better to use a more specific type. You could import OutputBundleConfig
from @apphosting/common
and use Partial<OutputBundleConfig>
for expectedBundleYaml
to improve type safety and code clarity.
import type { OutputBundleConfig } from "@apphosting/common";
interface Scenario {
inputs: string[];
expectedBundleYaml: Partial<OutputBundleConfig>;
tests?: string[]; // List of test files to run
}
import promiseSpawn from "@npmcli/promise-spawn"; | ||
import { yellow, bgRed, bold } from "colorette"; | ||
|
||
export async function adapterBuild(projectRoot: string, framework: string) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For better type safety, consider using the Framework
type from @apphosting/common
for the framework
parameter, instead of a generic string
. This requires exporting the Framework
type from @apphosting/common
first, and adding import type { Framework } from '@apphosting/common';
to this file.
export async function adapterBuild(projectRoot: string, framework: string) { | |
export async function adapterBuild(projectRoot: string, framework: Framework) { |
@@ -1,46 +1,23 @@ | |||
#! /usr/bin/env node | |||
import { spawn } from "child_process"; | |||
import { SupportedFrameworks } from "@apphosting/common"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// TODO(#382): parse apphosting.yaml for environment variables / secrets needed during build time. | ||
if (opts.framework && SupportedFrameworks.includes(opts.framework)) { | ||
// TODO(#382): Skip this if there's a custom build command in apphosting.yaml. | ||
await adapterBuild(projectRoot, opts.framework); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
import * as path from "node:path"; | ||
|
||
// List of apphosting supported frameworks. | ||
export const SupportedFrameworks = ["nextjs", "angular"] as const; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To improve type safety across packages, it's a good practice to also export a type alias for the supported frameworks. This can then be used as a specific type instead of a generic string
in functions that accept a framework name.
export const SupportedFrameworks = ["nextjs", "angular"] as const; | |
export const SupportedFrameworks = ["nextjs", "angular"] as const; | |
export type Framework = typeof SupportedFrameworks[number]; |