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

Angular i18n, baseHref, and optimized images #5774

Merged
merged 24 commits into from
May 9, 2023
Merged

Conversation

jamesdaniels
Copy link
Member

@jamesdaniels jamesdaniels commented May 2, 2023

  • Add support for Angular i18n
  • Add support for Angular baseUrl
  • Move context logic into utils
  • Shell out all targets, best not to have conditional logic
  • deploy.serveOptimizedImages trips requirement for backend
  • Validate i18n locales
  • Use baseUrl in rewrite (ng & nextjs)
  • Angular needs an i18n root of "/"—I only departed from this with NextJS to aid debugging
  • Add Angular to the WF integration test
  • Bump firebase-frameworks version
  • Give sharp a version range
  • Reset env vars and memos after prepare

@codecov-commenter
Copy link

codecov-commenter commented May 2, 2023

Codecov Report

Patch coverage: 7.78% and project coverage change: -0.15 ⚠️

Comparison is base (9491152) 55.25% compared to head (6d4d072) 55.10%.

Additional details and impacted files
@@            Coverage Diff             @@
##             next    #5774      +/-   ##
==========================================
- Coverage   55.25%   55.10%   -0.15%     
==========================================
  Files         331      332       +1     
  Lines       22793    22878      +85     
  Branches     4655     4679      +24     
==========================================
+ Hits        12594    12607      +13     
- Misses       9077     9147      +70     
- Partials     1122     1124       +2     
Impacted Files Coverage Δ
src/experiments.ts 56.81% <ø> (ø)
src/frameworks/angular/utils.ts 3.97% <3.97%> (ø)
src/frameworks/index.ts 11.56% <7.14%> (-0.27%) ⬇️
src/frameworks/angular/index.ts 25.60% <10.52%> (+16.03%) ⬆️
src/frameworks/utils.ts 43.26% <16.66%> (-2.19%) ⬇️
src/frameworks/next/index.ts 13.88% <20.00%> (-0.06%) ⬇️
src/extensions/extensionsHelper.ts 46.83% <100.00%> (+0.10%) ⬆️
src/frameworks/constants.ts 88.88% <100.00%> (+0.88%) ⬆️

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

const wantsBackend = !!serverTarget;

return { wantsBackend };
const wantsBackend = !!serverTarget || ngOptimizedImage;
Copy link
Member

Choose a reason for hiding this comment

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

maybe we could log the reasons for backend as we do with Next.js?

Copy link
Member Author

Choose a reason for hiding this comment

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

absolutely, i expect more reasons as Angular is on a roll lately

Co-authored-by: Leonardo Ortiz <leo@monogram.io>
src/test/frameworks/angular/index.ts Outdated Show resolved Hide resolved
src/frameworks/interfaces.ts Outdated Show resolved Hide resolved
src/frameworks/angular/utils.ts Show resolved Hide resolved
Copy link
Member

@chalosalvador chalosalvador left a comment

Choose a reason for hiding this comment

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

@jamesdaniels what's a working angular.json file to test this? I'm using a basic i18n set up and getting an error (Error: Failed to lookup view "index" in views directory) when running with firebase emulators:start, it is working when running with ng serve.

@jamesdaniels jamesdaniels changed the base branch from master to next May 3, 2023 17:32
@jamesdaniels
Copy link
Member Author

@chalosalvador the failure is due to your server.ts not being adapted for localization, you'll need to make the following changes:

// The Express app is exported so that it can be used by serverless Functions.
export function app(locale: string): express.Express {
  const server = express();
  const distFolder = join(process.cwd(), `dist/hosting/browser/${locale}`);

Note the local string being passed into app and used for the distFolder. We should def document this & set it up out of box with the starter template.

src/frameworks/index.ts Outdated Show resolved Hide resolved
@jamesdaniels jamesdaniels changed the title Angular i18n Angular i18n, baseHref, and optimized images May 9, 2023
Copy link
Member

@leoortizz leoortizz left a comment

Choose a reason for hiding this comment

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

LGTM! I was able to deploy Angular i18n projects in both MacOS and Windows. Found an issue in Windows with spawn and pushed a fix, all working now!

The error messages also helped me fix my project without leaving the terminal, amazing job @jamesdaniels!

@jamesdaniels jamesdaniels merged commit 94a9ba3 into next May 9, 2023
11 checks passed
@jamesdaniels jamesdaniels deleted the jamesdaniels_ng18n branch May 9, 2023 16:03
tonyjhuang pushed a commit that referenced this pull request May 22, 2023
* Add support for Angular i18n
* Add support for Angular baseUrl
* Move context logic into utils
* Shell out all targets, best not to have conditional logic
* deploy.serveOptimizedImages trips requirement for backend
* Validate i18n locales
* Use baseUrl in rewrite (ng & nextjs)
* Angular needs an i18n root of "/"—I only departed from this with NextJS to aid debugging
* Add Angular to the WF integration test
* Bump firebase-frameworks version
* Give sharp a version range
* Reset env vars and memos after prepare
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants