diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json index ef0b4a1d..4f9d04e8 100644 --- a/.config/dotnet-tools.json +++ b/.config/dotnet-tools.json @@ -2,14 +2,8 @@ "version": 1, "isRoot": true, "tools": { - "fable": { - "version": "4.5.0", - "commands": [ - "fable" - ] - }, "fantomas": { - "version": "6.3.0-alpha-003", + "version": "6.3.0-alpha-007", "commands": [ "fantomas" ] diff --git a/Directory.Build.props b/Directory.Build.props index e7c637a9..f8fdc7b6 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -16,6 +16,8 @@ $(MSBuildThisFileDirectory).deps\fantomas $(MSBuildThisFileDirectory).deps\main LatestMajor + true + en diff --git a/README.md b/README.md index 665788c9..6792355e 100644 --- a/README.md +++ b/README.md @@ -14,15 +14,25 @@ To run this tool locally you need: * Pull in the source dependencies: ```shell -dotnet fsi build.fsx -p Fantomas-Git +dotnet fsi build.fsx -- -p Fantomas-Git ``` * Run the Watch pipeline: ```shell -dotnet fsi build.fsx -p Watch +dotnet fsi build.fsx -- -p Watch ``` +Making changes should reflect in the tool. + +Or try the Run pipeline: + +```shell +dotnet fsi build -- -p Run +``` + +This will run a published version of the tools. + * Open http://localhost:9060 ## Running in Gitpod @@ -32,11 +42,11 @@ dotnet fsi build.fsx -p Watch * Run ```shell -dotnet fsi build.fsx -p Fantomas-Git +dotnet fsi build.fsx -- -p Fantomas-Git ``` ```shell -dotnet fsi build.fsx -p Watch +dotnet fsi build.fsx -- -p Watch ``` * Open browser for port `9060` diff --git a/build.fsx b/build.fsx index 1f382749..b4615ce5 100644 --- a/build.fsx +++ b/build.fsx @@ -88,7 +88,7 @@ pipeline "Fantomas-Git" { } let publishLambda name = - $"dotnet publish --tl -c Release -o {artifactDir name} {serverDir}/{name}/{name}.fsproj" + $"dotnet publish --tl -c Release {serverDir}/{name}/{name}.fsproj" let runLambda name = $"dotnet watch run --project {serverDir name name}.fsproj --tl" @@ -107,16 +107,22 @@ let setViteToProduction () = setEnv "VITE_FANTOMAS_MAIN" $"{mainStageUrl}/fantomas/main" setEnv "VITE_FANTOMAS_PREVIEW" $"{mainStageUrl}/fantomas/preview" -pipeline "Build" { - workingDir __SOURCE_DIRECTORY__ +let bunInstall = stage "bun install" { workingDir clientDir run "bun i" } + +let dotnetInstall = stage "dotnet install" { run "dotnet tool restore" run "dotnet restore --tl" } + +pipeline "Build" { + workingDir __SOURCE_DIRECTORY__ + bunInstall + dotnetInstall stage "check format F#" { run "dotnet fantomas src infrastructure build.fsx --check" } stage "check format JS" { workingDir clientDir @@ -126,11 +132,7 @@ pipeline "Build" { run (fun _ -> async { Shell.rm_rf artifactDir - !!(serverDir + "/*/bin") - ++ (serverDir + "/*/obj") - ++ (clientDir + "/src/bin") - ++ (clientDir + "/build") - |> Seq.iter Shell.rm_rf + Shell.rm_rf (clientDir + "/build") return 0 }) } @@ -227,15 +229,7 @@ pipeline "FormatChanged" { runIfOnlySpecified true } -pipeline "Watch" { - stage "bun install" { - workingDir clientDir - run "bun i" - } - stage "dotnet install" { - run "dotnet tool restore" - run "dotnet restore" - } +let prepareEnvironmentVariables = stage "prepare environment variables" { run (fun _ -> async { @@ -259,6 +253,11 @@ pipeline "Watch" { return 0 }) } + +pipeline "Watch" { + bunInstall + dotnetInstall + prepareEnvironmentVariables stage "launch services" { paralle run (runLambda "ASTViewer") @@ -276,4 +275,40 @@ pipeline "Watch" { runIfOnlySpecified true } +let runPublishedLambda name = + let binary = + __SOURCE_DIRECTORY__ + "artifacts" + "publish" + name + "debug" + $"%s{name}.dll" + + stage $"Run %s{name}" { + run $"dotnet publish --nologo -c Debug -tl {serverDir name name}.fsproj" + run $"dotnet %s{binary}" + } + +pipeline "Start" { + bunInstall + dotnetInstall + prepareEnvironmentVariables + stage "launch services" { + paralle + runPublishedLambda "ASTViewer" + runPublishedLambda "OakViewer" + runPublishedLambda "FantomasOnlineV4" + runPublishedLambda "FantomasOnlineV5" + runPublishedLambda "FantomasOnlineV6" + runPublishedLambda "FantomasOnlineMain" + runPublishedLambda "FantomasOnlinePreview" + stage "frontend" { + workingDir clientDir + run "bun run build" + run "bun run serve" + } + } + runIfOnlySpecified true +} + tryPrintPipelineCommandHelp () diff --git a/infrastructure/Program.fs b/infrastructure/Program.fs index 33e79505..836c7fe0 100644 --- a/infrastructure/Program.fs +++ b/infrastructure/Program.fs @@ -71,7 +71,13 @@ let getAllLambdas (lastSha, lastTime) = Environment = environment } let mkLambdaProject (name: string) lambdas = - let archive = __SOURCE_DIRECTORY__ ".." "artifacts" name + let archive = + __SOURCE_DIRECTORY__ + ".." + "artifacts" + "publish" + name + "release" { Name = name FileArchive = archive diff --git a/src/client/package.json b/src/client/package.json index c6c08006..c79f3a96 100644 --- a/src/client/package.json +++ b/src/client/package.json @@ -2,7 +2,7 @@ "scripts": { "dev": "bunx --bun vite", "build": "bunx --bun vite build --base=/fantomas-tools/", - "serve": "vite preview", + "serve": "bunx --bun vite preview", "format": "prettier --write \"src/**/*.{js,jsx}\" vite.config.js", "lint": "prettier --check \"src/**/*.{js,jsx}\" vite.config.js" }, diff --git a/src/client/vite.config.js b/src/client/vite.config.js index 66c5f908..a6e31566 100644 --- a/src/client/vite.config.js +++ b/src/client/vite.config.js @@ -17,4 +17,7 @@ export default defineConfig({ outDir: 'build', }, base: '/fantomas-tools/', + preview: { + port: 9060, + }, });