-
-
Notifications
You must be signed in to change notification settings - Fork 7
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
Initial development of Gleam playground #1
Merged
Merged
Changes from 13 commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
6f27f1a
copy tour
isaacharrisholt 45f1c76
playground: get SSG working
isaacharrisholt e00ea07
remove public
isaacharrisholt da853ad
playground: set up sharing, compilation target button html
isaacharrisholt 406fbeb
playground: add javascript compilation output
isaacharrisholt cc61aef
playground: add javascript compilation colouring
isaacharrisholt 4b490fb
playground: add sharing functionality
isaacharrisholt a96ba5d
playground: fix mobile css bug
isaacharrisholt 5cfe9f0
playground: rename css file
isaacharrisholt 2daa5d8
playground: remove about page
isaacharrisholt 667e477
playground: make hash versioned
isaacharrisholt da61c84
playground: code cleanup and titles
isaacharrisholt f394876
ci: yoink ci from language tour
isaacharrisholt e4438b4
playground: address comments
isaacharrisholt 71fd636
playground: fix warning bugs
isaacharrisholt a5c1d6c
playground: add compiled erlang
isaacharrisholt b40e055
encode title uri component
isaacharrisholt 1d63b23
simplify code
isaacharrisholt File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
name: deploy | ||
on: | ||
push: | ||
branches: ["main"] | ||
|
||
workflow_dispatch: | ||
|
||
permissions: | ||
contents: read | ||
pages: write | ||
id-token: write | ||
|
||
concurrency: | ||
group: "pages" | ||
cancel-in-progress: false | ||
|
||
jobs: | ||
deploy: | ||
environment: | ||
name: github-pages | ||
url: ${{ steps.deployment.outputs.page_url }} | ||
|
||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- uses: erlef/setup-beam@v1 | ||
with: | ||
otp-version: "26.0.2" | ||
gleam-version: "1.1.0" | ||
rebar3-version: "3" | ||
|
||
- name: Download WASM version of Gleam compiler | ||
run: ./bin/download-compiler | ||
- name: Build site | ||
run: gleam run | ||
|
||
- name: Setup Pages | ||
uses: actions/configure-pages@v4 | ||
- name: Upload artifact | ||
uses: actions/upload-pages-artifact@v3 | ||
with: | ||
path: 'public' | ||
- name: Deploy to GitHub Pages | ||
id: deployment | ||
uses: actions/deploy-pages@v4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,4 @@ | |
*.ez | ||
/build | ||
erl_crash.dump | ||
public/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,13 @@ | ||
# playground | ||
# The Gleam Playground | ||
|
||
[![Package Version](https://img.shields.io/hexpm/v/playground)](https://hex.pm/packages/playground) | ||
[![Hex Docs](https://img.shields.io/badge/hex-docs-ffaff3)](https://hexdocs.pm/playground/) | ||
An interactive playground for the Gleam language. | ||
|
||
```sh | ||
gleam add playground | ||
``` | ||
```gleam | ||
import playground | ||
|
||
pub fn main() { | ||
// TODO: An example of the project in use | ||
} | ||
``` | ||
# Download a wasm version of the Gleam compiler | ||
./bin/download-compiler | ||
|
||
Further documentation can be found at <https://hexdocs.pm/playground>. | ||
# Build the site | ||
gleam run | ||
|
||
## Development | ||
|
||
```sh | ||
gleam run # Run the project | ||
gleam test # Run the tests | ||
gleam shell # Run an Erlang shell | ||
# It's now all the in `public/` directory | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#!/bin/sh | ||
|
||
set -eu | ||
|
||
# Ensure you update the CI Gleam version to match this | ||
VERSION="v1.1.0" | ||
|
||
rm -fr wasm-compiler | ||
mkdir wasm-compiler | ||
cd wasm-compiler | ||
curl -L "https://github.com/gleam-lang/gleam/releases/download/$VERSION/gleam-$VERSION-browser.tar.gz" | tar xz | ||
cd .. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# This file was generated by Gleam | ||
# You typically do not need to edit this file | ||
|
||
packages = [ | ||
{ name = "filepath", version = "0.2.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "filepath", source = "hex", outer_checksum = "FC1B1B29438A5BA6C990F8047A011430BEC0C5BA638BFAA62718C4EAEFE00435" }, | ||
{ name = "gleam_stdlib", version = "0.36.0", build_tools = ["gleam"], requirements = [], otp_app = "gleam_stdlib", source = "hex", outer_checksum = "C0D14D807FEC6F8A08A7C9EF8DFDE6AE5C10E40E21325B2B29365965D82EB3D4" }, | ||
{ name = "gleeunit", version = "1.1.2", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleeunit", source = "hex", outer_checksum = "72CDC3D3F719478F26C4E2C5FED3E657AC81EC14A47D2D2DEBB8693CA3220C3B" }, | ||
{ name = "htmb", version = "1.1.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "htmb", source = "hex", outer_checksum = "30D448F0E15DFCF7283AAAC2F351D77B9D54E318219C9FDDB1877572B67C27B7" }, | ||
{ name = "simplifile", version = "1.5.1", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "simplifile", source = "hex", outer_checksum = "C44DB387524F90DC42142699C78C850003289D32C7C99C7D32873792A299CDF7" }, | ||
{ name = "snag", version = "0.3.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "snag", source = "hex", outer_checksum = "54D32E16E33655346AA3E66CBA7E191DE0A8793D2C05284E3EFB90AD2CE92BCC" }, | ||
] | ||
|
||
[requirements] | ||
filepath = { version = "~> 0.1" } | ||
gleam_stdlib = { version = ">= 0.34.0 and < 2.0.0" } | ||
gleeunit = { version = ">= 1.0.0 and < 2.0.0" } | ||
htmb = { version = "~> 1.1" } | ||
simplifile = { version = "~> 1.0" } | ||
snag = { version = "~> 0.2" } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
<article id="playground-container"> | ||
<section id="playground"> | ||
<div id="playground-header"> | ||
<input | ||
id="title-input" | ||
type="text" | ||
name="title" | ||
value="A Gleam Playground project" | ||
> | ||
<button id="share-button" type="share">Share</button> | ||
</div> | ||
|
||
<div id="playground-content"> | ||
<section id="editor"> | ||
<div id="editor-target"></div> | ||
</section> | ||
|
||
<div id="output-container"> | ||
<div id="tabs"> | ||
<label class="tab"> | ||
<p>Output</p> | ||
<input | ||
id="output-radio" | ||
type="radio" | ||
name="output-display" | ||
value="output" | ||
hidden | ||
checked | ||
> | ||
</label> | ||
<!-- TODO: enable Erlang when stdlib is precompiled --> | ||
<!-- <label class="tab"> --> | ||
<!-- <p>Compiled Erlang</p> --> | ||
<!-- <input type="radio" name="output-display" value="erlang" hidden> --> | ||
<!-- </label> --> | ||
<label class="tab"> | ||
<p>Compiled JavaScript</p> | ||
<input | ||
id="compiled-javascript-radio" | ||
type="radio" | ||
name="output-display" | ||
value="javascript" | ||
hidden | ||
> | ||
</label> | ||
</div> | ||
|
||
<aside id="output" class="output"></aside> | ||
<aside id="compiled-javascript" class="output language-javascript"></aside> | ||
</div> | ||
</div> | ||
</section> | ||
</article> | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Move this into Gleam code please 🙏
The tour uses text files for content as a sort of poor-person's CMS. This is not a content based site so let's keep everything in Gleam.