Skip to content

Commit

Permalink
Angular i18n, baseHref, and optimized images (#5774)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
jamesdaniels authored May 9, 2023
1 parent 25fc217 commit 94a9ba3
Show file tree
Hide file tree
Showing 64 changed files with 25,158 additions and 447 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ lib
node_modules
standalone
templates
.firebase
3 changes: 2 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,8 @@ module.exports = {
// TODO(jamesdaniels): add this to overrides instead
ignorePatterns: [
"src/dynamicImport.js",
"scripts/webframeworks-deploy-tests/hosting/**",
"scripts/webframeworks-deploy-tests/nextjs/**",
"scripts/webframeworks-deploy-tests/angular/**",
"scripts/frameworks-tests/vite-project/**",
"/src/frameworks/docs/**",
// This file is taking a very long time to lint, 2-4m
Expand Down
2 changes: 2 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@
/lib/**/*
/CONTRIBUTING.md
/scripts/frameworks-tests/vite-project/**
/scripts/webframeworks-deploy-tests/angular/**
/scripts/webframeworks-deploy-tests/nextjs/**
/src/frameworks/docs/**
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
- Support for Next.js i18n, basePath, and more advanced rewrites/redirects/headers (#5788)
- hosting.frameworksBackend now respects omit: true (#5788)
- Web Frameworks now memoizes framework builds for single builds across multiple hosting sites (#5788)
- Add support for Angular i18n and baseHref (#5774)
- Trip the backend requirement for Angular applications using ng-deploy w/serveOptimizedImages (#5774)
- Fixes a bug where the Storage emulator would not fall back to open rules for 'demo-' projects if `firebase.json` contained multiple storage targets (#5170)
- Updates `firebase init` function templates for TypeScript and Javascript to 2nd gen (#5775)
- Allow for atomic deployment of Hosting content & Functions rewrites via tag pinning (#5753)
16 changes: 16 additions & 0 deletions scripts/webframeworks-deploy-tests/angular/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Editor configuration, see https://editorconfig.org
root = true

[*]
charset = utf-8
indent_style = space
indent_size = 2
insert_final_newline = true
trim_trailing_whitespace = true

[*.ts]
quote_type = single

[*.md]
max_line_length = off
trim_trailing_whitespace = false
42 changes: 42 additions & 0 deletions scripts/webframeworks-deploy-tests/angular/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# See http://help.github.com/ignore-files/ for more about ignoring files.

# Compiled output
/dist
/tmp
/out-tsc
/bazel-out

# Node
/node_modules
npm-debug.log
yarn-error.log

# IDEs and editors
.idea/
.project
.classpath
.c9/
*.launch
.settings/
*.sublime-workspace

# Visual Studio Code
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
.history/*

# Miscellaneous
/.angular/cache
.sass-cache/
/connect.lock
/coverage
/libpeerconnection.log
testem.log
/typings

# System files
.DS_Store
Thumbs.db
27 changes: 27 additions & 0 deletions scripts/webframeworks-deploy-tests/angular/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Angular

This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 16.0.0.

## Development server

Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The application will automatically reload if you change any of the source files.

## Code scaffolding

Run `ng generate component component-name` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module`.

## Build

Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory.

## Running unit tests

Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io).

## Running end-to-end tests

Run `ng e2e` to execute the end-to-end tests via a platform of your choice. To use this command, you need to first add a package that implements end-to-end testing capabilities.

## Further help

To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI Overview and Command Reference](https://angular.io/cli) page.
198 changes: 198 additions & 0 deletions scripts/webframeworks-deploy-tests/angular/angular.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,198 @@
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"newProjectRoot": "projects",
"projects": {
"angular": {
"projectType": "application",
"schematics": {
"@schematics/angular:component": {
"inlineTemplate": true,
"inlineStyle": true,
"skipTests": true
},
"@schematics/angular:class": {
"skipTests": true
},
"@schematics/angular:directive": {
"skipTests": true
},
"@schematics/angular:guard": {
"skipTests": true
},
"@schematics/angular:interceptor": {
"skipTests": true
},
"@schematics/angular:pipe": {
"skipTests": true
},
"@schematics/angular:resolver": {
"skipTests": true
},
"@schematics/angular:service": {
"skipTests": true
}
},
"root": "",
"sourceRoot": "src",
"prefix": "app",
"i18n": {
"sourceLocale": {
"code": "en",
"baseHref": ""
},
"locales": {
"fr": {
"translation": "src/locale/messages.fr.xlf",
"baseHref": ""
},
"es": {
"translation": "src/locale/messages.es.xlf",
"baseHref": ""
}
}
},
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"localize": true,
"outputPath": "dist/angular/browser",
"index": "src/index.html",
"main": "src/main.ts",
"polyfills": [
"zone.js"
],
"tsConfig": "tsconfig.app.json",
"assets": [
"src/favicon.ico",
"src/assets"
],
"styles": [
"src/styles.css"
],
"scripts": []
},
"configurations": {
"production": {
"budgets": [
{
"type": "initial",
"maximumWarning": "500kb",
"maximumError": "1mb"
},
{
"type": "anyComponentStyle",
"maximumWarning": "2kb",
"maximumError": "4kb"
}
],
"outputHashing": "all"
},
"development": {
"localize": ["en"],
"buildOptimizer": false,
"optimization": false,
"vendorChunk": true,
"extractLicenses": false,
"sourceMap": true,
"namedChunks": true
}
},
"defaultConfiguration": "production"
},
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"configurations": {
"production": {
"browserTarget": "angular:build:production"
},
"development": {
"browserTarget": "angular:build:development"
}
},
"defaultConfiguration": "development"
},
"extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n",
"options": {
"browserTarget": "angular:build"
}
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"polyfills": [
"zone.js",
"zone.js/testing"
],
"tsConfig": "tsconfig.spec.json",
"assets": [
"src/favicon.ico",
"src/assets"
],
"styles": [
"src/styles.css"
],
"scripts": []
}
},
"server": {
"builder": "@angular-devkit/build-angular:server",
"options": {
"localize": true,
"outputPath": "dist/angular/server",
"main": "server.ts",
"tsConfig": "tsconfig.server.json"
},
"configurations": {
"production": {
"outputHashing": "media"
},
"development": {
"buildOptimizer": false,
"optimization": false,
"sourceMap": true,
"extractLicenses": false,
"vendorChunk": true
}
},
"defaultConfiguration": "production"
},
"serve-ssr": {
"builder": "@nguniversal/builders:ssr-dev-server",
"configurations": {
"development": {
"browserTarget": "angular:build:development",
"serverTarget": "angular:server:development"
},
"production": {
"browserTarget": "angular:build:production",
"serverTarget": "angular:server:production"
}
},
"defaultConfiguration": "development"
},
"prerender": {
"builder": "@nguniversal/builders:prerender",
"options": {
"routes": [
"/"
]
},
"configurations": {
"production": {
"browserTarget": "angular:build:production",
"serverTarget": "angular:server:production"
},
"development": {
"browserTarget": "angular:build:development",
"serverTarget": "angular:server:development"
}
},
"defaultConfiguration": "production"
}
}
}
}
}
Loading

0 comments on commit 94a9ba3

Please sign in to comment.