Skip to content

Commit

Permalink
boot
Browse files Browse the repository at this point in the history
  • Loading branch information
leostera committed Feb 7, 2024
1 parent 7267011 commit c43b035
Show file tree
Hide file tree
Showing 14 changed files with 2,753 additions and 0 deletions.
53 changes: 53 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Deploy static content to Pages

on:
push:
branches: ['main']

workflow_dispatch:

permissions:
contents: read
pages: write
id-token: write

concurrency:
group: 'pages'
cancel-in-progress: true

jobs:
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Node
uses: actions/setup-node@v3
with:
node-version: 18
cache: 'npm'
- name: Set-up OCaml
uses: ocaml/setup-ocaml@v2
with:
ocaml-compiler: "5.1"
allow-prerelease-opam: true
- run: opam install . --deps-only --with-test
- run: opam exec -- dune build
- run: opam exec -- dune test
- name: Install dependencies
run: npm install
- name: Build
run: npm run build
- name: Setup Pages
uses: actions/configure-pages@v3
- name: Upload artifact
uses: actions/upload-pages-artifact@v2
with:
# Upload dist repository
path: './dist'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
_build
node_modules
dist
3 changes: 3 additions & 0 deletions .ocamlformat
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
profile = default
let-binding-spacing=double-semicolon
version = 0.26.1
171 changes: 171 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,171 @@
<h1 align="center">
website</br>
<span style="font-size: 1.25rem">
powered by
✨<a href="https://github.com/dmmulroy/create-melange-app">create-melange-app✨</a>
</span>
</h1>

### Table of Contents

