Skip to content

Commit fbfdbc5

Browse files
authored
UseArtifactsOutput, add Start pipeline (#633)
* UseArtifactsOutput, add Start pipeline * Remove Fable cli tool, SatelliteResourceLanguages, update publish folder output * Don't publish ReadyToRun * Format build.fsx
1 parent b4c559b commit fbfdbc5

File tree

7 files changed

+80
-30
lines changed

7 files changed

+80
-30
lines changed

.config/dotnet-tools.json

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,8 @@
22
"version": 1,
33
"isRoot": true,
44
"tools": {
5-
"fable": {
6-
"version": "4.5.0",
7-
"commands": [
8-
"fable"
9-
]
10-
},
115
"fantomas": {
12-
"version": "6.3.0-alpha-003",
6+
"version": "6.3.0-alpha-007",
137
"commands": [
148
"fantomas"
159
]

Directory.Build.props

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
<FantomasMainRepository>$(MSBuildThisFileDirectory).deps\fantomas</FantomasMainRepository>
1717
<FantomasPreviewRepository>$(MSBuildThisFileDirectory).deps\main</FantomasPreviewRepository>
1818
<RollForward>LatestMajor</RollForward>
19+
<UseArtifactsOutput>true</UseArtifactsOutput>
20+
<SatelliteResourceLanguages>en</SatelliteResourceLanguages>
1921
</PropertyGroup>
2022

2123
<ItemGroup Condition="'$(IsLambda)' == 'true'">

README.md

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,25 @@ To run this tool locally you need:
1414
* Pull in the source dependencies:
1515

1616
```shell
17-
dotnet fsi build.fsx -p Fantomas-Git
17+
dotnet fsi build.fsx -- -p Fantomas-Git
1818
```
1919

2020
* Run the Watch pipeline:
2121

2222
```shell
23-
dotnet fsi build.fsx -p Watch
23+
dotnet fsi build.fsx -- -p Watch
2424
```
2525

26+
Making changes should reflect in the tool.
27+
28+
Or try the Run pipeline:
29+
30+
```shell
31+
dotnet fsi build -- -p Run
32+
```
33+
34+
This will run a published version of the tools.
35+
2636
* Open http://localhost:9060
2737

2838
## Running in Gitpod
@@ -32,11 +42,11 @@ dotnet fsi build.fsx -p Watch
3242
* Run
3343

3444
```shell
35-
dotnet fsi build.fsx -p Fantomas-Git
45+
dotnet fsi build.fsx -- -p Fantomas-Git
3646
```
3747

3848
```shell
39-
dotnet fsi build.fsx -p Watch
49+
dotnet fsi build.fsx -- -p Watch
4050
```
4151

4252
* Open browser for port `9060`

build.fsx

Lines changed: 52 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ pipeline "Fantomas-Git" {
8888
}
8989

9090
let publishLambda name =
91-
$"dotnet publish --tl -c Release -o {artifactDir </> name} {serverDir}/{name}/{name}.fsproj"
91+
$"dotnet publish --tl -c Release {serverDir}/{name}/{name}.fsproj"
9292

9393
let runLambda name =
9494
$"dotnet watch run --project {serverDir </> name </> name}.fsproj --tl"
@@ -107,16 +107,22 @@ let setViteToProduction () =
107107
setEnv "VITE_FANTOMAS_MAIN" $"{mainStageUrl}/fantomas/main"
108108
setEnv "VITE_FANTOMAS_PREVIEW" $"{mainStageUrl}/fantomas/preview"
109109

110-
pipeline "Build" {
111-
workingDir __SOURCE_DIRECTORY__
110+
let bunInstall =
112111
stage "bun install" {
113112
workingDir clientDir
114113
run "bun i"
115114
}
115+
116+
let dotnetInstall =
116117
stage "dotnet install" {
117118
run "dotnet tool restore"
118119
run "dotnet restore --tl"
119120
}
121+
122+
pipeline "Build" {
123+
workingDir __SOURCE_DIRECTORY__
124+
bunInstall
125+
dotnetInstall
120126
stage "check format F#" { run "dotnet fantomas src infrastructure build.fsx --check" }
121127
stage "check format JS" {
122128
workingDir clientDir
@@ -126,11 +132,7 @@ pipeline "Build" {
126132
run (fun _ ->
127133
async {
128134
Shell.rm_rf artifactDir
129-
!!(serverDir + "/*/bin")
130-
++ (serverDir + "/*/obj")
131-
++ (clientDir + "/src/bin")
132-
++ (clientDir + "/build")
133-
|> Seq.iter Shell.rm_rf
135+
Shell.rm_rf (clientDir + "/build")
134136
return 0
135137
})
136138
}
@@ -227,15 +229,7 @@ pipeline "FormatChanged" {
227229
runIfOnlySpecified true
228230
}
229231

230-
pipeline "Watch" {
231-
stage "bun install" {
232-
workingDir clientDir
233-
run "bun i"
234-
}
235-
stage "dotnet install" {
236-
run "dotnet tool restore"
237-
run "dotnet restore"
238-
}
232+
let prepareEnvironmentVariables =
239233
stage "prepare environment variables" {
240234
run (fun _ ->
241235
async {
@@ -259,6 +253,11 @@ pipeline "Watch" {
259253
return 0
260254
})
261255
}
256+
257+
pipeline "Watch" {
258+
bunInstall
259+
dotnetInstall
260+
prepareEnvironmentVariables
262261
stage "launch services" {
263262
paralle
264263
run (runLambda "ASTViewer")
@@ -276,4 +275,40 @@ pipeline "Watch" {
276275
runIfOnlySpecified true
277276
}
278277

278+
let runPublishedLambda name =
279+
let binary =
280+
__SOURCE_DIRECTORY__
281+
</> "artifacts"
282+
</> "publish"
283+
</> name
284+
</> "debug"
285+
</> $"%s{name}.dll"
286+
287+
stage $"Run %s{name}" {
288+
run $"dotnet publish --nologo -c Debug -tl {serverDir </> name </> name}.fsproj"
289+
run $"dotnet %s{binary}"
290+
}
291+
292+
pipeline "Start" {
293+
bunInstall
294+
dotnetInstall
295+
prepareEnvironmentVariables
296+
stage "launch services" {
297+
paralle
298+
runPublishedLambda "ASTViewer"
299+
runPublishedLambda "OakViewer"
300+
runPublishedLambda "FantomasOnlineV4"
301+
runPublishedLambda "FantomasOnlineV5"
302+
runPublishedLambda "FantomasOnlineV6"
303+
runPublishedLambda "FantomasOnlineMain"
304+
runPublishedLambda "FantomasOnlinePreview"
305+
stage "frontend" {
306+
workingDir clientDir
307+
run "bun run build"
308+
run "bun run serve"
309+
}
310+
}
311+
runIfOnlySpecified true
312+
}
313+
279314
tryPrintPipelineCommandHelp ()

infrastructure/Program.fs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,13 @@ let getAllLambdas (lastSha, lastTime) =
7171
Environment = environment }
7272

7373
let mkLambdaProject (name: string) lambdas =
74-
let archive = __SOURCE_DIRECTORY__ </> ".." </> "artifacts" </> name
74+
let archive =
75+
__SOURCE_DIRECTORY__
76+
</> ".."
77+
</> "artifacts"
78+
</> "publish"
79+
</> name
80+
</> "release"
7581

7682
{ Name = name
7783
FileArchive = archive

src/client/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"scripts": {
33
"dev": "bunx --bun vite",
44
"build": "bunx --bun vite build --base=/fantomas-tools/",
5-
"serve": "vite preview",
5+
"serve": "bunx --bun vite preview",
66
"format": "prettier --write \"src/**/*.{js,jsx}\" vite.config.js",
77
"lint": "prettier --check \"src/**/*.{js,jsx}\" vite.config.js"
88
},

src/client/vite.config.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,7 @@ export default defineConfig({
1717
outDir: 'build',
1818
},
1919
base: '/fantomas-tools/',
20+
preview: {
21+
port: 9060,
22+
},
2023
});

0 commit comments

Comments
 (0)