Skip to content

Commit

Permalink
Monorepo support, yarn.lock support fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
dlvoy committed Nov 13, 2023
1 parent f5748c3 commit e1518bd
Show file tree
Hide file tree
Showing 5 changed files with 398 additions and 79 deletions.
29 changes: 29 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ Positionals:
Paths and files:
--folder Folder of NPM project. Defaults to current working
directory [string]
--monorepo-root Root folder of monorepo - if project is in monorepo[string]
--out-path HTML output path [string] [default: "./licenses.html"]
--tmp-folder-name Name of temporary folder
[string] [default: ".license-gen-tmp"]
Expand Down Expand Up @@ -65,6 +66,8 @@ Cache and optimization:
Options:
--version Show version number [boolean]
--help Show help [boolean]
--log-level Configures how verbose logs are, one of the following values:
error, warn, info, verbose, debug [string] [default: "warn"]
--error-missing Exit 1 if no license is present for a package
[boolean] [default: false]
```
Expand All @@ -79,15 +82,28 @@ for example; `--group` groups packages but `--no-group` disables grouping.
**Disabled** by default.
<br>
* `--log-level`
Decides how detailed log are. Allowed levels: `error`, `warn`, `info`, `verbose`, `debug`
`warn` by default
<br>
### Path related options:
* `--folder`
Specify root directory of project to parse, by default current directory
<br>
* `--monorepo-root`
Specify root directory of monorepo in case it is workspace based project, used to search for package, lock and license files.
<br>
* `--out-path`
Specify output path where generated file will be written.
File is always overwritten unless `--checksum-path` or `--checksum-embed` is used and no change is needed.
<br>
* `--tmp-folder-name`
Specify folder where to download tarballs. Folder need to be writable.
Folder and its contents gets deleted after generating file unless `--keep-cache` options is given.
Expand All @@ -98,17 +114,21 @@ for example; `--group` groups packages but `--no-group` disables grouping.
Groups packages which use exact same license texts, reducing duplicates and file size.
Enabled by default.
<br>
* `--external-links`, `--no-external-links`
Links package names (in license header) to their homepages (if and as configured in package.json `homepage`)
Enabled by default.
<br>
* `--add-index`, `--no-add-index`
Creates index at begin of file - list of anchors allowing quickly jumping to respective package library.
**Disabled** by default.
<br>
* `--title`
Overrides default document title / main header (which is root app package name) with given string.
<br>
* `--template`
Overrides default template path, allowing passing custom template.
<br>
Expand All @@ -118,14 +138,17 @@ for example; `--group` groups packages but `--no-group` disables grouping.
* `--registry`
Allows specifying URL of custom NPM repository, otherwise default global NPM repo is used
<br>
* `--ignored`
Semicolon-separated list of packages to ignore and NOT include in generated HTML.
For example: `typescript;eslint;tar`
<br>
* `--only-prod`, `--no-only-prod`
If enabled, ignores optional and development packages, using only "production" facing packages
**Disabled** by default.
<br>
* `--package-lock`, `--no-package-lock`
Instead of relying solely on `package.json` - also scan lock files to include all dependencies and sub-dependencies.
Generates bigger file but include also dependencies of dependencies, not only direct deps.
Expand All @@ -138,33 +161,39 @@ for example; `--group` groups packages but `--no-group` disables grouping.
If enabled, does not delete tmp folder, allowing cache to persist between runs
**Disabled** by default.
<br>
* `--checksum-path`
Allows skipping generation of HTM when packages have not changed.
If path is specified, special file indicated by path is used to store checksum.
If file exist and contains checksum matching checksum resolved for current package/version list - HTML generation **will be skipped**
After generating HTML file, checksum is written/updated int this file.
**NOTICE** - it does NOT checks for changes in license files, only if package list (and their version) are same.
<br>
* `--checksum-embed`, `--no-checksum-embed`
Allows skipping generation of HTM when packages have not changed.
If specified, embed checksum inside generated HTML (as an comment)
If existing HTML checksum matching checksum resolved for current package/version list - HTML generation **will be skipped**
**NOTICE** - it does NOT checks for changes in license files, only if package list (and their version) are same.
**Disabled** by default.
<br>
* `--avoid-registry`, `--no-avoid-registry`
By default, instead asking online NPM repo, uses `package.json` files found in `node_modules`.
It is way faster but may be inaccurate.
Enabled by default.
<br>
* `--no-spdx`
If enabled, does not use SPDX license repository as fallback for missing licenses
**Disabled** by default.
<br>
* `--no-spdx`
If enabled, use only SPDX license repository and do not use license files found in packages/tarballs
**Disabled** by default.
<br>
* `--only-local-tar`, `--no-only-local-tar`
By default, use only local filesystem and tarballs for license discovery.
`--no-only-local-tar` will enable downloading tarballs from resolved online URLs - but this may generate lot of internet traffic, especially when used together with `--package-lock` or without `--only-prod`
Expand Down
24 changes: 23 additions & 1 deletion docs/example_licenses.html
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
<body>
<h1 id="package-name">HTML License Gen - third party licenses</h1>
<div class="index">
<a href="#994d58bd46ac-pkg-994d58bd46ac" />cache-service-cache-module</a>, <a href="#e0b0b26662e8-pkg-e0b0b26662e8" />eslint</a>, <a href="#bca80c8ee4b8-pkg-bca80c8ee4b8" />eslint-config-prettier</a>, <a href="#f13b9e3f65fe-pkg-f13b9e3f65fe" />eslint-plugin-prettier</a>, <a href="#e372423e1a66-pkg-e372423e1a66" />mustache</a>, <a href="#9fd021d1231b-pkg-9fd021d1231b" />prettier</a>, <a href="#a57717bbf1d8-pkg-d02b921ed1c4" />rimraf</a>, <a href="#15a58f0a0fbf-pkg-15a58f0a0fbf" />spdx-expression-parse</a>, <a href="#64ec20d5fe5a-pkg-64ec20d5fe5a" />superagent</a>, <a href="#4592bf9c10e5-pkg-4592bf9c10e5" />superagent-cache-plugin</a>, <a href="#f25bcf5ee22e-pkg-f25bcf5ee22e" />synp</a>, <a href="#a57717bbf1d8-pkg-680254bad1d7" />tar</a> <a href="#680254bad1d7-pkg-680254bad1d7" />[2]</a>, <a href="#6a4551da4e2b-pkg-6cb5146d57c9" />@types&#x2F;mustache</a>, <a href="#6a4551da4e2b-pkg-dccb53dd6895" />@types&#x2F;node</a>, <a href="#6a4551da4e2b-pkg-4c2e9c85011f" />@types&#x2F;rimraf</a>, <a href="#6a4551da4e2b-pkg-2c5bc9e13f67" />@types&#x2F;superagent</a>, <a href="#6a4551da4e2b-pkg-7d76be544028" />@types&#x2F;tar</a>, <a href="#6a4551da4e2b-pkg-91199c9def7c" />@types&#x2F;yargs</a>, <a href="#fb9da861bdb8-pkg-fb9da861bdb8" />typescript</a>, <a href="#65c77547efb2-pkg-65c77547efb2" />@typescript-eslint&#x2F;eslint-plugin</a>, <a href="#7fd2b94c7a02-pkg-7fd2b94c7a02" />@typescript-eslint&#x2F;parser</a>, <a href="#988f2857f8c3-pkg-988f2857f8c3" />yargs</a>
<a href="#994d58bd46ac-pkg-994d58bd46ac" />cache-service-cache-module</a>, <a href="#e0b0b26662e8-pkg-e0b0b26662e8" />eslint</a>, <a href="#bca80c8ee4b8-pkg-bca80c8ee4b8" />eslint-config-prettier</a>, <a href="#f13b9e3f65fe-pkg-f13b9e3f65fe" />eslint-plugin-prettier</a>, <a href="#e372423e1a66-pkg-e372423e1a66" />mustache</a>, <a href="#9fd021d1231b-pkg-9fd021d1231b" />prettier</a>, <a href="#a57717bbf1d8-pkg-d02b921ed1c4" />rimraf</a>, <a href="#15a58f0a0fbf-pkg-15a58f0a0fbf" />spdx-expression-parse</a>, <a href="#64ec20d5fe5a-pkg-64ec20d5fe5a" />superagent</a>, <a href="#4592bf9c10e5-pkg-4592bf9c10e5" />superagent-cache-plugin</a>, <a href="#f25bcf5ee22e-pkg-f25bcf5ee22e" />synp</a>, <a href="#a57717bbf1d8-pkg-680254bad1d7" />tar</a> <a href="#680254bad1d7-pkg-680254bad1d7" />[2]</a>, <a href="#6a4551da4e2b-pkg-6cb5146d57c9" />@types&#x2F;mustache</a>, <a href="#6a4551da4e2b-pkg-dccb53dd6895" />@types&#x2F;node</a>, <a href="#6a4551da4e2b-pkg-4c2e9c85011f" />@types&#x2F;rimraf</a>, <a href="#6a4551da4e2b-pkg-2c5bc9e13f67" />@types&#x2F;superagent</a>, <a href="#6a4551da4e2b-pkg-7d76be544028" />@types&#x2F;tar</a>, <a href="#6a4551da4e2b-pkg-91199c9def7c" />@types&#x2F;yargs</a>, <a href="#fb9da861bdb8-pkg-fb9da861bdb8" />typescript</a>, <a href="#65c77547efb2-pkg-65c77547efb2" />@typescript-eslint&#x2F;eslint-plugin</a>, <a href="#7fd2b94c7a02-pkg-7fd2b94c7a02" />@typescript-eslint&#x2F;parser</a>, <a href="#e2f3e36ea43b-pkg-e2f3e36ea43b" />winston</a>, <a href="#988f2857f8c3-pkg-988f2857f8c3" />yargs</a>
</div>
<div class="licenses">
<h3>
Expand Down Expand Up @@ -6395,6 +6395,28 @@ <h3>
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.</blockquote>
<h3>
<a name="e2f3e36ea43b-pkg-e2f3e36ea43b"></a>winston
</h3>
<blockquote>Copyright (c) 2010 Charlie Robbins

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the &quot;Software&quot;), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and&#x2F;or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.</blockquote>
<h3>
<a name="988f2857f8c3-pkg-988f2857f8c3"></a><a href="https://yargs.js.org/">yargs</a>
</h3>
Expand Down
Loading

0 comments on commit e1518bd

Please sign in to comment.