Skip to content

blendthink/pubspec-builder

Repository files navigation

Pub Version Dart SDK Version Pub popularity

pubspec_builder

A builder for extracting the contents of pubspec.yaml into code.

Usage

  1. Add this package to your dev_dependencies in pubspec.yaml:

    dependencies:
      pubspec_parse: ^1.2.0
    
    dev_dependencies:
      build_runner: ^2.1.11
      pubspec_builder: any
  2. Run a build:

    dart pub run build_runner build
  3. lib/gen/pubspec.dart will be generated with content:

    // GENERATED CODE - DO NOT MODIFY BY HAND
    
    import 'package:pubspec_parse/pubspec_parse.dart';
    
    final pubspec = Pubspec.parse("""...""");

Optional

To change the path of the generated file, create a build.yaml in the root of your package. By changing the output option of this builder, the path can be customized:

targets:
  $default:
    builders:
      pubspec_builder:
        options:
          output: 'lib/custom/path/to/pubspec.dart'

See also

About

A builder for extracting the contents of pubspec.yaml into code.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages