Command
build
Is this a regression?
The previous version in which this bug was not present was
No response
Description
Current license-extractor.ts is missing the npm packages license files that needs to be extracted.
const LICENSE_FILES = ['LICENSE', 'LICENSE.txt', 'LICENSE.md'];
....
// Search for a license file within the root of the package
for (const potentialLicense of LICENSE_FILES) {
const packageLicensePath = path.join(packageDirectory, potentialLicense);
try {
licenseText = await readFile(packageLicensePath, 'utf-8');
break;
} catch {}
}
This code doesn't match files in different lower/upper case when builds are run on a Linux system where the file system is case sensitive.
Example of packages:
https://www.npmjs.com/package/globals?activeTab=code -> license
https://www.npmjs.com/package/screenfull?activeTab=code -> license
Also there are license files that are not named as expected in the code
Example of packages:
https://www.npmjs.com/package/idb-keyval?activeTab=code -> LICENCE
https://www.npmjs.com/package/estraverse?activeTab=code -> LICENSE.BSD
https://www.npmjs.com/package/stackblur-canvas?activeTab=code -> LICENSE-MIT.txt
https://www.npmjs.com/package/leaflet.markercluster?activeTab=code -> MIT-LICENCE.txt
Fun fact:
British English:
Licence is used as a noun.
License is used a verb.
Previous license-webpack-plugin used was using a regex to find the license file /^licen[cs]e/i.test(path)
I suggest to use a similar principle to loop over files in root project dir and check with a regex like /licen[cs]e/i.test(path)
Minimal Reproduction
- On a Linux env clone repo https://github.com/tiberiuzuld/repo-app-license.git
- run npm ci && ng build
- Observe
dist/repro-app/3rdpartylicenses.txt missing license text for the packages mentioned above
Exception or Error
Your Environment
_ _ ____ _ ___
/ \ _ __ __ _ _ _| | __ _ _ __ / ___| | |_ _|
/ △ \ | '_ \ / _` | | | | |/ _` | '__| | | | | | |
/ ___ \| | | | (_| | |_| | | (_| | | | |___| |___ | |
/_/ \_\_| |_|\__, |\__,_|_|\__,_|_| \____|_____|___|
|___/
Angular CLI : 22.1.2
Angular : 22.1.0
Node.js : 24.18.1
Package Manager : npm 12.0.2
Operating System : linux x64
┌───────────────────────────┬───────────────────┬───────────────────┐
│ Package │ Installed Version │ Requested Version │
├───────────────────────────┼───────────────────┼───────────────────┤
│ @angular/build │ 22.1.2 │ ^22.1.2 │
│ @angular/cli │ 22.1.2 │ ^22.1.2 │
│ @angular/common │ 22.1.0 │ ^22.1.0 │
│ @angular/compiler │ 22.1.0 │ ^22.1.0 │
│ @angular/compiler-cli │ 22.1.0 │ ^22.1.0 │
│ @angular/core │ 22.1.0 │ ^22.1.0 │
│ @angular/forms │ 22.1.0 │ ^22.1.0 │
│ @angular/platform-browser │ 22.1.0 │ ^22.1.0 │
│ @angular/router │ 22.1.0 │ ^22.1.0 │
│ rxjs │ 7.8.2 │ ~7.8.0 │
│ typescript │ 6.0.3 │ ~6.0.2 │
│ vitest │ 4.1.10 │ ^4.0.8 │
└───────────────────────────┴───────────────────┴───────────────────┘
Anything else relevant?
No response
Command
build
Is this a regression?
The previous version in which this bug was not present was
No response
Description
Current license-extractor.ts is missing the npm packages license files that needs to be extracted.
This code doesn't match files in different lower/upper case when builds are run on a Linux system where the file system is case sensitive.
Example of packages:
https://www.npmjs.com/package/globals?activeTab=code -> license
https://www.npmjs.com/package/screenfull?activeTab=code -> license
Also there are license files that are not named as expected in the code
Example of packages:
https://www.npmjs.com/package/idb-keyval?activeTab=code -> LICENCE
https://www.npmjs.com/package/estraverse?activeTab=code -> LICENSE.BSD
https://www.npmjs.com/package/stackblur-canvas?activeTab=code -> LICENSE-MIT.txt
https://www.npmjs.com/package/leaflet.markercluster?activeTab=code -> MIT-LICENCE.txt
Fun fact:
Previous license-webpack-plugin used was using a regex to find the license file
/^licen[cs]e/i.test(path)I suggest to use a similar principle to loop over files in root project dir and check with a regex like
/licen[cs]e/i.test(path)Minimal Reproduction
dist/repro-app/3rdpartylicenses.txtmissing license text for the packages mentioned aboveException or Error
Your Environment
Anything else relevant?
No response