FlutterGen / flutter_gen

The Flutter code generator for your assets, fonts, colors, … — Get rid of all String-based APIs.
https://pub.dev/packages/flutter_gen
MIT License
1.43k stars 142 forks source link

[BUG] build.yaml configuration instead of pubspec.yaml #114

Open zs-dima opened 2 years ago

zs-dima commented 2 years ago

build.yaml intended for generators configuration. So could be nice to use build.yaml configuration instead of pubspec.yaml configuration.

Bad

pubspec.yaml

⭕️ Good

build.yaml
lcdsmao commented 2 years ago

You can specify the yaml file via:

fluttergen -c path/to/your/yaml/flie.yaml
zs-dima commented 2 years ago

@lcdsmao here build_runner documentation

Builders are configured with a build.yaml

https://pub.dev/packages/build_runner

lcdsmao commented 2 years ago

@zs-dima What's your use case here? Can you give some examples?

zs-dima commented 2 years ago

@lcdsmao I mean default way to configure builders libraries.

Here your documentation:

Configuration file

[FlutterGen] generates dart files based on the key flutter and flutter_gen of pubspec.yaml.
Default configuration can be found here.

# pubspec.yaml
# ...

flutter_gen:

but it have to be:

Configuration file

[FlutterGen] generates dart files based on the key flutter_gen of build.yaml.
Default configuration can be found here.

# build.yaml
# ...
    builders:
# ...
      flutter_gen:
# ...
noga-dev commented 1 year ago

@zs-dima What's your use case here? Can you give some examples?

I'm guessing to be able to aggregate all codegen builders in the same command via: flutter pub run build_runner watch --delete-conflicting-outputs rather than individually running flutter packages pub run build_runner build or fluttergen and other packages. Since in build.yaml you can specify the commands for each builder like:

targets:
  $default:
    builders:
      slang_build_runner:
        options:
      flutter_gen:
        options:
      etc....
zs-dima commented 1 year ago

@zs-dima What's your use case here? Can you give some examples?

I'm guessing to be able to aggregate all codegen builders in the same command via: flutter pub run build_runner watch --delete-conflicting-outputs rather than individually running flutter packages pub run build_runner build or fluttergen and other packages. Since in build.yaml you can specify the commands for each builder like:

targets:
  $default:
    builders:
      slang_build_runner:
        options:
      flutter_gen:
        options:
      etc....

To move builders configurations out of the pubspec.yaml

mrverdant13 commented 1 year ago

Any plans to support this setup approach?