extrude-licenses

This is a extruder(≈ a formatter with a user template) for licenses of a Rust and Node.js project.

Usage

  1. Install, cargo install extrude-licenses.
  2. Generate licenses JSON file, a source licenses JSON file, Generate license list JSON file with [cargo-license][] or [license-checker][] -> licenses.json.
  3. Make a template file for extruding.
  4. Run, extrude-licenses -t template.xxx -i licenses.json and the other options.

Command-line arguments

Note: --match-name-invert and --match-license-invert are workround of (?!not-included-pattern). Because, regex is not supported it in Rust for now.

Example results

Note: To use cargo run -- -t ... -i ... if you want to try to run in this project repos instead of installing.

  1. A simple CSV like template (A body only): extrude-licenses -t examples/template-1.csv -i examples/result-of-license-checker

csv anymatch,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

  1. Name filtering: extrude-licenses -t examples/template-1.csv -i examples/result-of-license-checker --match-name diff

csv arr-diff,4.0.0,MIT,Jon Schlinkert arr-diff,2.0.0,MIT,Jon Schlinkert

  1. License filtering: extrude-licenses -t examples/template-1.csv -i examples/result-of-cargo-license.json --match-license BSL

csv ryu,1.0.5,Apache-2.0 OR BSL-1.0,David Tolnay <dtolnay@gmail.com>

  1. A markdown table template (Header=2-line2 + Body): extrude-licenses -t examples/template-2.md -h 2 -i examples/result-of-cargo-license.json --match-name serde

md | 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> |

  1. A html table template (Header=7lines + Body + Footer=2lines): extrude-licenses -t examples/template-3.html -h 7 -f 2 -i examples/result-of-cargo-license.json --match-name serde

```html

Package License Authors
serde 1.0.116 Apache-2.0 OR MIT Erick Tryzelaar |David Tolnay
serde_derive 1.0.116 Apache-2.0 OR MIT Erick Tryzelaar |David Tolnay
serde_json 1.0.58 Apache-2.0 OR MIT Erick Tryzelaar |David Tolnay

```

And more...

For more example, .tsx (React/typescript) template:

typescript 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:

License

Author