New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Simple fs -> js solution? #1369
Comments
I'm pretty sure there's nothing quite that simple - mainly because Fable needs both dotnet and javascript infrastructures working in tandem. I've written a summary of how to create a minimal fable application here - https://medium.com/@bilkusg/fable-f-why-and-how-14e4d3702593 which works with the latest templates which (once you've dealt with the prerequisites ), can turn a basic F# file into javascript in about 4 lines. |
That's right, there are two things right now that make it a bit difficult to compile a single F# file to JS with zero-configuration:
None of the points above is unsolvable: we could add .fsx support again, and also make a more opinionated CLI tool available that compiles F# to JS with a single command and no configuration. But this has not been a common scenario so far as it's usually easier to simply write JS or TS for simple scripts like the one you pointed out (in fact the file you linked is valid -modern- JS, you can just add the However, if someone is interested in building such a tool I will gladly provide support and guidance for it :) |
So I started some proof of concept of trying to do this based of @ncave's repl.
Still needs lots of love though. |
That's great @TheAngryByrd! Where's your POC? |
Had to give it a good cleaning before I showed it to anyone 😸 https://github.com/TheAngryByrd/fantasy can try it with ./build.sh
cd dist && node fantasy ../examples/hello.fsx |
fable-splitter 2.1 (currently in beta, so you need to install it with Note that .fsx scripts are not supported at the moment because there's no standard solution yet to add package references, so for now it's easier to use .fsproj. But we can revisit it when .fsx can contain nuget/paket references and we get them resolved by the F# compiler or Dotnet.ProjInfo. |
Description
Recently I wrote some VSTS-Build-Tasks with typescript (https://github.com/matthid/Paket.TeamBuildCredentials/blob/master/SetPaketCredentialProvider.dev/setCredentialManager.ts). The primary reason to use typescript was that it was so easy to get started:
Basically
npm install <> && tsc file.js
is everything you need to do in order to get out of the "javascript misery".The problem especially for build-tasks is that it feels like using fable is more overhead than just writing the task in javascript/typescript.
My question now is: Can we already do the same for fable and I just missed it? What is currently the most minimal way to write such a build task in f#?
Feel free to point me to some existing samples/documentation maybe I have just missed them.
The text was updated successfully, but these errors were encountered: