Skip to content

Commit

Permalink
fix(angular): do not add target defaults for the ng-packagr-lite exec…
Browse files Browse the repository at this point in the history
…utor when generating non-buildable library (#21935)
  • Loading branch information
leosvelperez committed Feb 22, 2024
1 parent 5d6abe4 commit 41fc835
Showing 1 changed file with 26 additions and 26 deletions.
52 changes: 26 additions & 26 deletions packages/angular/src/generators/library/lib/add-project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,41 +8,41 @@ export function addProject(
tree: Tree,
libraryOptions: NormalizedSchema['libraryOptions']
) {
const executor = libraryOptions.publishable
? '@nx/angular:package'
: '@nx/angular:ng-packagr-lite';

addBuildTargetDefaults(tree, executor);
const project: AngularProjectConfiguration = {
name: libraryOptions.name,
root: libraryOptions.projectRoot,
sourceRoot: joinPathFragments(libraryOptions.projectRoot, 'src'),
prefix: libraryOptions.prefix,
tags: libraryOptions.parsedTags,
projectType: 'library',
targets: {
build:
libraryOptions.buildable || libraryOptions.publishable
? {
executor,
outputs: ['{workspaceRoot}/dist/{projectRoot}'],
options: {
project: `${libraryOptions.projectRoot}/ng-package.json`,
},
configurations: {
production: {
tsConfig: `${libraryOptions.projectRoot}/tsconfig.lib.prod.json`,
},
development: {
tsConfig: `${libraryOptions.projectRoot}/tsconfig.lib.json`,
},
},
defaultConfiguration: 'production',
}
: undefined,
},
targets: {},
};

if (libraryOptions.buildable || libraryOptions.publishable) {
const executor = libraryOptions.publishable
? '@nx/angular:package'
: '@nx/angular:ng-packagr-lite';

addBuildTargetDefaults(tree, executor);

project.targets.build = {
executor,
outputs: ['{workspaceRoot}/dist/{projectRoot}'],
options: {
project: `${libraryOptions.projectRoot}/ng-package.json`,
},
configurations: {
production: {
tsConfig: `${libraryOptions.projectRoot}/tsconfig.lib.prod.json`,
},
development: {
tsConfig: `${libraryOptions.projectRoot}/tsconfig.lib.json`,
},
},
defaultConfiguration: 'production',
};
}

addProjectConfiguration(tree, libraryOptions.name, project);
return project;
}

0 comments on commit 41fc835

Please sign in to comment.