| Crates.io | extrude-licenses |
| lib.rs | extrude-licenses |
| version | 1.0.0 |
| created_at | 2020-10-02 08:52:50.542721+00 |
| updated_at | 2020-10-02 08:52:50.542721+00 |
| description | This is a extruder(≈ a formatter with a user template) for licenses of a Rust and Node.js project. |
| homepage | |
| repository | https://github.com/usagi/extrude-licenses |
| max_upload_size | |
| id | 295285 |
| size | 36,940 |
This is a extruder(≈ a formatter with a user template) for licenses of a Rust and Node.js project.
extrude-licensescargo-license command if you want generate from Cargo.toml source.license-checker command if you want generate from package.json source.cargo install extrude-licenses.cargo-license or license-checker -> licenses.json.
cargo install cargo-license -> cargo-license -j > licenses.jsonnpx license-checker --json --relativeLicensePath --summay -out licenses.jsonextrude-licenses -t template.xxx -i licenses.json and the other options.
-t, --template-file: A template file. (must)-i, --input-file: An input source JSON file. (must)-t, --template-file: A template file.-i, --input-file: An input source JSON file.-o, --output-file: Output to the specific file. (The default output is STDOUT.)-h, --header-lines: A number of the header lines in the template file. (The default is 0.)-f, --footer-lines: A number of the footer lines in the template file. (The default is 0.)--match-name: A regex pattern fintering for a name. (The default will match to any patterns.)--match-license: A regex pattern fintering for a license. (The default will match to any patterns.)--escape-authors: if set => It's Me <its_me@example.com> -> It's Me <email@example.com>. (The default is not set.)--match-name-invert: If set => Invert a --match-name result. (The default is not set.)--match-licsense-invert: If set => Invert a --match-license result. (The default is not set.)Note: --match-name-invert and --match-license-invert are workround of (?!not-included-pattern). Because, regex is not supported it in Rust for now.
Note: To use cargo run -- -t ... -i ... if you want to try to run in this project repos instead of installing.
extrude-licenses -t examples/template-1.csv -i examples/result-of-license-checkeranymatch,1.3.2,ISC,Elan Shanker
arr-diff,2.0.0,MIT,Jon Schlinkert
arr-diff,4.0.0,MIT,Jon Schlinkert
arr-flatten,1.1.0,MIT,Jon Schlinkert
arr-union,3.1.0,MIT,Jon Schlinkert
extrude-licenses -t examples/template-1.csv -i examples/result-of-license-checker --match-name diffarr-diff,4.0.0,MIT,Jon Schlinkert
arr-diff,2.0.0,MIT,Jon Schlinkert
extrude-licenses -t examples/template-1.csv -i examples/result-of-cargo-license.json --match-license BSLryu,1.0.5,Apache-2.0 OR BSL-1.0,David Tolnay <dtolnay@gmail.com>
extrude-licenses -t examples/template-2.md -h 2 -i examples/result-of-cargo-license.json --match-name serde| Package | Version | License | Authors |
| ------------ | ------- | ----------------- | ------------------------------------------- |
| serde | 1.0.116 | Apache-2.0 OR MIT | Erick Tryzelaar <erick.tryzelaar@gmail.com> | David Tolnay <dtolnay@gmail.com> |
| serde_derive | 1.0.116 | Apache-2.0 OR MIT | Erick Tryzelaar <erick.tryzelaar@gmail.com> | David Tolnay <dtolnay@gmail.com> |
| serde_json | 1.0.58 | Apache-2.0 OR MIT | Erick Tryzelaar <erick.tryzelaar@gmail.com> | David Tolnay <dtolnay@gmail.com> |
extrude-licenses -t examples/template-3.html -h 7 -f 2 -i examples/result-of-cargo-license.json --match-name serde<table>
<tbody>
<tr>
<th>Package</th>
<th>License</th>
<th>Authors</th>
</tr>
<tr>
<a href="https://crates.io/crates/serde"><td>serde 1.0.116</td></a>
<td>Apache-2.0 OR MIT</td>
<td>Erick Tryzelaar <erick.tryzelaar@gmail.com>|David Tolnay <dtolnay@gmail.com></td>
</tr>
<tr>
<a href="https://crates.io/crates/serde_derive"><td>serde_derive 1.0.116</td></a>
<td>Apache-2.0 OR MIT</td>
<td>Erick Tryzelaar <erick.tryzelaar@gmail.com>|David Tolnay <dtolnay@gmail.com></td>
</tr>
<tr>
<a href="https://crates.io/crates/serde_json"><td>serde_json 1.0.58</td></a>
<td>Apache-2.0 OR MIT</td>
<td>Erick Tryzelaar <erick.tryzelaar@gmail.com>|David Tolnay <dtolnay@gmail.com></td>
</tr>
</tbody>
</table>
For more example, .tsx (React/typescript) template:
import React, { Component } from "react";
export default class LicensesNode extends Component { render = () => (<ul>
<a href="https://crates.io/crates/{name}"><li>{name} {version} ({license}) -- {authors}</li></a>
</ul>)};
and you can use any text patterns for a template file. The supported template patterns are:
{name}{version}{authors}{repository}{license}{license_file}{description}