Skip to content

make local builds respect "ignore" files when uploading the built output#10438

Draft
falahat wants to merge 7 commits intomainfrom
local_builds_ignore_files
Draft

make local builds respect "ignore" files when uploading the built output#10438
falahat wants to merge 7 commits intomainfrom
local_builds_ignore_files

Conversation

@falahat
Copy link
Copy Markdown
Contributor

@falahat falahat commented Apr 30, 2026

Description

We already respect the "ignore" entry in firebase.json for source deploys and we want to do the same for local builds.

One crucial difference. For local builds, we apply this filter AFTER the build, on the built output. We can not prevent files from being included in the build.

Scenarios Tested

  • Test a local build with an ignore file
  • Manually inspect the uploaded content

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a 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 refactors the ignore pattern logic in src/deploy/apphosting/util.ts by centralizing it into a new resolveIgnorePatterns function, which is now utilized by both createLocalBuildTarArchive and createSourceDeployArchive. Additionally, it introduces unit tests to ensure that ignore patterns from configuration and .gitignore files are correctly respected. Feedback includes a recommendation to avoid using 'as any' in test files to comply with the repository's style guide and a suggestion to remove the export keyword from the new utility function if it is only intended for internal use.

Comment thread src/deploy/apphosting/util.spec.ts Outdated
Comment on lines +115 to +118
const configWithoutIgnore = {
backendId: "test-backend",
rootDir: "",
} as any;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The use of as any is discouraged by the repository style guide. While this is a test case, it's better to use a more type-safe approach, such as casting to unknown first or using a Partial type if the intention is to simulate a missing property. However, the best approach would be to ensure the type definition for AppHostingSingle correctly reflects that ignore might be optional if that is indeed the case at runtime.

Suggested change
const configWithoutIgnore = {
backendId: "test-backend",
rootDir: "",
} as any;
const configWithoutIgnore = {
backendId: "test-backend",
rootDir: "",
} as unknown as AppHostingSingle;
References
  1. Never use any or unknown as an escape hatch. Define proper interfaces/types or use type guards. (link)

Comment thread src/deploy/apphosting/util.ts Outdated
return tmpFile;
}

export function resolveIgnorePatterns(config: AppHostingSingle, targetDir: string): string[] {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The function resolveIgnorePatterns is currently exported but only appears to be used within this file (util.ts). To maintain a clean API surface and follow encapsulation best practices, consider removing the export keyword unless this function is intended to be used by other modules in the future.

Suggested change
export function resolveIgnorePatterns(config: AppHostingSingle, targetDir: string): string[] {
function resolveIgnorePatterns(config: AppHostingSingle, targetDir: string): string[] {

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants