17 releases

0.0.21 May 23, 2023
0.0.20 Mar 30, 2023
0.0.18 Jan 3, 2023
0.0.16 Dec 29, 2022
0.0.2 Dec 29, 2021

#1654 in Development tools

Download history 6/week @ 2023-11-20 8/week @ 2023-11-27 10/week @ 2023-12-04 12/week @ 2023-12-11 13/week @ 2023-12-18 10/week @ 2023-12-25 7/week @ 2024-02-12 9/week @ 2024-02-19 36/week @ 2024-02-26 15/week @ 2024-03-04

67 downloads per month
Used in 4 crates

MIT license

24KB
317 lines

Licensebat Core

Core types and traits for licensebat-cli. Check the docs for more information.

license crates.io docs.rs


lib.rs:

Core types and traits for licensebat-cli.

Libraries authors that want to provide Collector implementations should use this crate.

Collector is the central trait of this crate and its implementations will be responsible for retrieving information about the dependencies in form of a `RetrievedDependency.

Note that the Collector trait is really simple and this is mainly because this trait is intended to serve as the base for more complex traits.

In our case, this crate exposes the FileCollector trait which will use dependency manifest files (such as package-lock.json, yarn.lock, Cargo.lock or pubspec.yaml) to extract information about the different dependencies (see Dependency) and return a stream of RetrievedDependency or RetrievedDependencyStreamResult.

For the moment, FileCollector is the only used trait in all language implementations but this can easily change. For instance, for the Rust language, it would be nice to use cargo-metadata instead of having to parse the Cargo.lock file. That would make it cheaper to get information about some dependencies as we wouldn't need to use any APIs to fetch license information.

Anyway, having those two different approaches would be still valuable because there are scenarios where we don't have access to all the codebase. When using the CLI, through licensebat-cli, it makes sense to avoid making http requests at all cost, but this is not possible in Licensebat's GitHub Service as we don't have access to all the codebase but only a few files.

Features

  • licrc-from-file: Allows to retrieve license information from a file by enabling a LicRc::from_relative_path associated function.

Dependencies

~7.5MB
~172K SLoC