You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
| --start | Path of the initial json to look for | false | string |`process.cwd()`|
77
-
| --failOn | Fail (exit with code 1) if any package license does not satisfies any license in the provided list | true | string[]||
78
-
| --outputFileName | Name of the report file generated | false | string |`license-report-<timestamp>.md`|
79
-
| --errorReportFileName | Name of the error report file generated when a license in the `failOn` option is found | false | string |`license-error-<timestamp>.md`|
80
-
| --disableErrorReport | Flag to disable the error report file generation | false | boolean |`false`|
81
-
| --disableReport | Flag to disable the report file generation, whether there is an error or not | false | boolean |`false`|
82
-
| --customHeader | Name of a text file containing the custom header to add at the start of the generated report | false | string | This application makes use of the following open source packages: |
| --start | Path of the initial json to look for | false | string |`process.cwd()`|
77
+
| --failOn | Fail (exit with code 1) if at least one package license **satisfies** one of the licenses in the provided list | true | string[]||
78
+
| --allowOnly | Fail (exit with code 1) if at least one package license **does not satisfy** one of the licenses in the provided list | true | string[]||
79
+
| --outputFileName | Name of the report file generated | false | string |`license-report-<timestamp>.md`|
80
+
| --errorReportFileName | Name of the error report file generated when a license in the `failOn` option is found | false | string |`license-error-<timestamp>.md`|
81
+
| --disableErrorReport | Flag to disable the error report file generation | false | boolean |`false`|
82
+
| --disableReport | Flag to disable the report file generation, whether there is an error or not | false | boolean |`false`|
83
+
| --customHeader | Name of a text file containing the custom header to add at the start of the generated report | false | string | This application makes use of the following open source packages: |
84
+
85
+
86
+
> ❗The options `--failOn` and `--allowOnly` are mutually exclusive. You must use one of them.
83
87
84
88
## 🧑💻 <aname="examples"></a>Examples
85
89
@@ -95,7 +99,7 @@ If the value provided is not SPDX compliant, the process fails (exit error 1).
95
99
96
100
### scan command
97
101
98
-
All the values provided in the `failOn` list must be [SPDX](https://spdx.dev/specifications/) compliant. Otherwise, an error will be thrown (exit error 1).
102
+
All the values provided in the `failOn`or `allowOnly`list must be [SPDX](https://spdx.dev/specifications/) compliant. Otherwise, an error will be thrown (exit error 1).
99
103
Check the [SPDX license list](https://spdx.org/licenses/).
100
104
101
105
```sh
@@ -105,14 +109,30 @@ npx @onebeyond/license-checker scan --failOn MIT GPL-1.0+
105
109
The input list is transformed into a SPDX expression with the `OR` logical operator. In the example, that is `MIT OR GPL-1.0+`.
106
110
If any of the packages' licenses satisfies that expression, the process fails (exit error 1).
107
111
112
+
SPDX compliance and `OR` input concatenation also apply for the `allowOnly` option:
113
+
114
+
```sh
115
+
npx @onebeyond/license-checker scan --allowOnly MIT GPL-1.0+
116
+
```
117
+
118
+
In this case, all the packages' licenses must be either `MIT` or `GPL-1.0+`.
119
+
120
+
Arguments to `failOn` and `allowOnly` are not limited to one license. Expressions with logical operators are also accepted:
121
+
122
+
```sh
123
+
npx @onebeyond/license-checker scan --allowOnly "MIT AND Apache-2.0" GPL-1.0+
124
+
```
125
+
126
+
In this example, all the packages' licenses must be either `MIT AND Apache-2.0`**or**`GPL-1.0+`.
127
+
108
128
## 🔗 Useful links
109
129
110
130
-[Licensing a repository](https://docs.github.com/en/github/creating-cloning-and-archiving-repositories/licensing-a-repository)
111
131
-[Choose a license](https://choosealicense.com/appendix/)
112
132
113
133
## ⚠️ Temporal issue
114
134
115
-
An issue in `spdx-satisfies` has been found and it's pending resolution. Until then, GFDL 1x licenses are not supported and an error will be thrown if either packages or failOn arguments contain it.
135
+
An issue in `spdx-satisfies` has been found, and it's pending resolution. Until then, GFDL 1x licenses are not supported and an error will be thrown if either packages or failOn arguments contain it.
logger.warn(`The following package licenses are not SPDX compliant and cannot be validated:\n${invalidPackages.map(pkg=>` > ${pkg.package} | ${pkg.licenses}`).join('\n')}`);
constvalidSpdxIds=expression&&spdxIds.filter(id=>!isLicenseError(id)&&!satisfiesSPDXLicense(id,expression));// @TODO Refactor after issue has been solved
0 commit comments