feat: intial commit
This commit is contained in:
69
.build/Build.fs
Normal file
69
.build/Build.fs
Normal file
@@ -0,0 +1,69 @@
|
||||
open Fake.Core
|
||||
open Fake.IO
|
||||
open Farmer
|
||||
open Farmer.Builders
|
||||
|
||||
open Helpers
|
||||
|
||||
initializeContext()
|
||||
|
||||
let srcPath = Path.getFullName "src"
|
||||
let testPath = Path.getFullName "test"
|
||||
let libPath = Some srcPath
|
||||
|
||||
let deployPath = Path.getFullName "deploy"
|
||||
let packPath = Path.getFullName "packages"
|
||||
let versionFile = Path.getFullName ".version"
|
||||
|
||||
Target.create "Clean" (fun _ -> Shell.cleanDir deployPath)
|
||||
|
||||
Target.create "InstallClient" (fun _ ->
|
||||
run npm "install" "."
|
||||
run dotnet "tool restore" "."
|
||||
)
|
||||
|
||||
Target.create "Bundle" (fun _ ->
|
||||
run dotnet $"publish -c Release -o \"{deployPath}\"" srcPath
|
||||
)
|
||||
|
||||
Target.create "BundleDebug" (fun _ ->
|
||||
run dotnet $"publish -c Debug -o \"{deployPath}\"" srcPath
|
||||
)
|
||||
|
||||
Target.create "Pack" (fun _ ->
|
||||
match libPath with
|
||||
| Some p -> run dotnet $"pack -c Release -o \"{packPath}\"" p
|
||||
| None -> ()
|
||||
)
|
||||
|
||||
|
||||
Target.create "Format" (fun _ ->
|
||||
run dotnet "fantomas . -r" "src"
|
||||
)
|
||||
|
||||
Target.create "Test" (fun _ ->
|
||||
if System.IO.Directory.Exists testPath then
|
||||
run dotnet "run" testPath
|
||||
else ()
|
||||
)
|
||||
|
||||
open Fake.Core.TargetOperators
|
||||
|
||||
let dependencies = [
|
||||
"Clean"
|
||||
==> "InstallClient"
|
||||
==> "Bundle"
|
||||
|
||||
"Clean"
|
||||
==> "BundleDebug"
|
||||
|
||||
"Clean"
|
||||
==> "Test"
|
||||
|
||||
|
||||
"Clean"
|
||||
==> "Pack"
|
||||
]
|
||||
|
||||
[<EntryPoint>]
|
||||
let main args = runOrDefault args
|
||||
105
.build/Helpers.fs
Normal file
105
.build/Helpers.fs
Normal file
@@ -0,0 +1,105 @@
|
||||
module Helpers
|
||||
|
||||
open Fake.Core
|
||||
|
||||
let initializeContext () =
|
||||
let execContext = Context.FakeExecutionContext.Create false "build.fsx" [ ]
|
||||
Context.setExecutionContext (Context.RuntimeContext.Fake execContext)
|
||||
|
||||
module Proc =
|
||||
module Parallel =
|
||||
open System
|
||||
|
||||
let locker = obj()
|
||||
|
||||
let colors =
|
||||
[| ConsoleColor.Blue
|
||||
ConsoleColor.Yellow
|
||||
ConsoleColor.Magenta
|
||||
ConsoleColor.Cyan
|
||||
ConsoleColor.DarkBlue
|
||||
ConsoleColor.DarkYellow
|
||||
ConsoleColor.DarkMagenta
|
||||
ConsoleColor.DarkCyan |]
|
||||
|
||||
let print color (colored: string) (line: string) =
|
||||
lock locker
|
||||
(fun () ->
|
||||
let currentColor = Console.ForegroundColor
|
||||
Console.ForegroundColor <- color
|
||||
Console.Write colored
|
||||
Console.ForegroundColor <- currentColor
|
||||
Console.WriteLine line)
|
||||
|
||||
let onStdout index name (line: string) =
|
||||
let color = colors.[index % colors.Length]
|
||||
if isNull line then
|
||||
print color $"{name}: --- END ---" ""
|
||||
else if String.isNotNullOrEmpty line then
|
||||
print color $"{name}: " line
|
||||
|
||||
let onStderr name (line: string) =
|
||||
let color = ConsoleColor.Red
|
||||
if isNull line |> not then
|
||||
print color $"{name}: " line
|
||||
|
||||
let redirect (index, (name, createProcess)) =
|
||||
createProcess
|
||||
|> CreateProcess.redirectOutputIfNotRedirected
|
||||
|> CreateProcess.withOutputEvents (onStdout index name) (onStderr name)
|
||||
|
||||
let printStarting indexed =
|
||||
for (index, (name, c: CreateProcess<_>)) in indexed do
|
||||
let color = colors.[index % colors.Length]
|
||||
let wd =
|
||||
c.WorkingDirectory
|
||||
|> Option.defaultValue ""
|
||||
let exe = c.Command.Executable
|
||||
let args = c.Command.Arguments.ToStartInfo
|
||||
print color $"{name}: {wd}> {exe} {args}" ""
|
||||
|
||||
let run cs =
|
||||
cs
|
||||
|> Seq.toArray
|
||||
|> Array.indexed
|
||||
|> fun x -> printStarting x; x
|
||||
|> Array.map redirect
|
||||
|> Array.Parallel.map Proc.run
|
||||
|
||||
let createProcess exe arg dir =
|
||||
CreateProcess.fromRawCommandLine exe arg
|
||||
|> CreateProcess.withWorkingDirectory dir
|
||||
|> CreateProcess.ensureExitCode
|
||||
|
||||
let dotnet = createProcess "dotnet"
|
||||
let npm =
|
||||
let npmPath =
|
||||
match ProcessUtils.tryFindFileOnPath "npm" with
|
||||
| Some path -> path
|
||||
| None ->
|
||||
"npm 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"
|
||||
|> failwith
|
||||
|
||||
createProcess npmPath
|
||||
|
||||
let run proc arg dir =
|
||||
proc arg dir
|
||||
|> Proc.run
|
||||
|> ignore
|
||||
|
||||
let runParallel processes =
|
||||
processes
|
||||
|> Proc.Parallel.run
|
||||
|> ignore
|
||||
|
||||
let runOrDefault args =
|
||||
try
|
||||
match args with
|
||||
| [| target |] -> Target.runOrDefault target
|
||||
| _ ->
|
||||
Target.runOrDefault "Pack"
|
||||
0
|
||||
with e ->
|
||||
printfn "%A" e
|
||||
1
|
||||
18
.config/dotnet-tools.json
Normal file
18
.config/dotnet-tools.json
Normal file
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"version": 1,
|
||||
"isRoot": true,
|
||||
"tools": {
|
||||
"fable": {
|
||||
"version": "3.7.0",
|
||||
"commands": [
|
||||
"fable"
|
||||
]
|
||||
},
|
||||
"fantomas-tool": {
|
||||
"version": "4.6.4",
|
||||
"commands": [
|
||||
"fantomas"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
29
.devcontainer/Dockerfile
Normal file
29
.devcontainer/Dockerfile
Normal file
@@ -0,0 +1,29 @@
|
||||
FROM mcr.microsoft.com/dotnet/sdk:6.0
|
||||
|
||||
# Add keys and sources lists
|
||||
RUN curl -sL https://deb.nodesource.com/setup_14.x | bash
|
||||
RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
|
||||
RUN echo "deb https://dl.yarnpkg.com/debian/ stable main" \
|
||||
| tee /etc/apt/sources.list.d/yarn.list
|
||||
|
||||
# Install node, 7zip, yarn, git, process tools
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y nodejs p7zip-full git procps ssh-client
|
||||
|
||||
# Clean up
|
||||
RUN apt-get autoremove -y \
|
||||
&& apt-get clean -y \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Install dotnet tools
|
||||
RUN dotnet tool install fable -g
|
||||
|
||||
# Trouble brewing
|
||||
RUN rm /etc/ssl/openssl.cnf
|
||||
|
||||
# add dotnet tools to path to pick up fake and paket installation
|
||||
ENV PATH="/root/.dotnet/tools:${PATH}"
|
||||
|
||||
# Copy endpoint specific user settings into container to specify
|
||||
# .NET Core should be used as the runtime.
|
||||
COPY settings.vscode.json /root/.vscode-remote/data/Machine/settings.json
|
||||
11
.devcontainer/devcontainer.json
Normal file
11
.devcontainer/devcontainer.json
Normal file
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"name": "SAFE",
|
||||
"dockerFile": "Dockerfile",
|
||||
"appPort": [8080, 8085],
|
||||
"extensions": [
|
||||
"ionide.ionide-fsharp",
|
||||
"ms-dotnettools.csharp",
|
||||
"editorconfig.editorconfig",
|
||||
"msjsdiag.debugger-for-chrome"
|
||||
]
|
||||
}
|
||||
3
.devcontainer/settings.vscode.json
Normal file
3
.devcontainer/settings.vscode.json
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"FSharp.fsacRuntime":"netcore"
|
||||
}
|
||||
32
.editorconfig
Normal file
32
.editorconfig
Normal file
@@ -0,0 +1,32 @@
|
||||
root = true
|
||||
|
||||
[*]
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
charset = utf-8
|
||||
trim_trailing_whitespace = true
|
||||
insert_final_newline = false
|
||||
|
||||
[*.fs]
|
||||
max_line_length=120
|
||||
# Feliz style
|
||||
fsharp_single_argument_web_mode=true
|
||||
fsharp_space_before_colon=false
|
||||
fsharp_max_if_then_else_short_width=60
|
||||
fsharp_max_infix_operator_expression=50
|
||||
fsharp_max_record_width=70
|
||||
fsharp_max_record_number_of_items=1
|
||||
fsharp_max_array_or_list_width=70
|
||||
fsharp_max_array_or_list_number_of_items=1
|
||||
fsharp_max_value_binding_width=70
|
||||
fsharp_max_function_binding_width=40
|
||||
fsharp_max_dot_get_expression_width=50
|
||||
fsharp_multiline_block_brackets_on_same_column=true
|
||||
fsharp_newline_between_type_definition_and_members=false
|
||||
fsharp_max_elmish_width=40
|
||||
fsharp_align_function_signature_to_indentation=false
|
||||
fsharp_alternative_long_member_definitions=false
|
||||
fsharp_multi_line_lambda_closing_newline=false
|
||||
fsharp_disable_elmish_syntax=false
|
||||
fsharp_keep_indent_in_branch=false
|
||||
fsharp_blank_lines_around_nested_multiline_expressions=false
|
||||
17
.gitignore
vendored
Normal file
17
.gitignore
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
.fable/
|
||||
.fake/
|
||||
.vs/
|
||||
obj/
|
||||
bin/
|
||||
packages/
|
||||
node_modules/
|
||||
src/Client/public/js/
|
||||
release.cmd
|
||||
release.sh
|
||||
.idea/
|
||||
*.orig
|
||||
*.DotSettings.user
|
||||
deploy
|
||||
.ionide/
|
||||
*.db
|
||||
build.fsx.lock
|
||||
9
.gitlab-ci.yml
Normal file
9
.gitlab-ci.yml
Normal file
@@ -0,0 +1,9 @@
|
||||
variables:
|
||||
DEPLOY_NAME: default
|
||||
DEPLOY_NAMESPACE: default
|
||||
|
||||
include:
|
||||
- project: oceanbox/gitlab-ci
|
||||
ref: main
|
||||
file: DotnetPackage.gitlab-ci.yml
|
||||
|
||||
41
.releaserc.yaml
Normal file
41
.releaserc.yaml
Normal file
@@ -0,0 +1,41 @@
|
||||
branches:
|
||||
- main
|
||||
- master
|
||||
- name: develop
|
||||
prerelease: true
|
||||
|
||||
plugins:
|
||||
- '@semantic-release/commit-analyzer'
|
||||
- '@semantic-release/release-notes-generator'
|
||||
- - '@semantic-release/changelog'
|
||||
- changelogFile: RELEASE_NOTES.md
|
||||
changelogTitle: "# Changelog"
|
||||
- - 'semantic-release-dotnet'
|
||||
- paths: [ "src/*.fsproj", "src/*/*.fsproj" ]
|
||||
- - '@semantic-release/exec'
|
||||
- generateNotesCmd: "echo ${nextRelease.version} > .version"
|
||||
- - '@semantic-release/git'
|
||||
- message: "chore(release): ${nextRelease.version}\n\n${nextRelease.notes}"
|
||||
assets: [ "RELEASE_NOTES.md", ".version", "src/*.fsproj", "src/*/*.fsproj" ]
|
||||
- - '@semantic-release/gitlab'
|
||||
- assets: []
|
||||
|
||||
analyzeCommits:
|
||||
- path: "@semantic-release/commit-analyzer"
|
||||
releaseRules:
|
||||
- type: "fix"
|
||||
release: "patch"
|
||||
- type: "patch"
|
||||
release: "patch"
|
||||
- type: "feat"
|
||||
release: "minor"
|
||||
- type: "feature"
|
||||
release: "minor"
|
||||
- type: "minor"
|
||||
release: "minor"
|
||||
- type: "breaking"
|
||||
release: "major"
|
||||
- type: "major"
|
||||
release: "major"
|
||||
|
||||
|
||||
16
Build.fsproj
Normal file
16
Build.fsproj
Normal file
@@ -0,0 +1,16 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include=".build/Helpers.fs" />
|
||||
<Compile Include=".build/Build.fs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Fake.Core.Target" Version="5.20.4" />
|
||||
<PackageReference Include="Fake.DotNet.Cli" Version="5.20.4" />
|
||||
<PackageReference Include="Fake.IO.FileSystem" Version="5.20.4" />
|
||||
<PackageReference Include="Farmer" Version="1.6.26" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
21
LICENSE
Normal file
21
LICENSE
Normal file
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2020 Serit Tromsø AS
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
77
ProjNet.FSharp.sln
Normal file
77
ProjNet.FSharp.sln
Normal file
@@ -0,0 +1,77 @@
|
||||
|
||||
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", "{B528237E-0F46-4AC0-B3D3-03CAE28C17C0}"
|
||||
ProjectSection(SolutionItems) = preProject
|
||||
README.md = README.md
|
||||
LICENSE = LICENSE
|
||||
Dockerfile = Dockerfile
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "Build", "Build.fsproj", "{8BFEEC8F-2001-4F09-A570-31F820551123}"
|
||||
EndProject
|
||||
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "src", "src/ProjNet.FSharp.fsproj", "{0330159C-567A-4247-B5DE-3FCF55A4E3FB}"
|
||||
EndProject
|
||||
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "test", "test\Tests.fsproj", "{67465828-635B-4D78-9100-5FC524A12A79}"
|
||||
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
|
||||
{8BFEEC8F-2001-4F09-A570-31F820551123}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{8BFEEC8F-2001-4F09-A570-31F820551123}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{8BFEEC8F-2001-4F09-A570-31F820551123}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{8BFEEC8F-2001-4F09-A570-31F820551123}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{8BFEEC8F-2001-4F09-A570-31F820551123}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{8BFEEC8F-2001-4F09-A570-31F820551123}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{8BFEEC8F-2001-4F09-A570-31F820551123}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{8BFEEC8F-2001-4F09-A570-31F820551123}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{8BFEEC8F-2001-4F09-A570-31F820551123}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{8BFEEC8F-2001-4F09-A570-31F820551123}.Release|x64.Build.0 = Release|Any CPU
|
||||
{8BFEEC8F-2001-4F09-A570-31F820551123}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{8BFEEC8F-2001-4F09-A570-31F820551123}.Release|x86.Build.0 = Release|Any CPU
|
||||
|
||||
{0330159C-567A-4247-B5DE-3FCF55A4E3FB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{0330159C-567A-4247-B5DE-3FCF55A4E3FB}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{0330159C-567A-4247-B5DE-3FCF55A4E3FB}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{0330159C-567A-4247-B5DE-3FCF55A4E3FB}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{0330159C-567A-4247-B5DE-3FCF55A4E3FB}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{0330159C-567A-4247-B5DE-3FCF55A4E3FB}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{0330159C-567A-4247-B5DE-3FCF55A4E3FB}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{0330159C-567A-4247-B5DE-3FCF55A4E3FB}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{0330159C-567A-4247-B5DE-3FCF55A4E3FB}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{0330159C-567A-4247-B5DE-3FCF55A4E3FB}.Release|x64.Build.0 = Release|Any CPU
|
||||
{0330159C-567A-4247-B5DE-3FCF55A4E3FB}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{0330159C-567A-4247-B5DE-3FCF55A4E3FB}.Release|x86.Build.0 = Release|Any CPU
|
||||
|
||||
{67465828-635B-4D78-9100-5FC524A12A79}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{67465828-635B-4D78-9100-5FC524A12A79}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{67465828-635B-4D78-9100-5FC524A12A79}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{67465828-635B-4D78-9100-5FC524A12A79}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{67465828-635B-4D78-9100-5FC524A12A79}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{67465828-635B-4D78-9100-5FC524A12A79}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{67465828-635B-4D78-9100-5FC524A12A79}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{67465828-635B-4D78-9100-5FC524A12A79}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{67465828-635B-4D78-9100-5FC524A12A79}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{67465828-635B-4D78-9100-5FC524A12A79}.Release|x64.Build.0 = Release|Any CPU
|
||||
{67465828-635B-4D78-9100-5FC524A12A79}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{67465828-635B-4D78-9100-5FC524A12A79}.Release|x86.Build.0 = Release|Any CPU
|
||||
|
||||
EndGlobalSection
|
||||
GlobalSection(NestedProjects) = preSolution
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {28EB18C6-970B-48D6-B440-E397821C77F7}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
9
README.md
Normal file
9
README.md
Normal file
@@ -0,0 +1,9 @@
|
||||
# ProjNet.FSharp
|
||||
|
||||
## Run
|
||||
|
||||
`dotnet run`
|
||||
|
||||
## Build
|
||||
|
||||
`dotnet run Bundle`
|
||||
1
RELEASE_NOTES.md
Normal file
1
RELEASE_NOTES.md
Normal file
@@ -0,0 +1 @@
|
||||
# Changelog
|
||||
10009
package-lock.json
generated
Normal file
10009
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
11
package.json
Normal file
11
package.json
Normal file
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"private": true,
|
||||
"devDependencies": {
|
||||
"@semantic-release/changelog": "^6.0.1",
|
||||
"@semantic-release/exec": "^6.0.3",
|
||||
"@semantic-release/git": "^10.0.1",
|
||||
"@semantic-release/gitlab": "^7.0.4",
|
||||
"semantic-release-dotnet": "^1.0.0"
|
||||
},
|
||||
"dependencies": {}
|
||||
}
|
||||
236
src/Library.fs
Normal file
236
src/Library.fs
Normal file
@@ -0,0 +1,236 @@
|
||||
module ProjNet.FSharp
|
||||
|
||||
open System
|
||||
open ProjNet
|
||||
|
||||
let toSingle (a: float, b: float) = single a, single b
|
||||
|
||||
let private EPSG3857' =
|
||||
CoordinateSystems.ProjectedCoordinateSystem.WebMercator
|
||||
|
||||
let private UTM33' =
|
||||
CoordinateSystems.ProjectedCoordinateSystem.WGS84_UTM(33, true)
|
||||
|
||||
let private WGS84' = CoordinateSystems.GeographicCoordinateSystem.WGS84
|
||||
|
||||
let private transform =
|
||||
CoordinateSystems.Transformations.CoordinateTransformationFactory()
|
||||
|
||||
let private WGS84_UTM33 =
|
||||
transform.CreateFromCoordinateSystems(WGS84', UTM33')
|
||||
|
||||
let private WGS84_EPSG3857 =
|
||||
transform.CreateFromCoordinateSystems(WGS84', EPSG3857')
|
||||
|
||||
let private UTM33_WGS84 =
|
||||
transform.CreateFromCoordinateSystems(UTM33', WGS84')
|
||||
|
||||
let private UTM33_EPSG3857 =
|
||||
transform.CreateFromCoordinateSystems(UTM33', EPSG3857')
|
||||
|
||||
let private EPSG3857_WGS84 =
|
||||
transform.CreateFromCoordinateSystems(EPSG3857', WGS84')
|
||||
|
||||
let private EPSG3857_UTM33 =
|
||||
transform.CreateFromCoordinateSystems(EPSG3857', UTM33')
|
||||
|
||||
type IUTM33 =
|
||||
abstract fromLngLat: (single * single) -> single * single
|
||||
abstract toLngLat: (single * single) -> single * single
|
||||
abstract fromWebMercator: (single * single) -> single * single
|
||||
abstract toWebMercator: (single * single) -> single * single
|
||||
|
||||
abstract fromLngLat: (float * float) -> float * float
|
||||
abstract toLngLat: (float * float) -> float * float
|
||||
abstract fromWebMercator: (float * float) -> float * float
|
||||
abstract toWebMercator: (float * float) -> float * float
|
||||
|
||||
type IWebMercator =
|
||||
abstract fromLngLat: (single * single) -> single * single
|
||||
abstract toLngLat: (single * single) -> single * single
|
||||
abstract fromUtm33: (single * single) -> single * single
|
||||
abstract toUtm33: (single * single) -> single * single
|
||||
|
||||
abstract fromLngLat: (float * float) -> float * float
|
||||
abstract toLngLat: (float * float) -> float * float
|
||||
abstract fromUtm33: (float * float) -> float * float
|
||||
abstract toUtm33: (float * float) -> float * float
|
||||
|
||||
type IWGS84 =
|
||||
abstract fromUtm33: (single * single) -> single * single
|
||||
abstract toUtm33: (single * single) -> single * single
|
||||
abstract fromWebMercator: (single * single) -> single * single
|
||||
abstract toWebMercator: (single * single) -> single * single
|
||||
|
||||
abstract fromUtm33: (float * float) -> float * float
|
||||
abstract toUtm33: (float * float) -> float * float
|
||||
abstract fromWebMercator: (float * float) -> float * float
|
||||
abstract toWebMercator: (float * float) -> float * float
|
||||
|
||||
let UTM33 =
|
||||
{ new IUTM33 with
|
||||
// member __. fromLngLat (lat: single, lng: single) =
|
||||
member __.fromLngLat((lng, lat): single * single) =
|
||||
WGS84_UTM33
|
||||
.MathTransform
|
||||
.Transform(float lng, float lat)
|
||||
.ToTuple()
|
||||
|> toSingle
|
||||
|
||||
member __.toLngLat((x, y): single * single) =
|
||||
UTM33_WGS84
|
||||
.MathTransform
|
||||
.Transform(float x, float y)
|
||||
.ToTuple()
|
||||
|> toSingle
|
||||
|
||||
member __.fromWebMercator((x, y): single * single) =
|
||||
EPSG3857_UTM33
|
||||
.MathTransform
|
||||
.Transform(float x, float y)
|
||||
.ToTuple()
|
||||
|> toSingle
|
||||
|
||||
member __.toWebMercator((x, y): single * single) =
|
||||
UTM33_EPSG3857
|
||||
.MathTransform
|
||||
.Transform(float x, float y)
|
||||
.ToTuple()
|
||||
|> toSingle
|
||||
|
||||
member __.fromLngLat((lng, lat): float * float) =
|
||||
WGS84_UTM33
|
||||
.MathTransform
|
||||
.Transform(lng, lat)
|
||||
.ToTuple()
|
||||
|
||||
member __.toLngLat((x, y): float * float) =
|
||||
UTM33_WGS84
|
||||
.MathTransform
|
||||
.Transform(x, y)
|
||||
.ToTuple()
|
||||
|
||||
member __.fromWebMercator((x, y): float * float) =
|
||||
EPSG3857_UTM33
|
||||
.MathTransform
|
||||
.Transform(float x, float y)
|
||||
.ToTuple()
|
||||
|
||||
member __.toWebMercator((x, y): float * float) =
|
||||
UTM33_EPSG3857
|
||||
.MathTransform
|
||||
.Transform(x, y)
|
||||
.ToTuple()
|
||||
}
|
||||
|
||||
let WebMercator =
|
||||
{ new IWebMercator with
|
||||
member __.fromLngLat((lng, lat): single * single) =
|
||||
WGS84_EPSG3857
|
||||
.MathTransform
|
||||
.Transform(float lng, float lat)
|
||||
.ToTuple()
|
||||
|> toSingle
|
||||
|
||||
member __.toLngLat((x, y): single * single) =
|
||||
EPSG3857_WGS84
|
||||
.MathTransform
|
||||
.Transform(float x, float y)
|
||||
.ToTuple()
|
||||
|> toSingle
|
||||
|
||||
member __.fromUtm33((lng, lat): single * single) =
|
||||
UTM33_EPSG3857
|
||||
.MathTransform
|
||||
.Transform(float lng, float lat)
|
||||
.ToTuple()
|
||||
|> toSingle
|
||||
|
||||
member __.toUtm33((x, y): single * single) =
|
||||
EPSG3857_UTM33
|
||||
.MathTransform
|
||||
.Transform(float x, float y)
|
||||
.ToTuple()
|
||||
|> toSingle
|
||||
|
||||
member __.fromLngLat((lng, lat): float * float) =
|
||||
WGS84_EPSG3857
|
||||
.MathTransform
|
||||
.Transform(lng, lat)
|
||||
.ToTuple()
|
||||
|
||||
member __.toLngLat((x, y): float * float) =
|
||||
EPSG3857_WGS84
|
||||
.MathTransform
|
||||
.Transform(x, y)
|
||||
.ToTuple()
|
||||
|
||||
member __.fromUtm33((lng, lat): float * float) =
|
||||
UTM33_EPSG3857
|
||||
.MathTransform
|
||||
.Transform(float lng, float lat)
|
||||
.ToTuple()
|
||||
|
||||
member __.toUtm33((x, y): float * float) =
|
||||
EPSG3857_UTM33
|
||||
.MathTransform
|
||||
.Transform(float x, float y)
|
||||
.ToTuple()
|
||||
}
|
||||
|
||||
|
||||
let WGS84 =
|
||||
{ new IWGS84 with
|
||||
member __.fromUtm33((lng, lat): single * single) =
|
||||
UTM33_WGS84
|
||||
.MathTransform
|
||||
.Transform(float lng, float lat)
|
||||
.ToTuple()
|
||||
|> toSingle
|
||||
|
||||
member __.toUtm33((x, y): single * single) =
|
||||
WGS84_UTM33
|
||||
.MathTransform
|
||||
.Transform(float x, float y)
|
||||
.ToTuple()
|
||||
|> toSingle
|
||||
|
||||
member __.fromWebMercator((x, y): single * single) =
|
||||
EPSG3857_WGS84
|
||||
.MathTransform
|
||||
.Transform(float x, float y)
|
||||
.ToTuple()
|
||||
|> toSingle
|
||||
|
||||
member __.toWebMercator((x, y): single * single) =
|
||||
WGS84_EPSG3857
|
||||
.MathTransform
|
||||
.Transform(float x, float y)
|
||||
.ToTuple()
|
||||
|> toSingle
|
||||
|
||||
member __.fromUtm33((lng, lat): float * float) =
|
||||
UTM33_WGS84
|
||||
.MathTransform
|
||||
.Transform(float lng, float lat)
|
||||
.ToTuple()
|
||||
|
||||
member __.toUtm33((x, y): float * float) =
|
||||
WGS84_UTM33
|
||||
.MathTransform
|
||||
.Transform(float x, float y)
|
||||
.ToTuple()
|
||||
|
||||
member __.fromWebMercator((x, y): float * float) =
|
||||
EPSG3857_WGS84
|
||||
.MathTransform
|
||||
.Transform(float x, float y)
|
||||
.ToTuple()
|
||||
|
||||
member __.toWebMercator((x, y): float * float) =
|
||||
WGS84_EPSG3857
|
||||
.MathTransform
|
||||
.Transform(float x, float y)
|
||||
.ToTuple()
|
||||
}
|
||||
|
||||
21
src/ProjNet.FSharp.fsproj
Normal file
21
src/ProjNet.FSharp.fsproj
Normal file
@@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
<PropertyGroup>
|
||||
<OutputType>Library</OutputType>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<RestorePackagesWithLockFile>true</RestorePackagesWithLockFile>
|
||||
<IsPackable>true</IsPackable>
|
||||
<PackageId>ProjNet.FSharp</PackageId>
|
||||
<Authors></Authors>
|
||||
<Company></Company>
|
||||
<Version>0.0.1</Version>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Library.fs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="FSharp.Data" Version="4.2.7" />
|
||||
<PackageReference Include="FSharpPlus" Version="1.2.2" />
|
||||
<PackageReference Include="ProjNet" Version="2.0.0" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
51
src/packages.lock.json
Normal file
51
src/packages.lock.json
Normal file
@@ -0,0 +1,51 @@
|
||||
{
|
||||
"version": 1,
|
||||
"dependencies": {
|
||||
"net6.0": {
|
||||
"FSharp.Core": {
|
||||
"type": "Direct",
|
||||
"requested": "[6.0.1, )",
|
||||
"resolved": "6.0.1",
|
||||
"contentHash": "VrFAiW8dEEekk+0aqlbvMNZzDvYXmgWZwAt68AUBqaWK8RnoEVUNglj66bZzhs4/U63q0EfXlhcEKnH1sTYLjw=="
|
||||
},
|
||||
"FSharp.Data": {
|
||||
"type": "Direct",
|
||||
"requested": "[4.2.7, )",
|
||||
"resolved": "4.2.7",
|
||||
"contentHash": "gQO0u0q1z9wXOkSmL7TVQLspAGR/S2Vm3CDPStEHCcTQyivkgoZie0IsB2Zyl2inC+hmQa/jcVQNQjo7XB7Ujg==",
|
||||
"dependencies": {
|
||||
"FSharp.Core": "4.7.2"
|
||||
}
|
||||
},
|
||||
"FSharpPlus": {
|
||||
"type": "Direct",
|
||||
"requested": "[1.2.2, )",
|
||||
"resolved": "1.2.2",
|
||||
"contentHash": "YzWFuAua/OCevT05FoWSInP3i6DGAwRqyJd0DtFWSisPI6LAqCMTWaj5hT4BDLDabvricVZ5VD/FWfSNubL6Gg==",
|
||||
"dependencies": {
|
||||
"FSharp.Core": "4.6.2"
|
||||
}
|
||||
},
|
||||
"ProjNET": {
|
||||
"type": "Direct",
|
||||
"requested": "[2.0.0, )",
|
||||
"resolved": "2.0.0",
|
||||
"contentHash": "iMJG8qpGJ8SjFrB044O8wgo0raAWCdG1Bvly0mmVcjzsrexDHhC+dUct6Wb1YwQtupMBjSTWq7Fn00YeNErprA==",
|
||||
"dependencies": {
|
||||
"System.Memory": "4.5.3",
|
||||
"System.Numerics.Vectors": "4.5.0"
|
||||
}
|
||||
},
|
||||
"System.Memory": {
|
||||
"type": "Transitive",
|
||||
"resolved": "4.5.3",
|
||||
"contentHash": "3oDzvc/zzetpTKWMShs1AADwZjQ/36HnsufHRPcOjyRAAMLDlu2iD33MBI2opxnezcVUtXyqDXXjoFMOU9c7SA=="
|
||||
},
|
||||
"System.Numerics.Vectors": {
|
||||
"type": "Transitive",
|
||||
"resolved": "4.5.0",
|
||||
"contentHash": "QQTlPTl06J/iiDbJCiepZ4H//BVraReU4O4EoRw1U02H5TLUIT7xn3GnDp9AXPSlJUDyFs4uWjWafNX6WrAojQ=="
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
18
test/Tests.fs
Normal file
18
test/Tests.fs
Normal file
@@ -0,0 +1,18 @@
|
||||
module Tests
|
||||
|
||||
open Expecto
|
||||
|
||||
let server =
|
||||
testList
|
||||
"Server"
|
||||
[
|
||||
testCase "Adding valid Todo"
|
||||
<| fun _ ->
|
||||
let expectedResult = Ok()
|
||||
Expect.equal (Ok()) expectedResult "Result should be ok"
|
||||
]
|
||||
|
||||
let all = testList "All" [ server ]
|
||||
|
||||
[<EntryPoint>]
|
||||
let main _ = runTests defaultConfig all
|
||||
16
test/Tests.fsproj
Normal file
16
test/Tests.fsproj
Normal file
@@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Tests.fs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\src\ProjNet.FSharp.fsproj" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Expecto" Version="9.0.4" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
Reference in New Issue
Block a user