Dropsource / monarch

Monarch is a tool for building Flutter widgets in isolation. It makes it easy to build, test and debug complex UIs.
https://monarchapp.io
MIT License
437 stars 22 forks source link

build_runner should allow running with additional flags #4

Closed danilofuchs closed 3 years ago

danilofuchs commented 3 years ago

We always run build_runner with --delete-conflicting-outputs so all of code generation is fresh, every time.

Starting Monarch

Preparing stories...
3.1sec elapsed, 0/2 tasks completed

[SEVERE] Conflicting outputs were detected and the build is unable to prompt for permission to remove them. These outputs must be removed manually or the build can be run with `--delete-conflicting-outputs`. The outputs are: lib/[path-to-freezed-class]

Preparing stories (code generation) failed. Exiting.
Re-run with the --verbose flag to get more information
danilofuchs commented 3 years ago

I was able to run monarch run after running build_runner manually

fertrig commented 3 years ago

I see what you are saying. I looked into the flags we could pass to build_runner and the only one that makes sense in the monarch context is --delete-conflicting-outputs.

A simple solution would be to let users pass that flag directly to the monarch CLI. Something like:

monarch run --delete-conflicting-outputs
fertrig commented 3 years ago

Done. Please run monarch upgrade. Then you can run monarch run --delete-conflicting-outputs.

Let me know how it goes.

romanr commented 1 year ago

monarch run --delete-conflicting-outputs - This is the only way monarch works for me. Instead of passing it all the time maybe parameter should be baked in by default?

Otherwise I get this error and can't run:

Enabling Flutter for desktop

Starting Monarch.

Preparing stories...
[WARNING] Invalidated precompiled build script due to missing asset graph.

[SEVERE] Conflicting outputs were detected and the build is unable to prompt for permission to remove them. These outputs must be removed manually or the build can be run with `--delete-conflicting-outputs`. The outputs are: lib/src/exceptions/app_exception.freezed.dart

pub finished with exit code 78

3.1sec elapsed, 0/2 tasks completed
Preparing stories (code generation) failed. Exiting.
Re-run with the --verbose flag to get more information
Process did not finish successfully, exit code 78
fertrig commented 1 year ago

@romanr This error seems to be related to using both freezed and monarch. However, I was not able to reproduce it. I set up a test project with both freezed and monarch. I made various changes and it didn't require me to use the --delete-conflicting-outputs. Everything worked as expected without the flag.

Do you have steps I could use to reproduce the error you are getting?

For some reason, build_runner is not able to detect previous changes were made by freezed or monarch and it wants you to pass the --delete-conflicting-outputs flag.