Skip to content

Commit

Permalink
fix(schematics): fix issues with FS and Devkit Paths (#2279)
Browse files Browse the repository at this point in the history
Angular devkit paths are not interchangeable with Node FS paths.

Closes #2088
  • Loading branch information
alan-agius4 authored and jamesdaniels committed Jan 17, 2020
1 parent f3b7bd8 commit 5ccf5db
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
7 changes: 4 additions & 3 deletions src/schematics/deploy/builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ import {
} from "@angular-devkit/architect";
import { NodeJsSyncHost } from "@angular-devkit/core/node";
import deploy from "./actions";
import { experimental, join, normalize } from "@angular-devkit/core";
import { experimental, normalize } from "@angular-devkit/core";
import * as path from "path";
import { getFirebaseProjectName } from "../utils";

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

const firebaseProject = getFirebaseProjectName(
workspace.root,
context.workspaceRoot,
context.target.project
);

try {
await deploy(
require("firebase-tools"),
context,
join(workspace.root, project.root),
path.join(context.workspaceRoot, project.root),
firebaseProject
);
} catch (e) {
Expand Down
4 changes: 2 additions & 2 deletions src/schematics/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,11 @@ export const projectPrompt = (projects: Project[]) => {
};

export function getFirebaseProjectName(
projectRoot: string,
workspaceRoot: string,
target: string
): string | undefined {
const { targets }: FirebaseRc = JSON.parse(
readFileSync(join(projectRoot, ".firebaserc"), "UTF-8")
readFileSync(join(workspaceRoot, ".firebaserc"), "UTF-8")
);
const projects = Object.keys(targets!);
return projects.find(
Expand Down

0 comments on commit 5ccf5db

Please sign in to comment.