Skip to content

Commit b6b788e

Browse files
alan-agius4jamesdaniels
authored andcommitted
fix(schematics): fix issues with FS and Devkit Paths (#2279)
Angular devkit paths are not interchangeable with Node FS paths. Closes #2088
1 parent 9206962 commit b6b788e

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

src/schematics/deploy/builder.ts

+4-3
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ import {
55
} from "@angular-devkit/architect";
66
import { NodeJsSyncHost } from "@angular-devkit/core/node";
77
import deploy from "./actions";
8-
import { experimental, join, normalize } from "@angular-devkit/core";
8+
import { experimental, normalize } from "@angular-devkit/core";
9+
import * as path from "path";
910
import { getFirebaseProjectName } from "../utils";
1011

1112
// Call the createBuilder() function to create a builder. This mirrors
@@ -29,15 +30,15 @@ export default createBuilder<any>(
2930
const project = workspace.getProject(context.target.project);
3031

3132
const firebaseProject = getFirebaseProjectName(
32-
workspace.root,
33+
context.workspaceRoot,
3334
context.target.project
3435
);
3536

3637
try {
3738
await deploy(
3839
require("firebase-tools"),
3940
context,
40-
join(workspace.root, project.root),
41+
path.join(context.workspaceRoot, project.root),
4142
firebaseProject
4243
);
4344
} catch (e) {

src/schematics/utils.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,11 @@ export const projectPrompt = (projects: Project[]) => {
5555
};
5656

5757
export function getFirebaseProjectName(
58-
projectRoot: string,
58+
workspaceRoot: string,
5959
target: string
6060
): string | undefined {
6161
const { targets }: FirebaseRc = JSON.parse(
62-
readFileSync(join(projectRoot, ".firebaserc"), "UTF-8")
62+
readFileSync(join(workspaceRoot, ".firebaserc"), "UTF-8")
6363
);
6464
const projects = Object.keys(targets!);
6565
return projects.find(

0 commit comments

Comments
 (0)