Skip to content
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

Convert to template? #122

Closed
alfonsogarciacaro opened this issue Jun 20, 2017 · 34 comments
Closed

Convert to template? #122

alfonsogarciacaro opened this issue Jun 20, 2017 · 34 comments

Comments

@alfonsogarciacaro
Copy link
Collaborator

It may be a good idea to convert the repo to a template so users can create a project easily using dotnet SDK. It would still be possible to clone and use the project directly, though we have to move everything to a Content folder (unless @enricosada knows another possibility).

What do you think? If we make this a template, maybe @MangelMaxime can help with that?

@MangelMaxime
Copy link
Contributor

Sure I can help on this subject if we give me a go :)

@forki
Copy link
Member

forki commented Jun 20, 2017

go

@alfonsogarciacaro
Copy link
Collaborator Author

@MangelMaxime I forgot to mention that we need to update the project to Fable 1.1.2, I'll do it when Elmish packages have been updated 👍

@MangelMaxime
Copy link
Contributor

@alfonsogarciacaro That's true :)

I will prepare the template like so we will just need to update the Fable versions

@MangelMaxime
Copy link
Contributor

@forki Do you want me to convert the project structure (speaking of the Elmish part) to the same structure in the Elmish templates. Separates files for Types, State, View, Api etc. ?

@forki
Copy link
Member

forki commented Jun 20, 2017

I'm not sure if Iike the structure ;-) but if others like @et1975 think it's a good idea then yes please

@et1975
Copy link
Contributor

et1975 commented Jun 20, 2017

Make it a template option ;)

@MangelMaxime
Copy link
Contributor

Personally, I find it intuitive and scalable as every "elmish part" will have the same. After, as always it's a matter of personal preference. ^^

@MangelMaxime
Copy link
Contributor

Lol @et1975 we could but not really maintainable :p

I will focus on making the template as it is for now. Will see in the PR

@forki
Copy link
Member

forki commented Jun 20, 2017

Ok @et1975 what do you prefer? I'm actually fine with one file and 3 files.

@et1975
Copy link
Contributor

et1975 commented Jun 20, 2017

I find separate files to be preferable for anything but the mickey-mouse stuff:

  • it gives you an easy way to find stuff
  • order of files drives dependency hierarchy
  • module in every file takes familiar and, ideally, similar public shape. Sidenote: we can't take advantage of it atm since F# doesn't support proper ML modules, but imho it should always be a goal.

@forki
Copy link
Member

forki commented Jun 20, 2017

one particular problem I have is that then many many files are called Types.fs and it's hard(er) in ionide to get the right one with Ctrl+P /cc @Krzysztof-Cieslak

@bentayloruk
Copy link
Contributor

I've been having this structure discussion with myself, so great to see it here too! Happy to help where I can.

I've tried to split the files apart for structure (and learning). For example, I tried to mimic the official Elm example file structures and the "Kris Jenkins style". One thing I noticed, is that it's not that easy to do at the moment, due to some (maybe) encapsulation issues (some raised in #124). I found I had to make code changes, because when split, things broke and could not be fixed purely via file order changes. Therefore, I think it would be worth splitting apart, just to make sure that it can be done. We can easily advise people on how to collapse down a split structure.

@enricosada
Copy link
Collaborator

enricosada commented Jun 21, 2017

Some examples/docs of .net templating engine (the dotnet new templates) in https://github.com/dotnet/dotnet-template-samples
the source repo is https://github.com/dotnet/templating , all issue/q open there, the repo maintainer is awesome

@enricosada
Copy link
Collaborator

we have to move everything to a Content folder (unless @enricosada knows another possibility).

Just use the right wildcard path include in the template .proj.
It need to be in a specific path in the nupkg, but you can get the files from where you want.
As a note, the git install of dotnet new is not yet implemented.

@MangelMaxime
Copy link
Contributor

Thanks for the info @enricosada

@bentayloruk
Copy link
Contributor

bentayloruk commented Jun 21, 2017

@MangelMaxime I was working on further changes in my local copy (past that of stuff in #124) and ended up with a "global" types file (containing UserData, Page and toHash) . Was just looking through the old Elmish samples and saw that you had pretty much the same thing.

In the current template here, these global types are located in Messages.fs. This makes them global due to file order, but caused me some confusion, as they are not message types. They could be put in another file. However, I'm thinking that Page is an app level type for routing and could be made local to App. This would force Menu to have a model that contains the link information, rather than baked in knowledge of the pages.

Maybe it would be good if the global types are very explicit and separate form the app model types. This is also mentioned in a comment on @krisajenkins blog post.

Just wanted to note this here, before I forgot! Will look forward to your PR.

@bentayloruk
Copy link
Contributor

@MangelMaxime I was thinking again about suggesting some scaffold changes in a PR. Should I do them against master, or is it still sensible to wait for the template?

@MangelMaxime
Copy link
Contributor

@bentayloruk You can do it against master.

I will restart the template from zero when I have time. (Will not move the repo into a content folder etc.

@bentayloruk
Copy link
Contributor

Will do, thanks.

@panesofglass
Copy link

Is there a template available yet, or is that still a WIP?

@MangelMaxime
Copy link
Contributor

For the moment the work on the template have been stopped.

But you can download the repo and start from here.

@isaacabraham
Copy link
Member

I'd very much like to pick this work up, albeit with a much simplified code base. This means: the bookstore itself would go, probably the log-in would go as well, the docker stuff would go - it would maybe just have a single GET endpoint which proved that the back and front end were connected.

@forki
Copy link
Member

forki commented Oct 6, 2017

yes for the template that would be best

@theimowski
Copy link
Member

I started investigating what is the minimal setup required to work Suave + Fable + Elmish and came up with this.
I'm happy to proceed with creating a dotnet template on top of that.
This does not however contain any Azure bits - not sure how a template could relate to Azure other than creating Docker images?
Looking forward to your feedback.
My interest is to eventually create a GitBook-based tutorial for SAFE stack, and I'd ideally start the bootstrapping with creating from a solid template.

@forki
Copy link
Member

forki commented Oct 21, 2017 via email

@cartermp
Copy link

Any inclusion of Azure (or GCP, or whatever) should be a separate template, IMO. With SAFE there's quite an array of options, but aiming for the simplest one that works locally is probably best.

@theimowski
Copy link
Member

Ok, do you want me to push the repo with src for template to SAFE-Stack org? If so I'd need to be added to the org

@forki
Copy link
Member

forki commented Oct 22, 2017 via email

@theimowski
Copy link
Member

/cc @isaacabraham

@theimowski
Copy link
Member

The template is ready:

  • Install the template: dotnet new -i SAFE.Template::*
  • Create new project from the template: dotnet new SAFE
  • Build the project: build.cmd / build.sh
  • Run (working dir root of project): dotnet run --project src\Server\Server.fsproj
  • Preview in browser: http://localhost:8080/index.html

When I get access to the org I'll push the sources under SAFE-template project.

@isaacabraham
Copy link
Member

Added. Thanks for doing this - great stuff.

@theimowski
Copy link
Member

Cool, thanks. Template source is now available here: https://github.com/SAFE-Stack/SAFE-template

@isaacabraham
Copy link
Member

Can we close this issue?

@forki forki closed this as completed Jan 19, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants