Skip to content

Commit

Permalink
fix(node): restore and fix output path logic for root projects in lib…
Browse files Browse the repository at this point in the history
…rary generator
  • Loading branch information
leosvelperez committed Aug 18, 2023
1 parent 7fe0166 commit e20343d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/node/src/generators/library/library.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,13 +159,17 @@ function updateProject(tree: Tree, options: NormalizedSchema) {
}

const project = readProjectConfiguration(tree, options.projectName);
const rootProject = options.projectRoot === '.' || options.projectRoot === '';

project.targets = project.targets || {};
project.targets.build = {
executor: `@nx/js:${options.compiler}`,
outputs: ['{options.outputPath}'],
options: {
outputPath: joinPathFragments('dist', options.projectRoot),
outputPath: joinPathFragments(
'dist',
rootProject ? options.projectName : options.projectRoot
),
tsConfig: `${options.projectRoot}/tsconfig.lib.json`,
packageJson: `${options.projectRoot}/package.json`,
main: `${options.projectRoot}/src/index` + (options.js ? '.js' : '.ts'),
Expand Down

0 comments on commit e20343d

Please sign in to comment.