Skip to content

Commit 8b12f35

Browse files
committed
fixup! fix(@angular/build): validate library outputPath and avoid duplicate secondary README assets
1 parent 58fbe75 commit 8b12f35

2 files changed

Lines changed: 2 additions & 31 deletions

File tree

‎packages/angular/build/src/builders/library/options.ts‎

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -105,35 +105,6 @@ export async function normalizeLibraryOptions(
105105
{ glob: 'README.md', input: projectRoot, output: '.' },
106106
];
107107

108-
const primaryEntryPoint = entryPoints.get('.');
109-
const primaryEntryDir = primaryEntryPoint
110-
? path.posix.dirname(primaryEntryPoint.entryFilePath)
111-
: undefined;
112-
const seenReadmeAssets = new Set<string>();
113-
114-
for (const entryPoint of entryPoints.values()) {
115-
if (entryPoint.isPrimary) {
116-
continue;
117-
}
118-
119-
const entryDir = path.posix.dirname(entryPoint.entryFilePath);
120-
if (entryDir === projectRoot || entryDir === primaryEntryDir) {
121-
continue;
122-
}
123-
124-
const readmeKey = `${entryDir}:${entryPoint.name}`;
125-
if (seenReadmeAssets.has(readmeKey)) {
126-
continue;
127-
}
128-
seenReadmeAssets.add(readmeKey);
129-
130-
defaultAssets.push({
131-
glob: 'README.md',
132-
input: entryDir,
133-
output: entryPoint.name,
134-
});
135-
}
136-
137108
const assets = normalizeAssetPatterns(
138109
[...defaultAssets, ...(rawAssets ?? [])],
139110
workspaceRoot,

‎packages/angular/build/src/builders/library/tests/options/assets_spec.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ describeLibraryBuilder(executeLibraryBuilder, LIBRARY_BUILDER_INFO, (harness) =>
101101
expect(harness.hasFile('dist/lib/testing/README.md')).toBeFalse();
102102
});
103103

104-
it('should copy secondary entry point README.md when located in its own directory', async () => {
104+
it('should only copy the root README.md by default and not secondary entry point README.md files', async () => {
105105
await harness.writeFiles({
106106
'projects/lib/README.md': '# Root Library README',
107107
'projects/lib/testing/README.md': '# Testing Entry Point README',
@@ -122,7 +122,7 @@ describeLibraryBuilder(executeLibraryBuilder, LIBRARY_BUILDER_INFO, (harness) =>
122122
expect(result?.success).toBeTrue();
123123

124124
expect(harness.readFile('dist/lib/README.md')).toBe('# Root Library README');
125-
expect(harness.readFile('dist/lib/testing/README.md')).toBe('# Testing Entry Point README');
125+
expect(harness.hasFile('dist/lib/testing/README.md')).toBeFalse();
126126
});
127127
});
128128
});

0 commit comments

Comments
 (0)