Skip to content
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

fix: support deployment of an Angular app using legacy browser builder #7264

Merged
merged 5 commits into from
Jun 4, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@
- Improved handling of 'fresh from Console' services during `init dataconnect`.
- Add support for node22 in function deployments (#7252).
- Update to Firebase Data Connect Emulator v1.2.0, which adds support for Postgres 16 and creates the Postgres database specified in dataconnect.yaml or .firebaserc if it does not already exist.
- Support deployment of an Angular app using legacy browser builder (#7264)
9 changes: 8 additions & 1 deletion src/frameworks/angular/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import { assertIsString } from "../../utils";
import { coerce } from "semver";

async function localesForTarget(

Check warning on line 14 in src/frameworks/angular/utils.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Missing return type on function
dir: string,
architectHost: WorkspaceNodeModulesArchitectHost,
target: Target,
Expand All @@ -27,7 +27,7 @@
let locales: string[] | undefined = undefined;
let defaultLocale: string | undefined = undefined;
if (targetOptions.localize) {
const i18n: AngularI18nConfig | undefined = workspaceProject.extensions?.i18n as any;

Check warning on line 30 in src/frameworks/angular/utils.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Unsafe assignment of an `any` value

Check warning on line 30 in src/frameworks/angular/utils.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Unexpected any. Specify a different type
if (!i18n) throw new FirebaseError(`No i18n config on project.`);
if (typeof i18n.sourceLocale === "string") {
throw new FirebaseError(`All your i18n locales must have a baseHref of "" on Firebase, use an object for sourceLocale in your angular.json:
Expand All @@ -49,7 +49,7 @@
for (const [locale, { baseHref }] of Object.entries(i18n.locales)) {
if (baseHref !== "")
throw new FirebaseError(
`All your i18n locales must have a baseHref of \"\" on Firebase, errored on ${locale}.`,

Check warning on line 52 in src/frameworks/angular/utils.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Unnecessary escape character: \"

Check warning on line 52 in src/frameworks/angular/utils.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Unnecessary escape character: \"
);
locales.push(locale);
}
Expand Down Expand Up @@ -96,7 +96,7 @@
];
}

export async function getAllTargets(purpose: BUILD_TARGET_PURPOSE, dir: string) {

Check warning on line 99 in src/frameworks/angular/utils.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Missing return type on function

Check warning on line 99 in src/frameworks/angular/utils.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Missing JSDoc comment
const validBuilders = getValidBuilders(purpose);
const [{ NodeJsAsyncHost }, { workspaces }, { targetStringFromTarget }] = await Promise.all([
relativeRequire(dir, "@angular-devkit/core/node"),
Expand All @@ -123,7 +123,7 @@
}

// TODO(jamesdaniels) memoize, dry up
export async function getContext(dir: string, targetOrConfiguration?: string) {

Check warning on line 126 in src/frameworks/angular/utils.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Missing return type on function

Check warning on line 126 in src/frameworks/angular/utils.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Missing JSDoc comment
const [
{ NodeJsAsyncHost },
{ workspaces },
Expand Down Expand Up @@ -165,7 +165,7 @@
}

if (!project) {
const angularJson = parse(await host.readFile(join(dir, "angular.json")));

Check warning on line 168 in src/frameworks/angular/utils.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Unsafe assignment of an `any` value
project = angularJson.defaultProject;
}

Expand Down Expand Up @@ -355,6 +355,7 @@
const { builder } = definition;
if (target === deployTarget && builder === ExpectedBuilder.DEPLOY) continue;
if (target === buildTarget && builder === ExpectedBuilder.APPLICATION) continue;
if (target === buildTarget && builder === ExpectedBuilder.LEGACY_BROWSER) continue;
if (target === browserTarget && builder === ExpectedBuilder.BROWSER_ESBUILD) continue;
if (target === browserTarget && builder === ExpectedBuilder.LEGACY_BROWSER) continue;
if (target === prerenderTarget && builder === ExpectedBuilder.LEGACY_DEVKIT_PRERENDER)
Expand Down Expand Up @@ -420,7 +421,13 @@
);
const targetOptions = await architectHost.getOptionsForTarget(buildOrBrowserTarget);
assertIsString(targetOptions?.outputPath);
const outputPath = join(targetOptions.outputPath, buildTarget ? "browser" : "");

const builderName = await architectHost.getBuilderNameForTarget(buildOrBrowserTarget);
9kubczas4 marked this conversation as resolved.
Show resolved Hide resolved

const outputPath =
builderName === ExpectedBuilder.APPLICATION
? join(targetOptions.outputPath, buildTarget ? "browser" : "")
: targetOptions.outputPath;
9kubczas4 marked this conversation as resolved.
Show resolved Hide resolved
return { locales, baseHref, outputPath, defaultLocale };
}

Expand Down
Loading