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

Gleam playground #6

Open
lpil opened this issue Jan 20, 2024 · 13 comments
Open

Gleam playground #6

lpil opened this issue Jan 20, 2024 · 13 comments
Labels
help wanted Contributions encouraged

Comments

@lpil
Copy link
Member

lpil commented Jan 20, 2024

Use the same tech as the language tour to make a little place one can edit and run Gleam in their browser.

Prior art:

MVP features

  • Editing
  • Compilation
  • Execution via JavaScript
  • Syntax highlighting

Secondary features

@lpil lpil added the help wanted Contributions encouraged label Jan 20, 2024
@isaacharrisholt
Copy link
Contributor

I'd like to take a crack at this, if that's alright. Do you want it in the tour repo or a different one? I think having it in the same one makes sense since the functionality is going to be similar

@lpil
Copy link
Member Author

lpil commented May 4, 2024

I'm not sure. Maybe a different one so we can use github actions and get play.gleam.run?

It'd be pretty much the same code but with a different UI and some code to compress the user's code and put it in the hash string like this one does: https://github.com/JohnDoneth/gleam-playground

@isaacharrisholt
Copy link
Contributor

That seems reasonable. Would you mind setting up a repo then and I'll take a crack at it?

@lpil
Copy link
Member Author

lpil commented May 4, 2024

Thank you. Here you go! https://github.com/gleam-lang/playground

@isaacharrisholt
Copy link
Contributor

Thanks!

@inoas
Copy link

inoas commented May 6, 2024

I'm not sure. Maybe a different one so we can use github actions and get play.gleam.run?

It'd be pretty much the same code but with a different UI and some code to compress the user's code and put it in the hash string like this one does: https://github.com/JohnDoneth/gleam-playground

This is lovely, I also like that there is no server side storage but the compressed query string logic (that I once improved :D over there). Maybe we can get multiple module tabs and saving/loading as a file bundle in some fashion?

@isaacharrisholt
Copy link
Contributor

isaacharrisholt commented May 6, 2024

It could be nice to have something like the Svelte playground. It allows for multiple files and shows the compiled output live. You can also download a zip bundle of your files. For the sharing, it would be reasonably simple to compress a JSON string of the form:

[
  {"file":"app.gleam","content":"import gleam/io\n..."},
  ...
]

I also like the example scripts the Go playground includes

@lpil
Copy link
Member Author

lpil commented May 6, 2024

Let's start with one file and make that a good experience and then we can decide if it's worth the additional work at that time. We have to be efficient with our actions and having multiple files doesn't unlock anything in particular that I can think of.

@isaacharrisholt
Copy link
Contributor

I agree, I'm just making sure we can support upgrades if we do decide to do them. It might not be multiple files, but maybe specifying the Gleam version, adding a name to the shared example, etc.

@lpil
Copy link
Member Author

lpil commented May 6, 2024

I don't want to support anything but the latest Gleam version or any project related features such as files. We just want a simple playground with sharing to start as that's where the main value is. We are very time pressed so efficiency is the name of the game.

@isaacharrisholt
Copy link
Contributor

Got it!

@samifouad
Copy link

would be glad to offer any assistance to this initative 😃

I am actively working on a playground based on the tour website code that has a different set of goals ( repo: https://github.com/samifouad/linkhash, web: https://linkha.sh ), but I'd love to see an official one

feel free to pluck anything out of there you might find useful

@isaacharrisholt
Copy link
Contributor

Thanks so much @samifouad!

@lpil lpil transferred this issue from gleam-lang/gleam Jul 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Contributions encouraged
Projects
None yet
Development

No branches or pull requests

4 participants