flutter_oss_licenses 0.6.3
flutter_oss_licenses: ^0.6.3 copied to clipboard
A tool for generating OSS license list using pubspec.lock.
Introduction #
flutter_oss_licenses is a tool for generating OSS license list using pubspec.lock
.
Please note that version 0.6.0 breaks compatibility with older version to get more information about packages.
Installing #
Adding the package name to dev_dependencies
; not to dependencies
because the package does nothing on runtime.
dev_dependencies:
flutter_oss_licenses: ^0.6.3
Generate oss_licenses.dart #
Before executing the command, you must update your pubspec.lock
using pub get
(or pub upgrade
if you want).
$ flutter pub get
And then, the following command generates oss_licenses.dart
on the project's lib/
directory:
$ flutter pub run flutter_oss_licenses:generate.dart
The file structure #
The generated file contains a simple Map<String, dynamic>
that maps each project name to its corresponding license text, that is normally provided by LICENSE
file on the project:
/// This code was generated by flutter_oss_licenses
/// https://pub.dev/packages/flutter_oss_licenses
final ossLicenses = <String, dynamic>{
"hello_world_dummy": {
"name": "hello_world_dummy",
"description": "Sample hello world dummy description.",
"homepage": "https://github.com/espresso3389",
"authors": ["Takashi Kawasaki <espresso3389@gmail.com>"],
"version": "1.0.0",
"license": "## Hello, world\nDummy copyright here!",
"isMarkdown": true,
"isSdk": false,
"isDirectDependency": false
},
...
}
And, you can use the map on your project code in your way. The package does not do anything on the list.
Command line options #
Either running generate.dart
using pub run
or directly, it accepts two or less options.
The first option is output dart file name. The default is lib/oss_licenses.dart
.
And the another is project root, which is by default detected automatically.
$ generate.dart [OUTPUT_FILENAME [PROJECT_ROOT]]
The bin/generated.dart
uses two environment variables; one is FLUTTER_ROOT
and PUB_CACHE
. They are normally set by flutter pub run
but if you directly execute the script, you must set them manually.
Reporting issues #
Report any bugs on the project's issues.