fix(node): cleanup generated paths for node libs (#14674)

This commit is contained in:
Nicholas Cunningham 2023-01-27 13:47:11 -07:00 committed by GitHub
parent 3f4a956d38
commit 3cdaacf5d4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -140,12 +140,19 @@ function updateProject(tree: Tree, options: NormalizedSchema) {
const project = readProjectConfiguration(tree, options.name);
const { libsDir } = getWorkspaceLayout(tree);
const rootProject = options.projectRoot === '.' || options.projectRoot === '';
project.targets = project.targets || {};
project.targets.build = {
executor: `@nrwl/js:${options.compiler}`,
outputs: ['{options.outputPath}'],
options: {
outputPath: `dist/${libsDir}/${options.projectDirectory}`,
outputPath: joinPathFragments(
'dist',
rootProject
? options.projectDirectory
: `${libsDir}/${options.projectDirectory}`
),
tsConfig: `${options.projectRoot}/tsconfig.lib.json`,
packageJson: `${options.projectRoot}/package.json`,
main: `${options.projectRoot}/src/index` + (options.js ? '.js' : '.ts'),