saturnframework / saturn.template Goto Github PK
View Code? Open in Web Editor NEWA dotnet CLI template for Saturn projects.
License: MIT License
A dotnet CLI template for Saturn projects.
License: MIT License
I get No such file or directory
when I create a new saturn project on my Ubuntu 18 on Windows
$ dotnet new saturn -lang F#
The template "Saturn v0.7.0" was created successfully.
Processing post-creation actions...
No such file or directory
The files do seem to be scaffolded correctly.
This one looks strange, like saturn
would depend on itself...
Not sure if that's Paket related or not
λ dotnet new Saturn --language F#
λ build
...
Starting Target: Build (==> InstallDotNetCore)
dotnet "build" --configuration Release
Microsoft (R) Build Engine version 15.5.180.51428 for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.
Restoring packages for C:\Users\BRE44821\sandbox\saturn\src\saturn\saturn.fsproj...
Restore completed in 24.13 ms for C:\Users\BRE44821\sandbox\saturn\src\saturn\saturn.fsproj.
Restore completed in 35.44 ms for C:\Users\BRE44821\sandbox\saturn\src\saturn\saturn.fsproj.
C:\Users\BRE44821\sandbox\saturn\src\saturn\saturn.fsproj : error NU1108: Cycle detected.
C:\Users\BRE44821\sandbox\saturn\src\saturn\saturn.fsproj : error NU1108: saturn -> Saturn (>= 0.4.3).
Generating MSBuild file C:\Users\BRE44821\sandbox\saturn\src\saturn\obj\saturn.fsproj.nuget.g.props.
Restore failed in 643.02 ms for C:\Users\BRE44821\sandbox\saturn\src\saturn\saturn.fsproj.
Build FAILED.
C:\Users\BRE44821\sandbox\saturn\src\saturn\saturn.fsproj : error NU1108: Cycle detected.
C:\Users\BRE44821\sandbox\saturn\src\saturn\saturn.fsproj : error NU1108: saturn -> Saturn (>= 0.4.3).
0 Warning(s)
1 Error(s)
Time Elapsed 00:00:01.52
Running build failed.
Error:
System.Exception: Build failed on "build" --configuration Release
at [email protected](String message) in D:\code\fake\src\app\FakeLib\DotNetCLIHelper.fs:line 224
at Fake.DotNetCli.Build(FSharpFunc`2 setBuildParams) in D:\code\fake\src\app\FakeLib\DotNetCLIHelper.fs:line 224
at [email protected](Unit _arg3) in C:\Users\BRE44821\sandbox\saturn\build.fsx:line 23
at Fake.TargetHelper.runSingleTarget(TargetTemplate`1 target) in D:\code\fake\src\app\FakeLib\TargetHelper.fs:line 626
λ dotnet --version
2.1.4
λ dotnet new Saturn --help
Usage: new [options]
Options:
-h, --help Displays help for this command.
-l, --list Lists templates containing the specified name. If no name is specified, lists all templates.
-n, --name The name for the output being created. If no name is specified, the name of the current directory is used.
-o, --output Location to place the generated output.
-i, --install Installs a source or a template pack.
-u, --uninstall Uninstalls a source or a template pack.
--type Filters templates based on available types. Predefined values are "project", "item" or "other".
--force Forces content to be generated even if it would change existing files.
-lang, --language Specifies the language of the template to create.
Saturn v0.4.1 (F#)
Author: Krzysztof Cieslak
(No Parameters)
When the template is updated to use Saturn 0.6.0, the code generation will need to be updated to produce curried args instead of tupled args, matching SaturnFramework/Saturn@240a7f2. Otherwise trying to follow the "How to start in 60 seconds" guide will result in the following errors:
src/SaturnSample/Books/BooksController.fs(96,10): error FS0001: Type mismatch. Expecting a� 'HttpContext -> 'a -> Giraffe.Core.HttpFuncResult' �but given a� ''b * string -> System.Threading.Tasks.Task<HttpContext option>' �The type 'HttpContext' does not match the type ''a * string' [src/SaturnSample/SaturnSample.fsproj]
src/SaturnSample/Books/BooksController.fs(98,10): error FS0001: Type mismatch. Expecting a� 'HttpContext -> 'a -> Giraffe.Core.HttpFuncResult' �but given a� ''b * string -> System.Threading.Tasks.Task<HttpContext option>' �The type 'HttpContext' does not match the type ''a * string' [src/SaturnSample/SaturnSample.fsproj]
src/SaturnSample/Books/BooksController.fs(100,12): error FS0001: Type mismatch. Expecting a� 'HttpContext -> 'a -> Giraffe.Core.HttpFuncResult' �but given a� ''b * string -> System.Threading.Tasks.Task<HttpContext option>' �The type 'HttpContext' does not match the type ''a * string' [src/SaturnSample/SaturnSample.fsproj]
src/SaturnSample/Books/BooksController.fs(101,12): error FS0001: Type mismatch. Expecting a� 'HttpContext -> 'a -> Giraffe.Core.HttpFuncResult' �but given a� ''b * string -> System.Threading.Tasks.Task<HttpContext option>' �The type 'HttpContext' does not match the type ''a * string' [src/SaturnSample/SaturnSample.fsproj]
I am following the readme instructions on using the template. The steps to build and run don't work because there isn't a fake.sh
script, but there is a build.sh
. I do get an error when I create the project. See #18
For build execute fake.sh build or .\fake.cmd build
For running execute fake.sh build -t Run or .\fake.cmd build -t Run
My files list:
marnee@DESKTOP-R85TMON:/mnt/c/Users/marnee/Dropbox/interactive-workshop/src/test$ ll
total 304
drwxrwxrwx 1 marnee marnee 4096 Mar 30 09:40 ./
drwxrwxrwx 1 marnee marnee 4096 Mar 30 09:39 ../
-rwxrwxrwx 1 marnee marnee 44 Mar 30 09:39 .gitignore*
drwxrwxrwx 1 marnee marnee 4096 Mar 30 09:39 .paket/
drwxrwxrwx 1 marnee marnee 4096 Mar 30 09:39 .vs/
-rwxrwxrwx 1 marnee marnee 197 Mar 30 09:39 build.cmd*
-rwxrwxrwx 1 marnee marnee 995 Mar 30 09:39 build.fsx*
-rwxrwxrwx 1 marnee marnee 745 Mar 30 09:39 build.sh*
-rwxrwxrwx 1 marnee marnee 47 Mar 30 09:39 global.json*
-rwxrwxrwx 1 marnee marnee 3328 Mar 30 09:39 my-saturn-project.sln*
drwxrwxrwx 1 marnee marnee 4096 Mar 30 09:40 packages/
drwxrwxrwx 1 marnee marnee 4096 Mar 30 09:40 paket-files/
-rwxrwxrwx 1 marnee marnee 247 Mar 30 09:39 paket.dependencies*
-rwxrwxrwx 1 marnee marnee 298800 Mar 30 09:40 paket.lock*
drwxrwxrwx 1 marnee marnee 4096 Mar 30 09:39 src/
This is either a result of me not understanding a paket nuance, or it could be related to #25
The symptoms are the visual studio does not recognize the namespace SimpleMigrations and neither does dotnet build
when run from within the migrations folder.
C:\repos\Saturn2\src\Migrations\Program.fs(4,6): error FS0039: The namespace or module 'SimpleMigrations' is not defined. [C:\repos\Saturn2\src\Migrations\Migrations.fsproj]
C:\repos\Saturn2\src\Migrations\Program.fs(5,16): error FS0039: The namespace 'Data' is not defined. [C:\repos\Saturn2\src\Migrations\Migrations.fsproj]
C:\repos\Saturn2\src\Migrations\Program.fs(6,6): error FS0039: The namespace or module 'SimpleMigrations' is not defined. [C:\repos\Saturn2\src\Migrations\Migrations.fsproj]
C:\repos\Saturn2\src\Migrations\Program.fs(7,6): error FS0039: The namespace or module 'SimpleMigrations' is not defined. [C:\repos\Saturn2\src\Migrations\Migrations.fsproj]
C:\repos\Saturn2\src\Migrations\Program.fs(13,18): error FS0039: The type 'SqliteConnection' is not defined. [C:\repos\Saturn2\src\Migrations\Migrations.fsproj]
C:\repos\Saturn2\src\Migrations\Program.fs(14,20): error FS0039: The value or constructor 'SqliteDatabaseProvider' is not defined. [C:\repos\Saturn2\src\Migrations\Migrations.fsproj]
C:\repos\Saturn2\src\Migrations\Program.fs(15,20): error FS0039: The value or constructor 'SimpleMigrator' is not defined. [C:\repos\Saturn2\src\Migrations\Migrations.fsproj]
C:\repos\Saturn2\src\Migrations\Program.fs(16,25): error FS0039: The value or constructor 'ConsoleRunner' is not defined. [C:\repos\Saturn2\src\Migrations\Migrations.fsproj]
C:\repos\Saturn2\src\Migrations\Program.fs(17,5): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [C:\repos\Saturn2\src\Migrations\Migrations.fsproj]
I have tried removing Simple.Migrations then adding it again. Also tried clearing the paket cache. I haven't tried recreating the entire migrations project, but I don't think that should be required.
Current release of Saturn uses net6. Shouldn't this template create that version?
install template
do dotnet new saturn -lang f# -n blabla
do .\build.cmd
observe a lot of messages from Fake like This runner is now obsolete with FAKE 5, please upgrade to the new .Net Core runner. See https://fake.build/fake-migrate-to-fake-5.html
, build.fsx(7,38): warning FS0044: This construct is deprecated. Use Fake.IO instead (FAKE0001 - package: Fake.IO.FileSystem - member: Fake.IO.Path.getFullName)
...
I decided to spend an hour tonight to check out Saturn fully. I'm impressed with the work done so far!
In going through the "60 second guide," I've run into a point of confusion:
As of time of this issue, Step 9 tells me the following:
Which I take to mean "Uncomment the following line:"
Naturally, when I do such, the apiRouter is undefined, and I need to uncomment the above uncommented bits:
But when I do that, I see more sad red squigglies :(
Figuring out "how do I implement error_hander
and someScopeOrController
certainly goes against the '60 seconds' sales pitch, so the way I see it, this can be solved in one of 2 ways:
1- Remove step 9 from the guide, having the person onboarding interact/learn a bit less
2- Give more instructions as to what should go here.
I suspect that the former is the more obvious choice. Best to leave that sort of stuff for the slightly-longer demo :)
Hi,
Would you be OK with me contributing a PR to add SQL Server as an option to the template?
I was thinking to use a new parameter on the template that will default to SQLite, and be used in the template to control copying and renaming of sources, similar to how it is being done in SAFE-Template
...
"modifiers": [
{
"condition": "(Server == \"suave\")",
"exclude": [ "**/ServerGiraffe.fs" ],
"rename": {
"ServerSuave.fs": "Server.fs"
}
},
...
I would also be able to produce a corresponding PR for the dotnet-saturn repo to alter the GEN function.
Thanks
Let's update the template to use .NET Core 2.1, particularly 2.1.401? What do you think?
Should not "use_gzip" function call be placed before "use_router Router.appRouter"?
As far as I see at this point it is not doing any compression.
I believe it should come after global error handler but before any other middleware.
see also dotnet/AspNetCore.Docs#2516
I was going through the Get Started guide for Saturn and noticed that the template uses .NET version 3.1 by default. Would it be better to update this to .NET version 5 at this point?
Hello, i followed the Using the template - guide and i got the following error when trying to build via fake build
.
System.IO.FileLoadException: Could not load file or assembly 'System.Threading, Version=4.1.0.0,
Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The located assembly's manifest definition
does not match the assembly reference. (Exception from HRESULT: 0x80131040) at
System.Console.get_Out() at Program.main(String[] argv)
I checked my installed sdk versions (dotnet --info
) and found that i have SDK 2.1.802 installed. This is the version that has LTS as listed here. At least as far as i understood.
Then i saw that 2.1.508 was referenced in the global.json file so i downloaded that version and tried to build, but it still failed.
In the end i changed the following files:
"version": "3.0.100"
framework: netcoreapp3.0
<TargetFramework>netcoreapp3.0</TargetFramework>
With these changes the fake build
and fake build -t run
command succed.
Now, i am missing a lot of knowledge so i don't know if this is a bug, an missing update or expected behavior and i just did everything wrong. 😅
Often when an application is run under the ionide debugger, the System.Environment.CurrentDirectory
is set to that of the debugging instance, which is somewhere inside the user home. This causes relative-path file lookups, like a bundled sqlite database for example, to fail. Should the template include code to set the System.Environment.CurrentDirectory
to the location of the currently-executing assembly(System.Reflection.Assembly.GetExecutingAssembly().Location
)? This was inspired by a troubleshooting session I had this morning with a Slack user in #web.
Could we have a Saturn template with EF core?
many .net developers could re-use their pre existing knowledge and this would enlarge the adoption in the aspnet community context ?
EF also has support for many-2-many wheras in dapper this is somehow a bit more troublesome to achieve with "model" transparency (ORM vs micro-orm)
just wondering if that is possible
Whilst following the 'How to start in 60 seconds' guide, I hit a problem when it's time to run ./build.sh
. I received the following error:
➜ SaturnSample ./build.sh
Executing Paket...
paket.lock file found, restoring packages...
./build.sh: line 24: mono: command not found
I have dotnet core installed so I attempted to remove the call to mono
on line 24 to be simply be "$@"
and ran ./build.sh
once again. I then hit ./build.sh: line 24: .paket/paket.exe: cannot execute binary file
.
I'm assuming MacOS as possibly Linux aren't currently supported. Are there plans to add support? If so, what would need to be done to allow Saturn's template to work cross platform?
Versions
MacOS - 10.14.3
dotnet - 2.2.100
zsh - 5.3
Update:
I just installed mono
and things are working. Perhaps it's worth mentioning that mono is required alongside dotnet. As someone new to dotnet, I thought having dotnet installed would have sufficed. Perhaps this is now simply a documentation issue of required dependencies.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.