Closed x80486 closed 1 week ago
You might be happy to hear that this has been cleaned up a bit with the upcoming Fresh 2 release. The code has already landed in the main
branch and can be checked out. We got rid of the config file all together and moved everything dev related into dev.ts
and anything else into main.ts
.
Looking forward Fresh 2.0 release! :ok_hand:
Description
Currently, when Fresh project is generated, a
dev.ts
andmain.ts
files are created — along with some related tasks. These files are intuitive enough to figure it out what's their role within the project.The
dev.ts
file looks very much like something users shouldn't have to deal with directly because it reflects a way to run the application. I think this approach could be streamlined because Fresh already has a configuration file. Basically, Fresh could be able to hide all this and have a single entrypoint by introducing the notion of running modes (or something similar), driven by the configuration file and some flag specified in a task when the application is run.This could lead to a more declarative configuration, where things like
dotenv
(usually only used for local development) and things like that are meant to be used only, let's say indev
mode, and some others won't be used inprod
ortest
mode — just throwing ideas.I'm not sure how complex this could be, or if it aligns with how you would like Fresh to behave in general, but it certainly reduces boilerplate code (for users) and makes environment management more intuitive — twelve-factor app, etc.