Skip to content

Commit

Permalink
fix(core): check if package.json exists (#8707)
Browse files Browse the repository at this point in the history
  • Loading branch information
pemsbr committed Mar 22, 2022
1 parent ca7ee2a commit 1f7113d
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions packages/workspace/src/utilities/buildable-libs-utils.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { isNpmProject, ProjectType } from '../core/project-graph';
import { dirname, join, relative, resolve } from 'path';
import { directoryExists } from './fileutils';
import { directoryExists, fileExists } from './fileutils';
import type { ProjectGraph, ProjectGraphProjectNode } from '@nrwl/devkit';
import {
ProjectGraphExternalNode,
Expand Down Expand Up @@ -50,12 +50,12 @@ export function calculateProjectDependencies(
const depNode = projGraph.nodes[dep] || projGraph.externalNodes[dep];
if (depNode.type === ProjectType.lib) {
if (isBuildable(targetName, depNode)) {
const libPackageJson = readJsonFile(
join(root, depNode.data.root, 'package.json')
);
const libPackageJsonFile = join(depNode.data.root, 'package.json');

project = {
name: libPackageJson.name, // i.e. @workspace/mylib
name: fileExists(libPackageJsonFile)
? readJsonFile(libPackageJsonFile).name // i.e. @workspace/mylib
: dep,
outputs: getOutputsForTargetAndConfiguration(
{
overrides: {},
Expand Down

0 comments on commit 1f7113d

Please sign in to comment.