fix: Switch to bun and fix ci

This commit is contained in:
2025-09-02 10:18:36 +02:00
parent ba51ab9557
commit cda0ef99a4
13 changed files with 1317 additions and 10115 deletions

View File

@@ -18,7 +18,7 @@ let versionFile = Path.getFullName ".version"
Target.create "Clean" (fun _ -> Shell.cleanDir deployPath) Target.create "Clean" (fun _ -> Shell.cleanDir deployPath)
Target.create "InstallClient" (fun _ -> Target.create "InstallClient" (fun _ ->
run npm "install" "." run bun "install" "."
run dotnet "tool restore" "." run dotnet "tool restore" "."
) )

View File

@@ -72,16 +72,16 @@ let createProcess exe arg dir =
|> CreateProcess.ensureExitCode |> CreateProcess.ensureExitCode
let dotnet = createProcess "dotnet" let dotnet = createProcess "dotnet"
let npm = let bun =
let npmPath = let bunPath =
match ProcessUtils.tryFindFileOnPath "npm" with match ProcessUtils.tryFindFileOnPath "bun" with
| Some path -> path | Some path -> path
| None -> | None ->
"npm was not found in path. Please install it and make sure it's available from your path. " + "bun was not found in path. Please install it and make sure it's available from your path. " +
"See https://safe-stack.github.io/docs/quickstart/#install-pre-requisites for more info" "See https://safe-stack.github.io/docs/quickstart/#install-pre-requisites for more info"
|> failwith |> failwith
createProcess npmPath createProcess bunPath
let run proc arg dir = let run proc arg dir =
proc arg dir proc arg dir

View File

@@ -3,16 +3,18 @@
"isRoot": true, "isRoot": true,
"tools": { "tools": {
"fable": { "fable": {
"version": "3.7.0", "version": "4.25.0",
"commands": [ "commands": [
"fable" "fable"
] ],
"rollForward": false
}, },
"fantomas-tool": { "fantomas": {
"version": "4.6.4", "version": "7.0.3",
"commands": [ "commands": [
"fantomas" "fantomas"
] ],
"rollForward": false
} }
} }
} }

View File

