Skip to content

Commit

Permalink
Single n19 sample (#3591)
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesdaniels authored Dec 14, 2024
1 parent 45ccd39 commit bc926a8
Show file tree
Hide file tree
Showing 267 changed files with 20,439 additions and 41,931 deletions.
37 changes: 9 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ export const appConfig: ApplicationConfig = {
```

```ts
import { AsyncPipe } from '@angular/common';
import { inject } from '@angular/core';
import { Firestore, collectionData, collection } from '@angular/fire/firestore';
import { Observable } from 'rxjs';

interface Item {
name: string,
Expand All @@ -44,7 +44,6 @@ interface Item {

@Component({
selector: 'app-root',
standalone: true,
template: `
<ul>
@for (item of (item$ | async); track item) {
Expand All @@ -53,30 +52,16 @@ interface Item {
</li>
}
</ul>
`
`,
imports: [AsyncPipe]
})
export class AppComponent {
item$: Observable<Item[]>;
firestore: Firestore = inject(Firestore);

constructor() {
const itemCollection = collection(this.firestore, 'items');
this.item$ = collectionData<Item>(itemCollection);
}
firestore = inject(Firestore);
itemCollection = collection(this.firestore, 'items');
item$ = collectionData<Item>(itemCollection);
}
```

### Polyfills

Neither AngularFire nor Firebase ship with polyfills. To have compatibility across a wide-range of environments, we suggest the following polyfills be added to your application:

| API | Environments | Suggested Polyfill | License |
|-----|--------------|--------------------|---------|
| Various ES5+ features | Safari &lt; 10 | [`core-js/stable`](https://github.com/zloirock/core-js#readme) | MIT |
| `globalThis` | [Chrome &lt; 71<br>Safari &lt; 12.1<br>iOS &lt; 12.2<br>Node &lt; 12](https://caniuse.com/mdn-javascript_builtins_globalthis) | [`globalThis`](https://github.com/es-shims/globalThis#readme) | MIT |
| `Proxy` | [Safari &lt; 10](https://caniuse.com/proxy) | [`proxy-polyfill`](https://github.com/GoogleChrome/proxy-polyfill#readme) | Apache 2.0 |
| `fetch` | [Safari &lt; 10.1<br>iOS &lt; 10.3](https://caniuse.com/fetch) | [`cross-fetch`](https://github.com/lquixada/cross-fetch#readme) | MIT |

## Resources

[Quickstart](docs/install-and-setup.md) - Get your first application up and running by following our quickstart guide.
Expand All @@ -85,15 +70,11 @@ Neither AngularFire nor Firebase ship with polyfills. To have compatibility acro

[Stackblitz Template](https://stackblitz.com/edit/angular-fire-start) - Remember to set your Firebase configuration in `app/app.module.ts`.

[Upgrading to v7.0? Check out our guide.](docs/version-7-upgrade.md)

### Sample apps
[Upgrading from v6.0? Check out our guide.](docs/version-7-upgrade.md)

We have three sample apps in this repository:
### Sample app

1. [`samples/compat`](samples/compat) a kitchen sink application that demonstrates use of the "compatibility" API
1. [`samples/modular`](samples/modular) a kitchen sink application that demonstrates the new tree-shakable API
1. [`samples/advanced`](samples/advanced) the same app as `samples/modular` but demonstrates more advanced concepts such as Angular Universal state-transfer, dynamically importing Firebase feature modules, and Firestore data bundling.
The [`sample`](sample) folder contains a kitchen sink application that demonstrates use of the "modular" API, in a zoneless server-rendered application, with all the bells and whistles.

### Having troubles?

Expand Down
1 change: 1 addition & 0 deletions samples/advanced/.editorconfig → sample/.editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ trim_trailing_whitespace = true

[*.ts]
quote_type = single
ij_typescript_use_double_quotes = false

[*.md]
max_line_length = off
Expand Down
File renamed without changes.
29 changes: 15 additions & 14 deletions samples/advanced/.gitignore → sample/.gitignore
Original file line number Diff line number Diff line change
@@ -1,46 +1,47 @@
# See http://help.github.com/ignore-files/ for more about ignoring files.
# See https://docs.github.com/get-started/getting-started-with-git/ignoring-files for more about ignoring files.

# compiled output
# Compiled output
/dist
/tmp
/out-tsc
# Only exists if Bazel was run
/bazel-out

# dependencies
# Node
/node_modules

# profiling files
chrome-profiler-events*.json
npm-debug.log
yarn-error.log

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

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

# misc
# Miscellaneous
/.angular/cache
/.sass-cache
.sass-cache/
/connect.lock
/coverage
/libpeerconnection.log
npm-debug.log
yarn-error.log
testem.log
/typings

# System Files
# System files
.DS_Store
Thumbs.db

# Firebase
.firebase
*-debug.log
.runtimeconfig.json
59 changes: 59 additions & 0 deletions sample/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# Ng19Test

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

## Development server

To start a local development server, run:

```bash
ng serve
```

Once the server is running, open your browser and navigate to `http://localhost:4200/`. The application will automatically reload whenever you modify any of the source files.

## Code scaffolding

Angular CLI includes powerful code scaffolding tools. To generate a new component, run:

```bash
ng generate component component-name
```

For a complete list of available schematics (such as `components`, `directives`, or `pipes`), run:

```bash
ng generate --help
```

## Building

To build the project run:

```bash
ng build
```

This will compile your project and store the build artifacts in the `dist/` directory. By default, the production build optimizes your application for performance and speed.

## Running unit tests

To execute unit tests with the [Karma](https://karma-runner.github.io) test runner, use the following command:

```bash
ng test
```

## Running end-to-end tests

For end-to-end (e2e) testing, run:

```bash
ng e2e
```

Angular CLI does not come with an end-to-end testing framework by default. You can choose one that suits your needs.

## Additional Resources

For more information on using the Angular CLI, including detailed command references, visit the [Angular CLI Overview and Command Reference](https://angular.dev/tools/cli) page.
97 changes: 97 additions & 0 deletions sample/angular.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"newProjectRoot": "projects",
"projects": {
"ng19-test": {
"projectType": "application",
"schematics": {},
"root": "",
"sourceRoot": "src",
"prefix": "app",
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:application",
"options": {
"outputPath": "dist/ng19-test",
"index": "src/index.html",
"browser": "src/main.ts",
"polyfills": [],
"tsConfig": "tsconfig.app.json",
"assets": [
{
"glob": "**/*",
"input": "public"
}
],
"styles": [
"src/styles.css"
],
"scripts": [],
"server": "src/main.server.ts",
"outputMode": "server",
"ssr": {
"entry": "src/server.ts"
},
"externalDependencies": ["firebase-admin", "cookie-store"]
},
"configurations": {
"production": {
"budgets": [
{
"type": "initial",
"maximumWarning": "500kB",
"maximumError": "1MB"
},
{
"type": "anyComponentStyle",
"maximumWarning": "4kB",
"maximumError": "8kB"
}
],
"outputHashing": "all"
},
"development": {
"optimization": false,
"extractLicenses": false,
"sourceMap": true
}
},
"defaultConfiguration": "production"
},
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"configurations": {
"production": {
"buildTarget": "ng19-test:build:production"
},
"development": {
"buildTarget": "ng19-test:build:development"
}
},
"defaultConfiguration": "development"
},
"extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n"
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"polyfills": [],
"tsConfig": "tsconfig.spec.json",
"assets": [
{
"glob": "**/*",
"input": "public"
}
],
"styles": [
"src/styles.css"
],
"scripts": []
}
}
}
}
}
}
File renamed without changes.
15 changes: 15 additions & 0 deletions samples/.emulator/firebase.json → sample/firebase.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,21 @@
"storage": {
"rules": "storage.rules"
},
"functions": [
{
"source": "functions",
"codebase": "default",
"ignore": [
"node_modules",
".git",
"firebase-debug.log",
"firebase-debug.*.log"
],
"predeploy": [
"npm --prefix \"$RESOURCE_DIR\" run build"
]
}
],
"emulators": {
"auth": {
"port": 9099
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ typings/

# Node.js dependency directory
node_modules/
lib/
Loading

0 comments on commit bc926a8

Please sign in to comment.