-
Notifications
You must be signed in to change notification settings - Fork 585
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WIP: Dotnet new template #1989
WIP: Dotnet new template #1989
Conversation
Yes Metapackages is something that came up very early and yes it is not clear at all what I guess we would give some opinionated commonly used packages. |
Regarding the change itself: Yes I'd like to see a template. Can we add some documentation around this? (in particular for me to see how this works ;) ) |
Do you mean the modules? |
* Update documentation in template.json
If you want to try it locally (and dont want to build stuff yourself) i can also upload the |
No worries. I'll probably just merge straight to staging :) |
Also out of curiosity: Can you use the template on top of an existing project? |
The |
I'd say this is for historic reasons, maybe we should change there as well? Anyway, very nice idea thanks for looking into that. Should I merge as is? I think it looks quite usable already. |
* Fix renaming of build.fsx
I renamed the files, should be OK now.
|
Uah, I believe the community is kind of split around that. My personal opinion is that is has been superseded by dotnet sdk templates. What's left is a centralized place to get started with community provided setup (Paket, Fake, Expecto, Unquote, FSharp.Formatting, everything put together ready to use). So what's missing is a ProjectScaffold could also just be a script executing the various templates around the ecosystem: I guess everyone with a strong opinion there can have a huge impact, so feel free to just send PRs for what you feel is a good way forward (open issues if you feel it could be controversial)
As I'm on windows as well we can either add a integration test around that or I can try to use windows subsystem for windows :). Will merge on staging and take a look. |
I can test the Unix version of things. Could you provide a little detail about what exactly I should try out? |
@baronfel I'll report back to you when we have fixed staging but then it's basically:
|
@@ -1099,6 +1099,17 @@ Target.create "_DotNetPackage" (fun _ -> | |||
else c.Common | |||
} |> dtntSmpl) "Fake.sln" | |||
|
|||
// pack template | |||
let templateProj = appDir @@ "fake-template" | |||
DotNet.pack (fun c -> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't we just add it to Fake.sln
?
@matthid let netCoreProjs =
!! (appDir </> "*/*.fsproj") is probably the problem. The template is just a |
@kblohm thanks didn't noticed, will try to fix :) |
Yes it would be nice to add it to the solution file. That would probably not fix the deployment though, as Target.create "DotNetCorePushNuGet" (fun _ ->
// dotnet pack
netCoreProjs
-- (appDir </> "Fake.netcore/*.fsproj")
|> Seq.iter(fun proj ->
let projName = Path.GetFileName(Path.GetDirectoryName proj)
!! (sprintf "nuget/dotnetcore/%s.*.nupkg" projName)
-- (sprintf "nuget/dotnetcore/%s.*.symbols.nupkg" projName)
|> Seq.iter (nugetPush 4))
) would still not push it to nuget. |
Ok understood |
I just had a look at https://github.com/aspnet/templating/tree/dev/src/Microsoft.DotNet.Web.ProjectTemplates. They are also just using |
haha, probably for the very same reason :) Will try |
@baronfel Please test with |
as I expected you need to set the executable flag on the .sh script. This can be done with post-install actions, MiniScaffold does it like this: https://github.com/TheAngryByrd/MiniScaffold/blob/master/Content/.template.config/template.json#L19 |
The unique ids for the postactions that can be run is here: https://github.com/dotnet/templating/wiki/Post-Action-Registry, but I think you'll just need that exact code block from miniscaffold. |
It should mainly be |
Now after catching this I think we need an integration test which ensures that |
is there a way to make the restore in
|
@matthid you can again look at MiniScaffold for how to set up such a test easily. The test suite there installs the new packed template locally and tests it. |
@baronfel This really is a .net sdk issue because it should do an implicit restore (I believe there is an open issue for that). Once that is fixed we can remove the explicit restore and let the sdk handle that. |
also if the user specifies a non-default script name I think the generated This is made harder by the fact that run and build have different formats for where the script file goes, so you'd almost have to do parsing of the first argument to see if it is build or run and change things based on that. |
sorry for lots of comments, just noting things as I see them |
installing a global tool to a subdir doesn't seem to work:
The binary gets placed in
Note that the partially-mangled correct path is findable there: |
Currently the scripts will just wrap fake and not actually build a target (which I think makes sense).
My opinion on this is that if people use a non-default script-name
No worries there, perfectly reasonable ;) |
There's also a bug with install when dotnet cli is in a non-standard location: https://github.com/dotnet/cli/issues/9114 |
@matthid working on a PR now for chmod on the scripts + a test run |
@baronfel thanks for looking into this. All that fancy linux stuff and not being able to test locally makes this kinda hard. |
happy to help :) |
So until dotnet/cli#9114 is fixed, you have to use the |
well, you can also use the global tool, which is what I plan on standardizing on. should we make that a template-option? |
That is what |
So i can not create this on windows for you to run? That pretty much means whoever does the bootstrapping has to be on unix? What happens otherwise? |
Uah interesting point. On windows we would need to run |
Yes but this is a problem we would have had even with the |
Ahh! Thanks @matthid that helped! So yeah i can speak from experience now, that is a problem when you create the files on windows and try to build on unix. |
Not sure if we can somehow build that into the template (it would be nice if we find a way). But if not it is not a huge deal chmod errors are quite common so I hope users are able to figure it out. |
Hi,
i created a template to make it easier to get started using Fake.
I would appreciate some feedback if you are interested in this in general.
Some stuff to maybe discuss:
Somewhat related:
What do u think about a
Fake.All
metapackage, similar to theAspNetCore.All
? That would make it easier to get started. I personally do not really care about a few more megabytes to download to run my build. After the script is pretty much finished i can still clean up if i feel its getting too big. I am also kind of unsure what to include in a template like this, and aFake.All
package would get rid of that problem.