fix(@angular/build): support case-insensitive and alternative license file names - #33744
Merged
Merged
Conversation
alan-agius4
force-pushed
the
fix-license-extractor-33741
branch
from
August 4, 2026 10:00
ac114cd to
83d45af
Compare
Collaborator
Author
|
/gemini review |
There was a problem hiding this comment.
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.
… 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
force-pushed
the
fix-license-extractor-33741
branch
from
August 4, 2026 10:21
83d45af to
11c556d
Compare
clydin
approved these changes
Aug 4, 2026
Collaborator
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When extracting third-party license files in
license-extractor, replace the hardcoded list of uppercase filenames with a directory scan usingreaddir(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.jsonto reduce redundant disk I/O, and fix an off-by-one truncation bug when handling custom "SEE LICENSE IN " packages.Closes #33741