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

Comments

Projects
None yet
10 participants
@alfonsogarciacaro
Copy link
Collaborator

alfonsogarciacaro commented Jun 20, 2017

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

This comment has been minimized.

Copy link
Contributor

MangelMaxime commented Jun 20, 2017

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

@forki

This comment has been minimized.

Copy link
Member

forki commented Jun 20, 2017

go

@alfonsogarciacaro

This comment has been minimized.

Copy link
Collaborator

alfonsogarciacaro commented Jun 20, 2017

@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

This comment has been minimized.

Copy link
Contributor

MangelMaxime commented Jun 20, 2017

@alfonsogarciacaro That's true :)

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

@MangelMaxime

This comment has been minimized.

Copy link
Contributor

MangelMaxime commented Jun 20, 2017

@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

This comment has been minimized.

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

This comment has been minimized.

Copy link
Contributor

et1975 commented Jun 20, 2017

Make it a template option ;)

@MangelMaxime

This comment has been minimized.

Copy link
Contributor

MangelMaxime commented Jun 20, 2017

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

This comment has been minimized.

Copy link
Contributor

MangelMaxime commented Jun 20, 2017

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

This comment has been minimized.

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

This comment has been minimized.

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

This comment has been minimized.

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

This comment has been minimized.

Copy link
Contributor

bentayloruk commented Jun 21, 2017

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

This comment has been minimized.

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

This comment has been minimized.

Copy link
Collaborator

enricosada commented Jun 21, 2017

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

This comment has been minimized.

Copy link
Contributor

MangelMaxime commented Jun 21, 2017

Thanks for the info @enricosada

@bentayloruk

This comment has been minimized.

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

This comment has been minimized.

Copy link
Contributor

bentayloruk commented Jul 18, 2017

@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

This comment has been minimized.

Copy link
Contributor

MangelMaxime commented Jul 18, 2017

@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

This comment has been minimized.

Copy link
Contributor

bentayloruk commented Jul 18, 2017

Will do, thanks.

@panesofglass

This comment has been minimized.

Copy link

panesofglass commented Aug 23, 2017

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

@MangelMaxime

This comment has been minimized.

Copy link
Contributor

MangelMaxime commented Aug 23, 2017

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

But you can download the repo and start from here.

@isaacabraham

This comment has been minimized.

Copy link
Member

isaacabraham commented Oct 6, 2017

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

This comment has been minimized.

Copy link
Member

forki commented Oct 6, 2017

yes for the template that would be best

@theimowski

This comment has been minimized.

Copy link
Member

theimowski commented Oct 21, 2017

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

This comment has been minimized.

Copy link
Member

forki commented Oct 21, 2017

@cartermp

This comment has been minimized.

Copy link

cartermp commented Oct 21, 2017

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

This comment has been minimized.

Copy link
Member

theimowski commented Oct 22, 2017

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

This comment has been minimized.

Copy link
Member

forki commented Oct 22, 2017

@theimowski

This comment has been minimized.

Copy link
Member

theimowski commented Oct 22, 2017

@theimowski

This comment has been minimized.

Copy link
Member

theimowski commented Oct 22, 2017

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

This comment has been minimized.

Copy link
Member

isaacabraham commented Oct 23, 2017

Added. Thanks for doing this - great stuff.

@theimowski

This comment has been minimized.

Copy link
Member

theimowski commented Oct 23, 2017

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

@isaacabraham

This comment has been minimized.

Copy link
Member

isaacabraham commented Jan 19, 2018

Can we close this issue?

@forki forki closed this Jan 19, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment