Skip to content

fix(@angular/build): support case-insensitive and alternative license file names - #33744

Merged
alan-agius4 merged 1 commit into
angular:mainfrom
alan-agius4:fix-license-extractor-33741
Aug 4, 2026
Merged

fix(@angular/build): support case-insensitive and alternative license file names#33744
alan-agius4 merged 1 commit into
angular:mainfrom
alan-agius4:fix-license-extractor-33741

Conversation

@alan-agius4

Copy link
Copy Markdown
Collaborator

When extracting third-party license files in license-extractor, replace the hardcoded list of uppercase filenames with a directory scan using readdir(packageDirectory, { withFileTypes: true }) and matching against /^(?:mit-)?licen[cs]e(?:$|[-._])/i. This enables support for lowercase license files (license) on case-sensitive file systems, British English spelling (LICENCE), and prefixed/suffixed variations (MIT-LICENCE.txt, LICENSE-MIT, LICENSE.BSD).

In addition, deduplicate package directory paths before reading and parsing package.json to reduce redundant disk I/O, and fix an off-by-one truncation bug when handling custom "SEE LICENSE IN " packages.

Closes #33741

@angular-robot angular-robot Bot added area: build & ci Related the build and CI infrastructure of the project area: performance Issues related to performance area: @angular/build area: @angular/cli area: @angular/ssr labels Aug 4, 2026
gemini-code-assist[bot]

This comment was marked as off-topic.

@alan-agius4
alan-agius4 force-pushed the fix-license-extractor-33741 branch from ac114cd to 83d45af Compare August 4, 2026 10:00
@alan-agius4 alan-agius4 removed area: @angular/cli area: build & ci Related the build and CI infrastructure of the project area: @angular/ssr area: @angular/build area: performance Issues related to performance labels Aug 4, 2026
@alan-agius4

Copy link
Copy Markdown
Collaborator Author

/gemini review

@alan-agius4 alan-agius4 added action: review The PR is still awaiting reviews from at least one requested reviewer target: patch This PR is targeted for the next patch release labels Aug 4, 2026
@alan-agius4
alan-agius4 requested a review from clydin August 4, 2026 10:10

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request enhances the license extraction process by using a regular expression to match a wider variety of license file names (including lowercase and alternative formats) and fixing custom license path parsing. It also adds a check to avoid duplicate processing of package directories and includes corresponding unit tests. Feedback is provided regarding a potential issue where a failure in readdir would skip the entire package metadata extraction; a code suggestion is offered to catch the error and default to an empty array to preserve the original behavior.

Comment thread packages/angular/build/src/tools/esbuild/license-extractor.ts Outdated
… file names

When extracting third-party license files in `license-extractor`, replace the hardcoded list of uppercase filenames with a directory scan using `readdir(packageDirectory, { withFileTypes: true })` and matching against `/^(?:mit-)?licen[cs]e(?:$|[-._])/i`. This enables support for lowercase license files (`license`) on case-sensitive file systems, British English spelling (`LICENCE`), and prefixed/suffixed variations (`MIT-LICENCE.txt`, `LICENSE-MIT`, `LICENSE.BSD`).

In addition, deduplicate package directory paths before reading and parsing `package.json` to reduce redundant disk I/O, and fix an off-by-one truncation bug when handling custom "SEE LICENSE IN <filename>" packages.

Closes angular#33741
@alan-agius4 alan-agius4 added action: merge The PR is ready for merge by the caretaker and removed action: review The PR is still awaiting reviews from at least one requested reviewer labels Aug 4, 2026
@alan-agius4
alan-agius4 merged commit e1c7193 into angular:main Aug 4, 2026
40 of 41 checks passed
@alan-agius4
alan-agius4 deleted the fix-license-extractor-33741 branch August 4, 2026 16:31
@alan-agius4

Copy link
Copy Markdown
Collaborator Author

This PR was merged into the repository. The changes were merged into the following branches:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

action: merge The PR is ready for merge by the caretaker area: @angular/build target: patch This PR is targeted for the next patch release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Missing license text in 3rdpartylicenses.txt

2 participants