How to add the project license to the build with and Angular CLI project for xRay license scanning

667 Views Asked by At

Our project has a custom license written into license attribute in package.json.

When we ng build the project we can see a 3rdpartylicenses.txt generated into dist folder with all the dependencies licenses included.

Our custom license is not present.

As far as I know xRay scans package.json into the build archive or check license.txt file against a license database ( https://jfrog.com/knowledge-base/how-xray-detects-package-licenses ).

How can we add our license into the build ?

Any ideas ?

UPDATE After some explorations :

One solution would be to use simply npm publish to pack the dist folder into a tar archive and the package.json, license.txt and even README.md would be inside the archive.

Is it a good solution ? ( my problem is the docker deployment that uses actually tha application archive with the generated content at that root of the archive, so we would have to change the deployment scripts )

1

There are 1 best solutions below

0
Jose Alejandro Concepcin Alvar On

If you are making an npm package it is simply adding the list of files you want to add during the build phase. Go to the ng-package.json file inside the project and add an "assets" entry and pass it the list of files.

{
  "$schema": "../../node_modules/ng-packagr/ng-package.schema.json",
  "dest": "../../dist/ngp-material-rating",
  "lib": {
     "entryFile": "src/public-api.ts"
  },
 "assets": [ "./LICENSE.md", "./README.md" ]
}

In this example I have added the files LICENCE.md and Readme.Md