From 8e3f7d8605c4ea010cd4ec62af2eea19723158c2 Mon Sep 17 00:00:00 2001 From: Pedro Rodrigues <4513618+pemsbr@users.noreply.github.com> Date: Fri, 8 Apr 2022 15:28:24 +0100 Subject: [PATCH] fix(core): build project's that have buildable dependencies without package.json's (#9466) --- .../workspace/src/utilities/buildable-libs-utils.ts | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/packages/workspace/src/utilities/buildable-libs-utils.ts b/packages/workspace/src/utilities/buildable-libs-utils.ts index 73e8af58d6d1a..2cd6d3a844eb8 100644 --- a/packages/workspace/src/utilities/buildable-libs-utils.ts +++ b/packages/workspace/src/utilities/buildable-libs-utils.ts @@ -1,5 +1,5 @@ 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, @@ -50,12 +50,16 @@ export function calculateProjectDependencies( const depNode = projGraph.nodes[dep] || projGraph.externalNodes[dep]; if (depNode.type === 'lib') { if (isBuildable(targetName, depNode)) { - const libPackageJson = readJsonFile( - join(root, depNode.data.root, 'package.json') + const libPackageJsonPath = join( + root, + depNode.data.root, + 'package.json' ); project = { - name: libPackageJson.name, // i.e. @workspace/mylib + name: fileExists(libPackageJsonPath) + ? readJsonFile(libPackageJsonPath).name // i.e. @workspace/mylib + : dep, outputs: getOutputsForTargetAndConfiguration( { overrides: {},