dart_environment_config
dart_environment_config copied to clipboard
Use builders to run the generator instead of just as a script.
I have many builders that I often have to run to generate files for me. Usually all I have to do is run dart pub run build_runner build to generate the files, but then I have to go back and run dart pub run environment_config:generate for this one to work.
With this PR, all you need to do it configure your arguments in the build.yaml (see example/build.yaml) file, and when you run:
flutter pub run build_runner build
dart will run this generator along with other generators you defined in the build.yaml file.
Hello) thank you for this PR, overall I like this idea, but I'm not sure that it should work with build runner only. It may work for dev environment, but not for CI/CD
So instead of forcing developer to use builder, I would keep original manual command run and add entry for buld_runner with some docs and examples, since build runner may not fit to some developers needs in some CI/CD tools
Hello) thank you for this PR, overall I like this idea, but I'm not sure that it should work with build runner only. It may work for dev environment, but not for CI/CD
@TatsuUkraine
That's cool. To fix that is easy, we just need to once again extract the function and make it standalone, and then call it from the builder. I will update the PR ASAP.
I think it already was extracted. Probably best way will be keep original lib/generator.dart, and create a new dart file with configuration for the build runner
In that way function from lib/generator.dart can be used and in manual runner from bin folder, and in build runner config entry
@TatsuUkraine how is that?