Open alfonsogarciacaro opened 3 years ago
Hi @alfonsogarciacaro, just realized I haven't answered this in a while 😅 what you say makes sense, what do you think about a new argument ci
which validates missing packages? i.e.
femto ci
which is basically just femto
but returns exit code 0 when everything is fine
I forgot about this too! If you prefer to not make this the default and have it under a flag (still think it'd be nice if Femto exit code followed the usual convention: 0 success, >= 1 some problem), I would rather pick something with more obvious semantics like --strict
.
Please note the issue is about the exit code, not about throwing an error. If I'm not mistaken, the result code will have no effect if femto is executed directly in the terminal, only when it's called by a script (and only when the script decides to check the exit code).
Currently if I run
dotnet femto src
and I'm missing some npm packages, Femto considers the validation to be successful if there are noUnableToResolve
actions: https://github.com/Zaid-Ajaj/Femto/blob/903553993f9210c0af89f7279b515a7d16ef0c82/src/Program.fs#L869-L878It'd be nice to have a non-zero exit code in this case. Let's say I have a repo with multiple Fable apps and different developers working on each. Each app has its own package.json and I want to be sure all developers are installing the correct npm dependencies when they add a Nuget Fable package so I add
dotnet femto
to the CI to check all the apps. But Femto will only display the resolution actions and won't make the build script fail. It's true that devs should usedotnet femto install
for new packages and that we should notice missing npm dependencies by manually checking the app or with (ehem) tests, but by running Femto in CI I can make sure that the right versions of the npm packages are installed.Besides that,
FemtoResult
enumeration containst non-zero codes for "successful" outcomes, like PackageInstalled. Again, (un)install commands will probably be run in a terminal and not in a script, but who knows: https://github.com/Zaid-Ajaj/Femto/blob/903553993f9210c0af89f7279b515a7d16ef0c82/src/Prelude.fs#L3-L19