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

ng-deploy may not have configurations configured... #6584

Merged
merged 6 commits into from
Dec 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Fixed an issue preventing Angular apps using ng-deploy from being emulated or deployed. (#6584)
8 changes: 7 additions & 1 deletion src/frameworks/angular/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import { AssertionError } from "assert";
import { assertIsString } from "../../utils";

async function localesForTarget(

Check warning on line 13 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 @@ -26,7 +26,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 29 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 29 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 @@ -48,7 +48,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 51 in src/frameworks/angular/utils.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Unnecessary escape character: \"

Check warning on line 51 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 @@ -95,7 +95,7 @@
];
}

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

Check warning on line 98 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 98 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 } = relativeRequire(dir, "@angular-devkit/core/node");
const { workspaces } = relativeRequire(dir, "@angular-devkit/core");
Expand All @@ -121,7 +121,7 @@
}

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

Check warning on line 124 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 124 in src/frameworks/angular/utils.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Missing JSDoc comment
const { NodeJsAsyncHost } = relativeRequire(dir, "@angular-devkit/core/node");
const { workspaces } = relativeRequire(dir, "@angular-devkit/core");
const { WorkspaceNodeModulesArchitectHost } = relativeRequire(
Expand Down Expand Up @@ -161,7 +161,7 @@
}

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

Check warning on line 164 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 @@ -220,7 +220,9 @@
}

if (deployTarget) {
const options = await architectHost.getOptionsForTarget(deployTarget);
const options = await architectHost
.getOptionsForTarget(deployTarget)
.catch(() => workspaceProject.targets.get(deployTarget!.target)?.options);
if (!options) throw new FirebaseError("Unable to get options for ng-deploy.");
if (options.buildTarget) {
assertIsString(options.buildTarget);
Expand All @@ -238,6 +240,10 @@
assertIsString(options.serverTarget);
serverTarget = targetFromTargetString(options.serverTarget);
}
if (options.serveTarget) {
assertIsString(options.serveTarget);
serveTarget = targetFromTargetString(options.serveTarget);
}
if (options.serveOptimizedImages) {
serveOptimizedImages = true;
}
Expand Down