@@ -1,30 +1,32 @@
FROM mcr.microsoft.com/dotnet/sdk:8.0 FROM mcr.microsoft.com/dotnet/sdk:9.0
# Add keys and sources lists # Bun version
RUN apt-get update && apt-get install -y ca-certificates gnupg ARG BUN_INSTALL=/usr/local
RUN mkdir -p /etc/apt/keyrings ARG BUN_VERSION=bun-v1.2.16
RUN curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg
ENV NODE_MAJOR=20
RUN echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_MAJOR.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list
# Install node, 7zip, yarn, git, process tools # Install node, 7zip, yarn, git, process tools
RUN apt-get update \ RUN apt-get update \
&& apt-get install -y nodejs p7zip-full git procps ssh-client && apt-get install -y p7zip-full git procps ssh-client unzip
# Install Bun
RUN set -eux; \
curl -fsSL https://bun.sh/install > /usr/local/bin/install-bun \
&& chmod +x /usr/local/bin/install-bun \
&& /usr/local/bin/install-bun $BUN_VERSION debug-info
ENV BUN_INSTALL=/usr/local
# Clean up # Clean up
RUN apt-get autoremove -y \ RUN apt-get autoremove -y \
&& apt-get clean -y \ && apt-get clean -y \
&& rm -rf /var/lib/apt/lists/* && rm -rf /var/lib/apt/lists/*
# # Install dotnet tools
# RUN dotnet tool install fable -g
# Trouble brewing # Trouble brewing
RUN rm /etc/ssl/openssl.cnf RUN rm /etc/ssl/openssl.cnf
# add dotnet tools to path to pick up fake and paket installation # Add dotnet tools to path to pick up fake and paket installation
ENV PATH="/root/.dotnet/tools:${PATH}" ENV PATH="/root/.dotnet/tools:${PATH}"
# Copy endpoint specific user settings into container to specify # Copy endpoint specific user settings into container to specify
# .NET Core should be used as the runtime. # .NET Core should be used as the runtime.
COPY settings.vscode.json /root/.vscode-remote/data/Machine/settings.json COPY settings.vscode.json /root/.vscode-remote/data/Machine/settings.json

9
.envrc Normal file
View File

@@ -0,0 +1,9 @@
#!/usr/bin/env bash
# the shebang is ignored, but nice for editors
if type -P lorri &>/dev/null; then
eval "$(lorri direnv)"
else
echo 'while direnv evaluated .envrc, could not find the command "lorri" [https://github.com/nix-community/lorri]'
use nix
fi

2
.gitignore vendored
View File

@@ -15,3 +15,5 @@ deploy
.ionide/ .ionide/
*.db *.db
build.fsx.lock build.fsx.lock
.direnv/
result*

View File

@@ -1,8 +1,11 @@
variables: variables:
PROJECT_NAME: oceanbox.geojson SDK_VERSION: 9.0
SKIP_TESTS: "true" SKIP_TESTS: "true"
include: include:
- project: oceanbox/gitlab-ci - project: oceanbox/gitlab-ci
ref: v3 ref: v4.1
file: DotnetPackage.gitlab-ci.yml file: DotnetPackage.gitlab-ci.yml
inputs:
project-name: oceanbox.geojson
project-dir: .

View File

@@ -1,77 +0,0 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.27004.2005
MinimumVisualStudioVersion = 15.0.26124.0
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{328C82EA-D5C5-49E0-B3FB-490A12B2A8F6}"
ProjectSection(SolutionItems) = preProject
README.md = README.md
LICENSE = LICENSE
Dockerfile = Dockerfile
EndProjectSection
EndProject
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "Build", "Build.fsproj", "{A83C8399-5D81-4860-BDF4-591741374D6C}"
EndProject
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "src", "src/Oceanbox.GeoJson.fsproj", "{2D24D8A5-68FC-41BC-942D-DE23DB627E54}"
EndProject
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "test", "test\Tests.fsproj", "{56D31E48-612D-4761-B7B7-549C5E5EAA64}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{A83C8399-5D81-4860-BDF4-591741374D6C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A83C8399-5D81-4860-BDF4-591741374D6C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A83C8399-5D81-4860-BDF4-591741374D6C}.Debug|x64.ActiveCfg = Debug|Any CPU
{A83C8399-5D81-4860-BDF4-591741374D6C}.Debug|x64.Build.0 = Debug|Any CPU
{A83C8399-5D81-4860-BDF4-591741374D6C}.Debug|x86.ActiveCfg = Debug|Any CPU
{A83C8399-5D81-4860-BDF4-591741374D6C}.Debug|x86.Build.0 = Debug|Any CPU
{A83C8399-5D81-4860-BDF4-591741374D6C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A83C8399-5D81-4860-BDF4-591741374D6C}.Release|Any CPU.Build.0 = Release|Any CPU
{A83C8399-5D81-4860-BDF4-591741374D6C}.Release|x64.ActiveCfg = Release|Any CPU
{A83C8399-5D81-4860-BDF4-591741374D6C}.Release|x64.Build.0 = Release|Any CPU
{A83C8399-5D81-4860-BDF4-591741374D6C}.Release|x86.ActiveCfg = Release|Any CPU
{A83C8399-5D81-4860-BDF4-591741374D6C}.Release|x86.Build.0 = Release|Any CPU
{2D24D8A5-68FC-41BC-942D-DE23DB627E54}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2D24D8A5-68FC-41BC-942D-DE23DB627E54}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2D24D8A5-68FC-41BC-942D-DE23DB627E54}.Debug|x64.ActiveCfg = Debug|Any CPU
{2D24D8A5-68FC-41BC-942D-DE23DB627E54}.Debug|x64.Build.0 = Debug|Any CPU
{2D24D8A5-68FC-41BC-942D-DE23DB627E54}.Debug|x86.ActiveCfg = Debug|Any CPU
{2D24D8A5-68FC-41BC-942D-DE23DB627E54}.Debug|x86.Build.0 = Debug|Any CPU
{2D24D8A5-68FC-41BC-942D-DE23DB627E54}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2D24D8A5-68FC-41BC-942D-DE23DB627E54}.Release|Any CPU.Build.0 = Release|Any CPU
{2D24D8A5-68FC-41BC-942D-DE23DB627E54}.Release|x64.ActiveCfg = Release|Any CPU
{2D24D8A5-68FC-41BC-942D-DE23DB627E54}.Release|x64.Build.0 = Release|Any CPU
{2D24D8A5-68FC-41BC-942D-DE23DB627E54}.Release|x86.ActiveCfg = Release|Any CPU
{2D24D8A5-68FC-41BC-942D-DE23DB627E54}.Release|x86.Build.0 = Release|Any CPU
{56D31E48-612D-4761-B7B7-549C5E5EAA64}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{56D31E48-612D-4761-B7B7-549C5E5EAA64}.Debug|Any CPU.Build.0 = Debug|Any CPU
{56D31E48-612D-4761-B7B7-549C5E5EAA64}.Debug|x64.ActiveCfg = Debug|Any CPU
{56D31E48-612D-4761-B7B7-549C5E5EAA64}.Debug|x64.Build.0 = Debug|Any CPU
{56D31E48-612D-4761-B7B7-549C5E5EAA64}.Debug|x86.ActiveCfg = Debug|Any CPU
{56D31E48-612D-4761-B7B7-549C5E5EAA64}.Debug|x86.Build.0 = Debug|Any CPU
{56D31E48-612D-4761-B7B7-549C5E5EAA64}.Release|Any CPU.ActiveCfg = Release|Any CPU
{56D31E48-612D-4761-B7B7-549C5E5EAA64}.Release|Any CPU.Build.0 = Release|Any CPU
{56D31E48-612D-4761-B7B7-549C5E5EAA64}.Release|x64.ActiveCfg = Release|Any CPU
{56D31E48-612D-4761-B7B7-549C5E5EAA64}.Release|x64.Build.0 = Release|Any CPU
{56D31E48-612D-4761-B7B7-549C5E5EAA64}.Release|x86.ActiveCfg = Release|Any CPU
{56D31E48-612D-4761-B7B7-549C5E5EAA64}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {1385CB14-A9DD-4F05-8508-AB04EF45EAFA}
EndGlobalSection
EndGlobal

15
Oceanbox.GeoJson.slnx Normal file
View File

@@ -0,0 +1,15 @@
<Solution>
<Configurations>
<Platform Name="Any CPU" />
<Platform Name="x64" />
<Platform Name="x86" />
</Configurations>
<Folder Name="/Solution Items/">
<File Path="Dockerfile" />
<File Path="LICENSE" />
<File Path="README.md" />
</Folder>
<Project Path="Build.fsproj" />
<Project Path="src/Oceanbox.GeoJson.fsproj" />
<Project Path="test/Tests.fsproj" />
</Solution>

1241
bun.lock Normal file

File diff suppressed because it is too large Load Diff

10009
package-lock.json generated

File diff suppressed because it is too large Load Diff

14
shell.nix Normal file
View File

@@ -0,0 +1,14 @@
{
pkgs ? import <nixpkgs> { },
}:
let
dotnet-sdk = pkgs.dotnet-sdk_9;
in
pkgs.mkShell {
buildInputs = [
dotnet-sdk
pkgs.bun
];
DOTNET_ROOT = "${dotnet-sdk}/share/dotnet";
}

View File

@@ -2,7 +2,7 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<OutputType>Exe</OutputType> <OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework> <TargetFramework>net9.0</TargetFramework>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Compile Include="Tests.fs" /> <Compile Include="Tests.fs" />