UNPKG

@nx/angular

Version:

The Nx Plugin for Angular contains executors, generators, and utilities for managing Angular applications and libraries within an Nx workspace. It provides: - Integration with libraries such as Storybook, Jest, ESLint, Tailwind CSS, Playwright and Cypre

20 lines (19 loc) 1.01 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.locateLibraryEntryPointFromDirectory = locateLibraryEntryPointFromDirectory; const devkit_1 = require("@nx/devkit"); const path_1 = require("path"); function locateLibraryEntryPointFromDirectory(tree, directory, projectRoot, projectSourceRoot) { const ngPackageJsonPath = (0, devkit_1.joinPathFragments)(directory, 'ng-package.json'); let entryPointFile = tree.exists(ngPackageJsonPath) ? (0, devkit_1.readJson)(tree, ngPackageJsonPath).lib?.entryFile ?? 'src/public_api.ts' : null; if (entryPointFile) { return (0, devkit_1.joinPathFragments)(directory, entryPointFile); } if (directory === projectRoot) { const indexFile = (0, devkit_1.joinPathFragments)(projectSourceRoot, 'index.ts'); return tree.exists(indexFile) ? indexFile : null; } return locateLibraryEntryPointFromDirectory(tree, (0, path_1.dirname)(directory), projectRoot, projectSourceRoot); }