Skip to content

Commit 1a5df35

Browse files
committed
fixup! feat(@schematics/angular): use library builder and add entry-point schematic
1 parent 9636cf2 commit 1a5df35

2 files changed

Lines changed: 10 additions & 11 deletions

File tree

‎packages/schematics/angular/entry-point/index.ts‎

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -56,13 +56,6 @@ export default createProjectSchematic<EntryPointOptions>((options, { project, tr
5656
throw new SchematicsException('Entry point name "package.json" is reserved.');
5757
}
5858

59-
if (options.name === 'src' || options.name.startsWith('src/')) {
60-
throw new SchematicsException(
61-
`Entry point name "${options.name}" cannot be "src" or start with "src/" ` +
62-
'as it conflicts with the primary entry point source directory.',
63-
);
64-
}
65-
6659
const libDir = project.root;
6760
const packageJsonPath = join(libDir, 'package.json');
6861
if (!tree.exists(packageJsonPath)) {

‎packages/schematics/angular/utility/workspace.ts‎

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -116,10 +116,16 @@ export async function writeWorkspace(
116116
* @param project The project which will have its default path generated.
117117
*/
118118
export function buildDefaultPath(project: workspaces.ProjectDefinition): string {
119-
const root =
120-
project.sourceRoot && project.sourceRoot !== project.root
121-
? `/${project.sourceRoot}/`
122-
: `/${project.root}/src/`;
119+
let root: string;
120+
if (project.extensions['projectType'] === ProjectType.Library) {
121+
root =
122+
project.sourceRoot && project.sourceRoot !== project.root
123+
? `/${project.sourceRoot}/`
124+
: `/${project.root}/src/`;
125+
} else {
126+
root = `/${project.sourceRoot || project.root}/`; // fallback for non-library projects
127+
}
128+
123129
const projectDirName =
124130
project.extensions['projectType'] === ProjectType.Application ? 'app' : 'lib';
125131

0 commit comments

Comments
 (0)