19 releases
0.23.0 | Dec 6, 2024 |
---|---|
0.22.0 | May 31, 2024 |
0.0.21 | May 23, 2023 |
0.0.20 | Mar 30, 2023 |
0.0.2 | Dec 29, 2021 |
#2359 in Development tools
255 downloads per month
Used in 4 crates
24KB
317 lines
Licensebat Core
Core types and traits for licensebat-cli. Check the docs for more information.
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
~6–8MB
~145K SLoC