- [Getting Started](#getting-started)
- [Your project layout](#your-project-layout)
- [Installing OCaml packages](#installing-OCaml-packages)
- [Getting Help](#getting-help)

## Getting Started

Welcome to your `Melange` & `OCaml` app!

### Running your application

To run your application and start a dev server with hot module reloading, simply
run:

```sh
npm run dev
```

### Building your application

Building your application is as simple as running:

```sh
npm run build
```

This will handle running `Melange`'s build process and bundling your application
with `Vite`. Your bundled application and output will be located in `./dist`
after the build process completes.

## Your project layout

The following is a high level view of your project and application.
Many of these files will contain additional comments, explanations, examples,
and help for learning and getting started with `OCaml` and `Melange.`

```
website
├── src
│ │ // This is a React Component and the entry point to your application
│   ├── App.re
│ │
│ │ // This is an example of how you can create additional React Components
│   ├── Configuration.re
│ │
│ │ // This directory is home to your bindings. Bindings are code you'll
│ │ // write to "bind" to and communicate with external JavaScript code.
│   ├── bindings
│   │ │
│   │ │ // This file controls exporting bindings that you write and makes
│   │ │ // them available to the rest of your project/code
│   │   ├── bindings.re
│   │ │
│   │ │ // This is an example of writing bindings to JavaScript DOM APIs
│   │   ├── browser.re
│   │ │
│   │ │ // This dune file configures your bindings library. In OCaml,
│   │ │ // each library has its own dune file. Generally, each library is
│   │ │ // contained in its own directory and is the standard way of
│   │ │ // organizing your code.
│   │   └── dune
│   │
│   │ // This directory is an example of a OCaml library. It contains
│   │ // code and modules used to interact with your projects configuration.
│   ├── create_melange_app
│   │   │
│   │ │ // This file controls exporting the modules within the
│   │ │ // `create_melange_app` library, making them available to the rest
│   │ │ // of your project/code.
│   │   ├── create_melange_app.re
│   │   │
│   │   │ // These are individual OCaml modules that compose the
│   │   │ // `create_melange_app` library.
│   │   ├── node_package_manager.re
│   │   ├── bundler.re
│   │   ├── configuration.re
│   │   │
│   │ │ // This `dune` file configures the `create_melange_app` library.
│   │   └── dune
│ │
│ │ // This `dune` file configures your root/application library. It wraps
│ │ // and composes all of the libraries that are used in your application.
│ │ // When you add new libraries to your project, you will need to add
│ │ // them to the `libraries` stanza in this file.
│   └── dune
│ // This directory is generated by 'Dune', OCaml's build tool.
│ // It contains compiled files and other artifacts from the build process.
│ // Note: This is _not_ where your application bundle/output/dist will be.
├── _build/
│ // This directory is created by `Opam`, OCaml's package manager. It
│ // contains your "local switch" and packages for your OCaml
│ // environment, specific to this project. You can think of the `_opam`
│ // folder and switches as OCaml's `node_modules`.
├── _opam/
│ // This is where your applications bundle or output will be located after
│ // running `npm run build`.
├── dist/
│ // This `dune` file configures `Melange`'s build process and settings. In
│ // addition, it also configures `Vite` to be ran by and integrated with
│ // `Dune`.
├── dune
│ // This file contains the overall configuration for your project, such as
│ // the name, version, metadata, and dependencies other settings understood
│ // by `dune`. You can think of this file as OCaml's `package.json`.
├── dune-project
│ // This file is generated by `Dune` and should not be manually edited. It
│ // Similar to your `dune-project` file, it contains dependencies and
│ // configuration settings for building your project. It is also similar to
│ // `package.json`. In the near future, `Dune` and `Opam` will be more
│ // tightly integrated as one tool.
├── first_try.opam
├── index.html
├── package-lock.json
├── package.json
├── vite.config.js
├── README
└── node_modules/
```

## Installing OCaml packages

Installing OCaml packages is easy, but we have to use a separate
CLI ([for the time being](https://github.com/dmmulroy/create-melange-app/issues/61)). To install dependencies, we are
going to use `opam`, which is OCaml's package manager. You can
search for dependencies and packages on
[OCaml.org](https://ocaml.org/packages/search?q=).

There are [some requirements](https://discuss.ocaml.org/t/whats-possible-with-melange/13806/3?u=dmmulroy) to use a package with `Melange` you should read
about. That being said, once you find a package you want to install you can
do the following steps:

1. Add the library to your `dune-project`'s `depends` section
2. Run the following commands

```sh
eval $(opam env) # This activates your local switch in your shell
dune build website.opam # This will regenerate your `opam` file
opam update # This will ensure `opam` can see the most recent versions of packages
opam install . --deps-only --yes # This will install your new packages
```

## Getting Help

- [Melange for React Devs](https://react-book.melange.re/) - This is an amazing
resource for learing Melange, OCaml, and ReasonML even if you're not using React
- [OCaml's official site](https://ocaml.org)
- [ReasonML's official site](https://reasonml.github.io/)
- [Melange Docs](https://melange.re)
- [OCaml Discuss Forums](https://discuss.ocaml.org/)
- [The Caravan Discord Server](https://discord.gg/fNvVdsUWHE) - This is where
the maintainers of `create-melange-app` hang out!
- [OCaml Discord Server](https://discord.gg/Qpzjmc4t)
- [ReasonML Discord Server](https://discord.gg/jPEH58TU)

25 changes: 25 additions & 0 deletions dune
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
(dirs :standard \ node_modules)
(alias
(name all)
(deps
(alias_rec vite)))

(rule
(alias vite)
(targets (dir dist))
(deps
(alias_rec website)
(:vite ./vite.config.js)
(:index_html ./index.html))
(action
(system "../../node_modules/.bin/vite build"))
(mode
(promote (until-clean))))

(melange.emit
(target output)
(alias website)
(libraries app)
(module_systems (es6 mjs)))


27 changes: 27 additions & 0 deletions dune-project
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
(lang dune 3.11)
(using melange 0.1)
(using directory-targets 0.1)

(name riot_website)

(source (github riot-ml/website))

(authors "Leandro Ostera <[email protected]>")

(maintainers "Leandro Ostera <[email protected]>")

(license MIT)

; Provides a link to the project's documentation.
(documentation https://github.com/your-username/website)

(package
(name riot_website)
(depends
(dune (>= 3.11))
(melange (>= 2.1.0))
(ocaml (>= 5.1.0))
opam-check-npm-deps
ppx_deriving
(reason (>= 3.10.0))
))
85 changes: 85 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
<!doctype html>
<html lang="en">

<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<script src="https://cdn.tailwindcss.com"></script>
<title>Riot – A multi-core OCaml runtime</title>
<script defer data-domain="riot.ml" src="https://plausible.io/js/script.js"></script>
</head>
<body>
<section id="root" class="flex flex-col w-full">
<nav class="flex flex-row justify-between align-center items-center px-40 py-2 h-[70px] w-full">
<h1 class="font-black text-2xl text-[#ed700d]">Riot</h1>
<div class="flex flex-row justify-between align-center items-center gap-4">
<a target="_blank" class="" href="https://github.com/riot-ml/riot"><span class="icon "><svg width="32" height="32" viewBox="0 0 1792 1792" xmlns="http://www.w3.org/2000/svg"><path class="tk-svg-path" d="M896 128q209 0 385.5 103t279.5 279.5 103 385.5q0 251-146.5 451.5t-378.5 277.5q-27 5-40-7t-13-30q0-3 .5-76.5t.5-134.5q0-97-52-142 57-6 102.5-18t94-39 81-66.5 53-105 20.5-150.5q0-119-79-206 37-91-8-204-28-9-81 11t-92 44l-38 24q-93-26-192-26t-192 26q-16-11-42.5-27t-83.5-38.5-85-13.5q-45 113-8 204-79 87-79 206 0 85 20.5 150t52.5 105 80.5 67 94 39 102.5 18q-39 36-49 103-21 10-45 15t-57 5-65.5-21.5-55.5-62.5q-19-32-48.5-52t-49.5-24l-20-3q-21 0-29 4.5t-5 11.5 9 14 13 12l7 5q22 10 43.5 38t31.5 51l10 23q13 38 44 61.5t67 30 69.5 7 55.5-3.5l23-4q0 38 .5 88.5t.5 54.5q0 18-13 30t-40 7q-232-77-378.5-277.5t-146.5-451.5q0-209 103-385.5t279.5-279.5 385.5-103zm-477 1103q3-7-7-12-10-3-13 2-3 7 7 12 9 6 13-2zm31 34q7-5-2-16-10-9-16-3-7 5 2 16 10 10 16 3zm30 45q9-7 0-19-8-13-17-6-9 5 0 18t17 7zm42 42q8-8-4-19-12-12-20-3-9 8 4 19 12 12 20 3zm57 25q3-11-13-16-15-4-19 7t13 15q15 6 19-6zm63 5q0-13-17-11-16 0-16 11 0 13 17 11 16 0 16-11zm58-10q-2-11-18-9-16 3-14 15t18 8 14-14z" fill="#000"></path></svg></span></a>
<a target="_blank" class="navbar-item navbar-icon tk-social" href="https://discord.gg/59Khzk2UBW"><span class="icon "><svg width="32" height="32" viewBox="0 0 245 240" xmlns="http://www.w3.org/2000/svg"><path class="tk-svg-path" fill="#000" d="M104.4 103.9c-5.7 0-10.2 5-10.2 11.1s4.6 11.1 10.2 11.1c5.7 0 10.2-5 10.2-11.1.1-6.1-4.5-11.1-10.2-11.1zM140.9 103.9c-5.7 0-10.2 5-10.2 11.1s4.6 11.1 10.2 11.1c5.7 0 10.2-5 10.2-11.1s-4.5-11.1-10.2-11.1z"></path><path class="tk-svg-path" fill="#000" d="M189.5 20h-134C44.2 20 35 29.2 35 40.6v135.2c0 11.4 9.2 20.6 20.5 20.6h113.4l-5.3-18.5 12.8 11.9 12.1 11.2 21.5 19V40.6c0-11.4-9.2-20.6-20.5-20.6zm-38.6 130.6s-3.6-4.3-6.6-8.1c13.1-3.7 18.1-11.9 18.1-11.9-4.1 2.7-8 4.6-11.5 5.9-5 2.1-9.8 3.5-14.5 4.3-9.6 1.8-18.4 1.3-25.9-.1-5.7-1.1-10.6-2.7-14.7-4.3-2.3-.9-4.8-2-7.3-3.4-.3-.2-.6-.3-.9-.5-.2-.1-.3-.2-.4-.3-1.8-1-2.8-1.7-2.8-1.7s4.8 8 17.5 11.8c-3 3.8-6.7 8.3-6.7 8.3-22.1-.7-30.5-15.2-30.5-15.2 0-32.2 14.4-58.3 14.4-58.3 14.4-10.8 28.1-10.5 28.1-10.5l1 1.2c-18 5.2-26.3 13.1-26.3 13.1s2.2-1.2 5.9-2.9c10.7-4.7 19.2-6 22.7-6.3.6-.1 1.1-.2 1.7-.2 6.1-.8 13-1 20.2-.2 9.5 1.1 19.7 3.9 30.1 9.6 0 0-7.9-7.5-24.9-12.7l1.4-1.6s13.7-.3 28.1 10.5c0 0 14.4 26.1 14.4 58.3 0 0-8.5 14.5-30.6 15.2z"></path></svg></span></a>
</div>
</nav>
<section id="hero" class="flex flex-col justify-start align-center items-center px-10 py-20 gap-5 m-auto">
<h2 class="font-bold text-8xl text-center"> The OCaml runtime <br/>
<span class="text-[#ed700d]">for software artisans.<span> </h2>
<p class="font-light text-xl w-[900px]">
Riot is a multi-core runtime for the OCaml programming language that
brings Erlang-style concurrency to OCaml via lightweight processes and
message passing. On top of it we're building all the components you
need to build reliable network services and applications.
</p>
</section>
<section id="stack" class="flex flex-col justify-start align-start items-start px-40 py-20 gap-5 w-full">
<h3 class="font-bold text-6xl"> The Stack </h3>
<p class="font-light text-xl">
Apps aren't built in the void, so we are laying a foundation you can
trust – freeing you to focus on creating amazing apps.
</p>

<h3 class="font-bold text-3xl mt-8"> riot scheduler </h3>
<p class="font-light text-xl">
The scheduler includes processes, message passing, and supervision
trees across all cores. It ships with multicore friendly network and
file system I/O, timers, and more.
</p>

<h3 class="font-bold text-3xl mt-8"> gluon </h3>
<p class="font-light text-xl">
A minimal, portable, and <i>fast</i> API on top of the
operating-system's evented I/O API.
</p>

<h3 class="font-bold text-3xl mt-8"> bytestring </h3>
<p class="font-light text-xl">
Supercharged strings with efficient, ergonomic pattern matching. Ideal
for building fast parsers over streamed data.
</p>

<h3 class="font-bold text-3xl mt-8"> io </h3>
<p class="font-light text-xl">
Ergonomic, composable read/write streams for efficient IO. IO lets the
Riot stack share a common way of reading and writing from any source
into any destination.
</p>

</section>
<footer class="flex flex-col bg-black text-white pt-20 pb-60 justify-center items-start px-40 align-center gap-10">
<div class="flex flex-col gap-5">
<h1 class="font-black text-2xl">Riot</h1>
<div class="flex flex-row justify-between align-center items-center gap-4">
<a target="_blank" class="" href="https://github.com/riot-ml/riot"><span class="icon "><svg width="32" height="32" viewBox="0 0 1792 1792" xmlns="http://www.w3.org/2000/svg"><path class="tk-svg-path" d="M896 128q209 0 385.5 103t279.5 279.5 103 385.5q0 251-146.5 451.5t-378.5 277.5q-27 5-40-7t-13-30q0-3 .5-76.5t.5-134.5q0-97-52-142 57-6 102.5-18t94-39 81-66.5 53-105 20.5-150.5q0-119-79-206 37-91-8-204-28-9-81 11t-92 44l-38 24q-93-26-192-26t-192 26q-16-11-42.5-27t-83.5-38.5-85-13.5q-45 113-8 204-79 87-79 206 0 85 20.5 150t52.5 105 80.5 67 94 39 102.5 18q-39 36-49 103-21 10-45 15t-57 5-65.5-21.5-55.5-62.5q-19-32-48.5-52t-49.5-24l-20-3q-21 0-29 4.5t-5 11.5 9 14 13 12l7 5q22 10 43.5 38t31.5 51l10 23q13 38 44 61.5t67 30 69.5 7 55.5-3.5l23-4q0 38 .5 88.5t.5 54.5q0 18-13 30t-40 7q-232-77-378.5-277.5t-146.5-451.5q0-209 103-385.5t279.5-279.5 385.5-103zm-477 1103q3-7-7-12-10-3-13 2-3 7 7 12 9 6 13-2zm31 34q7-5-2-16-10-9-16-3-7 5 2 16 10 10 16 3zm30 45q9-7 0-19-8-13-17-6-9 5 0 18t17 7zm42 42q8-8-4-19-12-12-20-3-9 8 4 19 12 12 20 3zm57 25q3-11-13-16-15-4-19 7t13 15q15 6 19-6zm63 5q0-13-17-11-16 0-16 11 0 13 17 11 16 0 16-11zm58-10q-2-11-18-9-16 3-14 15t18 8 14-14z" fill="#fff"></path></svg></span></a>
<a target="_blank" class="navbar-item navbar-icon tk-social" href="https://discord.gg/59Khzk2UBW"><span class="icon "><svg width="32" height="32" viewBox="0 0 245 240" xmlns="http://www.w3.org/2000/svg"><path class="tk-svg-path" fill="#fff" d="M104.4 103.9c-5.7 0-10.2 5-10.2 11.1s4.6 11.1 10.2 11.1c5.7 0 10.2-5 10.2-11.1.1-6.1-4.5-11.1-10.2-11.1zM140.9 103.9c-5.7 0-10.2 5-10.2 11.1s4.6 11.1 10.2 11.1c5.7 0 10.2-5 10.2-11.1s-4.5-11.1-10.2-11.1z"></path><path class="tk-svg-path" fill="#fff" d="M189.5 20h-134C44.2 20 35 29.2 35 40.6v135.2c0 11.4 9.2 20.6 20.5 20.6h113.4l-5.3-18.5 12.8 11.9 12.1 11.2 21.5 19V40.6c0-11.4-9.2-20.6-20.5-20.6zm-38.6 130.6s-3.6-4.3-6.6-8.1c13.1-3.7 18.1-11.9 18.1-11.9-4.1 2.7-8 4.6-11.5 5.9-5 2.1-9.8 3.5-14.5 4.3-9.6 1.8-18.4 1.3-25.9-.1-5.7-1.1-10.6-2.7-14.7-4.3-2.3-.9-4.8-2-7.3-3.4-.3-.2-.6-.3-.9-.5-.2-.1-.3-.2-.4-.3-1.8-1-2.8-1.7-2.8-1.7s4.8 8 17.5 11.8c-3 3.8-6.7 8.3-6.7 8.3-22.1-.7-30.5-15.2-30.5-15.2 0-32.2 14.4-58.3 14.4-58.3 14.4-10.8 28.1-10.5 28.1-10.5l1 1.2c-18 5.2-26.3 13.1-26.3 13.1s2.2-1.2 5.9-2.9c10.7-4.7 19.2-6 22.7-6.3.6-.1 1.1-.2 1.7-.2 6.1-.8 13-1 20.2-.2 9.5 1.1 19.7 3.9 30.1 9.6 0 0-7.9-7.5-24.9-12.7l1.4-1.6s13.7-.3 28.1 10.5c0 0 14.4 26.1 14.4 58.3 0 0-8.5 14.5-30.6 15.2z"></path></svg></span></a>
</div>
</div>
<div>
Built with 🧡 by
<a href="https://x.com/leostera" class="font-black">@leostera</a>
with the help of
<a href="https://github.com/riot-ml/riot/graphs/contributors" class="font-black">our contributors</a>
.
</div>
</footer>
</section>
<!-- This path is relative to the _build/default directory -->
<script type="module" src="./output/src/main.mjs"></script>
</body>

</html>
Loading

0 comments on commit c43b035

Please sign in to comment.