AngelMunoz / Finny

A cross-platform tool for unbundled front-end development that doesn't depend on Node or requires you to install a complex toolchain
https://perla-docs.web.app/
MIT License
132 stars 11 forks source link

VNext #89

Closed AngelMunoz closed 1 year ago

AngelMunoz commented 1 year ago

I've been doing a lot of refactoring in this branch in preparation to add the newer and most complex features to perla.

Please don't take anything in this branch as final until I actually say "this is how it's going to be" or something similar.

I mean it is very likely that I won't discard this branch given how much I have invested in it at this point.

Main things to look out in this PR for the moment (I will try to update as soon as I keep going forward)

Missing stuff

There may be more things to track but for the moment these are basically the goals in mind for this PR hopefully I can get this done soon enough people can start testing around

nojaf commented 1 year ago

Hey there @AngelMunoz, very cool to see this progress on plugins!

Throwing out a shower thought here: have you considered using FSharp.Adaptive instead of Observables? The work Jimmy has been doing in FSAutocomplete is pretty impressive.

AngelMunoz commented 1 year ago

have you considered using FSharp.Adaptive instead of Observables?

Not really, since the file system events I monitor are observables that's why I've been sticking with them, I'm not sure if theres a way I could incorporate adaptive stuff into it

I'll ask Jimmy about it

nojaf commented 1 year ago

There is an Adaptive helper for that (sample), which uses a file watcher under the hood as well. It is interesting stuff, that is all I want to throw in here.

AngelMunoz commented 1 year ago

Hello watcher folks, I hope you have been having a great week so far, here's the next batch of news:

This last set of changes includes most of the major refactoring to eliminate some of the major pains when maintaining this project, the optional values in the core types, to alleviate that I wrote a Configuration module that hopefully should centralize access to the configuration and also a single point for also updating the perla config file

New aditions to the configuration system also allows us to have preference order

Default settings -> Environment Variables -> Config file -> CLI overrides

This also means that perla should be able to run without a config file as long as one has an index file and an src directory :)

While the environment vars change is not enabled yet we can easily support that once we settle which (and if we want) fields to allow being set from env vars, that will likely be used for feature flags at some point.

The first major breaking chances for the config file are in, I've sourced some of the options to be top level ones like runConfiguration (production/development), moved the env file options also to be top level and introduced a few new ones like dependencies and devDependencies!

This change will allow you as a consumer to load dependencies that work with browser extensions like react dev tools or similar yet they won't be there when your production code is built

The FileSystem module is also now the central point for File/directory operations, While this was the goal behind the Fs module in previous iterations, the file system operations were still scattered all over the codebase, this should be in better shape now

The Scaffolding module as well is now self contained to all of the templating operations these may have broken while I did the refactoring, but with the introduction of UMX to the code base I will be able to ensure that I'm not confusing magic strings all over the place the functionality should not change at all so I will have to do the due testing in time.

We moved on from Argu to https://github.com/JordanMarr/FSharp.SystemCommandLine, which offers a different way of parsing CLI arguments, the main reasoning behind it is to also leverage tab completitons, a more customizable CLI for users, and the integration to IHost and some DI utils which may be quite useful within the aspnet server while the commands have been ported, We still need to ensure these commands work better than before

There's still pending refactoring in the following modules

Fable

I don't think the Fable module will have significant changes other than allow passing the source maps flag to the fable command and to accomodate to the previous optional settings that should be set this time.

Esbuild

Similar story to the Fable module, it is already pretty self contained and works nice, what could happen here is that we may remove existing compilation functions in favor to create an in-source Esbuild plugin for the Blessed types (JS, TS, JSX, TSX, CSS) but that will be after the virtual file system and plugin stuff is introduced after the refactoring efforts are done.

Server and Build

These two will be the last and are the most critical modules to get right as the premise of Perla lays in them they will be reworked after the new virtual file system and plugins work is introduced in the code base

The plan is to be able to leverage the mounted modules with the zio library to have a better path integration with both source code paths and server paths

The idea is that once the virtual file system is correctly mapped, we'll run each existing file in the mounted directories through the plugin list this in turn should leave us with the end products HTML/JS/CSS which we will process with esbuild in the end to generate a single bundle of JS/CSS and to emit the index file with the correct import map

At dev (or also reffered as perla serve) time we'll do the exact same and the files should be ready to be served by the aspnet app, each time a file changes we will be able to fire of an event either with observables or with adaptive values (I did speak with Jimmy about it and it might be useful for us as well, thanks nojaf for the pointer) and send that individual file through the pipeline and place it in the virtual file system. This should not introduce any noticeable speed changes which should be as fast as today

And I think that's what I got for today.

An extra note in the breaking chances is mostly in the configuration file not in the apps themselves moving/removing/adding some properties should be enough to fix those in your projects.

AngelMunoz commented 1 year ago

Hello there Folks!

The next batch of changes are in!

This week the focus was on cleaning up internal APIs, ensuring things build/serve as they should, the internal esbuild plugin works and leave things in shape for what comes after v1.0.0

Here is the updates:

The first previews will start going out during the next week or two so stay tuned

This includes support for plugins!

once the packages are out, I'll let you know

that's it for the meantime, I'll see you in the next one!

AngelMunoz commented 1 year ago

Okay Folks! It is time for v1 pre-releases otherwise I will never get feedback and I will never keep it going because of not enough motivation to finish the testing stuff and we'll go into a vicious cycle

v1 pre-releases will hit NuGet soon!