- Notifications
You must be signed in to change notification settings - Fork 2.2k
Description
Version info
Angular: 12.2.0
Firebase: latest
AngularFire: latest
Other (e.g. Ionic/Cordova, Node, browser, operating system):
How to reproduce these conditions
This can be easily reproduced in Nx by following these steps, but would occur in a regular Angular project if the angular.json file had a similar project configuration to below. Reproduction steps for Nx are found in the Issue mention, for angular just ng new and update the configuration.
Debug output
Expected behavior
ng add @angular/fire passes if sourceRoot and root are both relative to the workspace root
Actual behavior
ng add @angular/fire only passes if sourceRoot is relative to root
In a workspace with a project configured as below, ng add @angular/fire fails due to the sourceRoot path being appended to the root, rather than replacing it.
{ "root": "apps/admin" "sourceRoot": "apps/admin/src" }angularfire/src/schematics/setup/index.ts
Line 36 in 5ecf875
| const sourcePath = [project.root, project.sourceRoot].filter(it => !!it).join('/'); |
Maybe this portion of code could use something like
const sourcePath = project.sourceRoot?.startsWith(project.root) ? project.sourceRoot : [project.root, project.sourceRoot].filter(it => !!it).join('/'); I'd be happy to put in a PR to make the change if its agreed upon.
