Skip to content

Commit e2d2bee

Browse files
Replace roc-lang.org with WIP site
1 parent cc41f3a commit e2d2bee

36 files changed

+1317
-5561
lines changed

.gitignore

+5-4
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,6 @@ roc_linux_x86_64.tar.gz
6161
# nix
6262
result
6363

64-
# tutorial
65-
www/src/roc-tutorial
66-
6764
# Only keep Cargo.lock dependencies for the main compiler.
6865
# Examples and test only crates should be fine to be unlocked.
6966
# This remove unneccessary lock file versioning.
@@ -77,7 +74,11 @@ www/src/roc-tutorial
7774
# checkmate
7875
checkmate_*.json
7976

77+
www/build/
78+
www/main
79+
www/dist
80+
8081
# ignore the examples folder in the WIP website, this is copied from roc-lang/examples in when building the site
81-
www/wip_new_website/content/examples
82+
www/content/examples
8283
www/examples-main.zip
8384
www/examples-main

www/.gitignore

-3
This file was deleted.
File renamed without changes.

www/README.md

+29-4
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,37 @@
11
# www.roc-lang.org
22

3-
To view the website after you've made a change, execute:
3+
## Prerequisites
4+
5+
- Linux or MacOS operating system, Windows users can use linux through WSL.
6+
- Install [git](https://chat.openai.com/share/71fb3ae6-80d7-478c-8a27-a36aaa5ba921)
7+
- Install [nix](https://nixos.org/download.html)
8+
9+
## Building the website from scratch
10+
411
```bash
12+
git clone https://github.com/roc-lang/roc.git
13+
cd roc
14+
nix develop
515
./www/build.sh
6-
cd www/build
7-
simple-http-server --nocache --index # already installed if you're using `nix develop`, otherwise use `cargo install simple-http-server`
16+
# make the roc command available
17+
export PATH="$(pwd)/target/release/:$PATH"
18+
bash build-dev-local.sh
19+
```
20+
21+
Open http://0.0.0.0:8080 in your browser.
22+
23+
## After you've made a change locally
24+
25+
In the terminal where the web server is running:
26+
1. kill the server with Ctrl+C
27+
2. re-run the build script
28+
3. refresh the page in your browser
29+
30+
To view the website after you've made a change, execute:
31+
```bash
32+
bash build-dev-local.sh
833
```
9-
Open http://0.0.0.0:8000 in your browser.
34+
Open http://0.0.0.0:8080 in your browser.
1035

1136

1237

www/wip_new_website/build-dev-local.sh www/build-dev-local.sh

+3-4
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,8 @@ DIR="$(dirname "$0")"
1111
cd "$DIR" || exit
1212

1313
rm -rf dist/
14-
cp -r ../build dist/
15-
mkdir -p dist/wip
16-
roc run main.roc -- content/ dist/wip/
17-
cp -r static/* dist/wip/
14+
cp -r build dist/
15+
cp -r public/* dist/
16+
roc run main.roc -- content/ dist/
1817

1918
npx http-server dist/ -p 8080 -c-1 --cors

www/build.sh

+6-20
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,15 @@ cd $SCRIPT_RELATIVE_DIR
1717

1818
rm -rf build/
1919
cp -r public/ build/
20-
mkdir build/wip # for WIP site
2120

2221
# download the latest code for the examples
2322
echo 'Downloading latest examples...'
2423
curl -fLJO https://github.com/roc-lang/examples/archive/refs/heads/main.zip
2524
unzip examples-main.zip
26-
cp -R examples-main/examples/ wip_new_website/content/examples/
25+
cp -R examples-main/examples/ content/examples/
2726

28-
# relace links in wip_new_website/content/examples/index.md to work on the WIP site
29-
sed -i 's|](/|](/wip/examples/|g' wip_new_website/content/examples/index.md
27+
# relace links in content/examples/index.md to work on the WIP site
28+
sed -i '' 's|](/|](/examples/|' content/examples/index.md
3029

3130
# clean up examples artifacts
3231
rm -rf examples-main examples-main.zip
@@ -48,11 +47,10 @@ curl -fLJO https://github.com/roc-lang/roc/archive/www.tar.gz
4847
# Download the latest pre-built Web REPL as a zip file. (Build takes longer than Netlify's timeout.)
4948
REPL_TARFILE="roc_repl_wasm.tar.gz"
5049
curl -fLJO https://github.com/roc-lang/roc/releases/download/nightly/$REPL_TARFILE
50+
mkdir repl
5151
tar -xzf $REPL_TARFILE -C repl
52-
tar -xzf $REPL_TARFILE -C wip # note we also need this for WIP repl
5352
rm $REPL_TARFILE
5453
ls -lh repl
55-
ls -lh wip
5654

5755
popd
5856

@@ -77,9 +75,6 @@ rm -rf roc_nightly roc_releases.json
7775

7876
# we use `! [ -v GITHUB_TOKEN_READ_ONLY ];` to check if we're on a netlify server
7977
if ! [ -v GITHUB_TOKEN_READ_ONLY ]; then
80-
echo 'Building tutorial.html from tutorial.md...'
81-
mkdir www/build/tutorial
82-
8378
cargo build --release --bin roc
8479

8580
roc=target/release/roc
@@ -96,19 +91,12 @@ else
9691
mv roc_nightly* roc_nightly
9792

9893
roc='./roc_nightly/roc'
99-
100-
echo 'Building tutorial.html from tutorial.md...'
101-
mkdir www/build/tutorial
10294
fi
10395

10496
$roc version
105-
$roc run www/generate_tutorial/src/tutorial.roc -- www/generate_tutorial/src/input/ www/build/tutorial/
106-
mv www/build/tutorial/tutorial.html www/build/tutorial/index.html
10797

108-
# For WIP site
109-
echo 'Building WIP site...'
110-
$roc run www/wip_new_website/main.roc -- www/wip_new_website/content/ www/build/wip/
111-
cp -r www/wip_new_website/static/* www/build/wip/
98+
echo 'Building site markdown content'
99+
$roc run www/main.roc -- www/content/ www/build/
112100

113101
# cleanup
114102
rm -rf roc_nightly roc_releases.json
@@ -153,5 +141,3 @@ if [ -v GITHUB_TOKEN_READ_ONLY ]; then
153141
rm -rf $BASIC_CLI_DIR/generated-docs
154142
done <<< "$VERSION_NUMBERS"
155143
fi
156-
157-
popd
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

www/wip_new_website/content/index.md www/content/index.md

+7-7
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,21 @@
1212

1313
<section class="home-goals-container" aria-label="Roc's Design: Fast, Friendly, Functional">
1414
<div role="presentation" class="home-goals-column">
15-
<a href="/wip/fast" class="home-goals-content">
15+
<a href="/fast" class="home-goals-content">
1616
<h3 class="home-goals-title">Fast</h3>
1717
<p class="home-goals-description">Roc code is designed to build fast and <span class="nowrap">run fast</span>. It compiles to machine code or WebAssembly.</p>
1818
<p class="home-goals-learn-more">What does <i>fast</i> mean here?</p>
1919
</a>
2020
</div>
2121
<div role="presentation" class="home-goals-column">
22-
<a href="/wip/friendly" class="home-goals-content">
22+
<a href="/friendly" class="home-goals-content">
2323
<h3 class="home-goals-title">Friendly</h3>
2424
<p class="home-goals-description">Roc’s syntax, semantics, and included toolset all prioritize user-friendliness.</p>
2525
<p class="home-goals-learn-more">What does <i>friendly</i> mean here?</p>
2626
</a>
2727
</div>
2828
<div role="presentation" class="home-goals-column">
29-
<a href="/wip/functional" class="home-goals-content">
29+
<a href="/functional" class="home-goals-content">
3030
<h3 class="home-goals-title">Functional</h3>
3131
<p class="home-goals-description">
3232
Roc has a small number of simple language primitives. It’s a single-paradigm <span class="nowrap">functional language.</span></p>
@@ -38,7 +38,7 @@
3838
<section id="try-roc">
3939
<h2><a href="#try-roc">Try Roc</a></h2>
4040

41-
<div id="homepage-repl-container" role="presentation">
41+
<div id="repl-container" role="presentation">
4242
<div id="repl-description" role="presentation">
4343
<p>You can try Roc using this read-eval-print loop (<a href="https://en.wikipedia.org/wiki/Read%E2%80%93eval%E2%80%93print_loop">REPL</a>), which is running in your browser in <a href="https://webassembly.org">WebAssembly</a>.</p>
4444
<p><code>Shift-Enter</code> adds a newline.</p>
@@ -57,7 +57,7 @@
5757
<textarea aria-label="Input Roc code here, then press Enter to submit it to the REPL" rows="5" id="source-input" placeholder="Enter some Roc code here."></textarea>
5858
</div>
5959
</div>
60-
<script type="module" src="/wip/site.js"></script>
60+
<script type="module" src="/site.js"></script>
6161
</section>
6262

6363
## [Examples](#examples) {#examples}
@@ -75,7 +75,7 @@ Here are some examples of how it can be used today.
7575
<pre><samp class="code-snippet">main <span class="kw">=</span>
7676
Stdout<span class="punctuation section">.</span>line <span class="literal">"Hello!"</span></samp></pre>
7777
<p>You can use Roc to create scripts and command-line interfaces (CLIs). The compiler produces binary executables, so Roc programs can run on devices that don't have Roc itself installed.</p>
78-
<p>As an example, the HTML for this website is generated using a simple Roc script. You can see <a href="https://github.com/roc-lang/roc/blob/main/www/wip_new_website/main.roc">the code for it</a> in the main Roc code repository.</p>
78+
<p>As an example, the HTML for this website is generated using a simple Roc script. You can see <a href="https://github.com/roc-lang/roc/blob/main/www/generate_website/main.roc">the code for it</a> in the main Roc code repository.</p>
7979
<p>If you’re looking for a starting point for building a command-line program in Roc, <a href="https://github.com/roc-lang/basic-cli">basic-cli</a> is a popular platform to check out.</p>
8080
</div>
8181
<div role="presentation" class="home-examples-column">
@@ -98,7 +98,7 @@ log(<span class="string">`Roc says </span><span class="kw">${</span>fn()<span cl
9898
</div>
9999

100100
### [Other Examples](#other-examples) {#other-examples}
101-
You can find more use cases and examples on the [examples page](/wip/examples)!
101+
You can find more use cases and examples on the [examples page](/examples)!
102102
</section>
103103

104104

File renamed without changes.

www/content/repl/index.md

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
2+
# The rockin’ Roc REPL
3+
4+
<div id="repl-container" role="presentation">
5+
<div id="repl" role="presentation">
6+
<code class="history">
7+
<div id="repl-intro-text">Enter an expression to evaluate, or a definition (like <span class="color-blue">x = 1</span>) to use later.</div>
8+
<div id="history-text" aria-live="polite"></div>
9+
</code>
10+
<div id="repl-prompt" role="presentation">»</div>
11+
<textarea aria-label="Input Roc code here, then press Enter to submit it to the REPL" rows="5" id="source-input" placeholder="Enter some Roc code here."></textarea>
12+
</div>
13+
</div>
14+
<script type="module" src="/site.js"></script>
15+
</section>
File renamed without changes.

www/generate_tutorial/.gitignore

-2
This file was deleted.

0 commit comments

Comments
 (0)