https://github.com/simolus3/build_license_collector
Collects licenses for your Dart project, through build_runner
https://github.com/simolus3/build_license_collector
Last synced: about 1 year ago
JSON representation
Collects licenses for your Dart project, through build_runner
- Host: GitHub
- URL: https://github.com/simolus3/build_license_collector
- Owner: simolus3
- License: mit
- Created: 2020-10-03T19:34:20.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2020-10-03T19:43:54.000Z (over 5 years ago)
- Last Synced: 2025-01-25T07:07:11.625Z (over 1 year ago)
- Language: Dart
- Size: 9.77 KB
- Stars: 1
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
A [builder](https://pub.dev/packages/build) collecting license information from your dependencies.
## Usage
Thanks to [Dart's build system](https://pub.dev/packages/build_runner), using this package couldn't be
any simpler. Just add this package and `build_runner` to your `dev_dependencies` and you're good to go:
```yaml
dev_dependencies:
build_license_collector: ^1.0.0
build_runner: ^2.4.0
```
After running `dart pub run build_runner build`, you'll have a `licenses.g.dart` file in your app's
`lib/` directory.
## Configuration
By default, license collection will happen across your regular `dependencies` since that's the code
you usually ship to users. If you want to, you can also include licenses of `dev_dependencies`.
To configure this builder, create a `build.yaml` next to your pubspec. It should have the following
content:
```yaml
targets:
$default:
builders:
build_license_collector:
include_dev_dependencies: true
```
You can also change the path of the generated file:
```yaml
targets:
$default:
builders:
build_license_collector:
output: lib/src/licenses.g.dart
```
This package can also emit a JSON structure when the output extension is `.json`.
The generated structure looks like this, with the entries in `packages` pointing
to a text index in `texts`.
```json
{
"texts": [
"license for pgk foo and pkg baz",
"license for bar",
],
"packages": {
"foo": 0,
"bar": 1,
"baz": 0,
}
}
```