SAFE-Stack / SAFE-BookStore

Working sample of a SAFE-Stack project with hot reloading
https://safebookstore.azurewebsites.net/
The Unlicense
494 stars 147 forks source link

Convert to template? #122

Closed alfonsogarciacaro closed 6 years ago

alfonsogarciacaro commented 7 years ago

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 commented 7 years ago

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

forki commented 7 years ago

go

alfonsogarciacaro commented 7 years ago

@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 :+1:

MangelMaxime commented 7 years ago

@alfonsogarciacaro That's true :)

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

MangelMaxime commented 7 years ago

@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 commented 7 years ago

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

et1975 commented 7 years ago

Make it a template option ;)

MangelMaxime commented 7 years ago

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 commented 7 years ago

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 commented 7 years ago

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

et1975 commented 7 years ago

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

forki commented 7 years ago

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 commented 7 years ago

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 commented 7 years ago

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 commented 7 years ago

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 commented 7 years ago

Thanks for the info @enricosada

bentayloruk commented 7 years ago

@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 commented 7 years ago

@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 commented 7 years ago

@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 commented 7 years ago

Will do, thanks.

panesofglass commented 7 years ago

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

MangelMaxime commented 7 years ago

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

But you can download the repo and start from here.

isaacabraham commented 7 years ago

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 commented 7 years ago

yes for the template that would be best

theimowski commented 7 years ago

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 commented 7 years ago

Yes we don't need azure for minimal samples

Am 21.10.2017 11:56 schrieb "Tomasz Heimowski" notifications@github.com:

I started investigating what is the minimal setup required to work Suave + Fable + Elmish and came up with this https://github.com/theimowski/SAFE-tutorial/tree/template_candidate. 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.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/SAFE-Stack/SAFE-BookStore/issues/122#issuecomment-338379734, or mute the thread https://github.com/notifications/unsubscribe-auth/AADgNFx2rQdZBlKUwSNaS4fNiglpUgiiks5sub_GgaJpZM4N_mcX .

cartermp commented 7 years ago

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 commented 7 years ago

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 commented 7 years ago

Yes that would be great. I think @isaac_abraham can give you access rights

Am 22.10.2017 15:11 schrieb "Tomasz Heimowski" notifications@github.com:

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

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/SAFE-Stack/SAFE-BookStore/issues/122#issuecomment-338476222, or mute the thread https://github.com/notifications/unsubscribe-auth/AADgNFyJKxzX8DQt3DGH_t1sOo8GMUbNks5suz8LgaJpZM4N_mcX .

theimowski commented 7 years ago

/cc @isaacabraham

theimowski commented 7 years ago

The template is ready:

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

isaacabraham commented 7 years ago

Added. Thanks for doing this - great stuff.

theimowski commented 7 years ago

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

isaacabraham commented 6 years ago

Can we close this issue?