Skip to content

Commit

Permalink
Convert most examples to opam
Browse files Browse the repository at this point in the history
Reason examples still use esy.
  • Loading branch information
aantron committed Nov 29, 2023
1 parent 59abca6 commit 20f62d2
Show file tree
Hide file tree
Showing 157 changed files with 387 additions and 918 deletions.
4 changes: 2 additions & 2 deletions docs/asset/log-sanitized.html
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@
<body>

<pre><code><b>$ cd example/2-middleware</b>
<b>$ npm install esy && npx esy</b>
<b>$ npx esy start</b>
<b>$ opam install --deps-only --yes .</b>
<b>$ dune exec --root . ./middleware.exe</b>
<span class="dim">08.03.21 22:19:21.126</span> Running at http://localhost:8080
<span class="dim">08.03.21 22:19:21.126</span> Type Ctrl+C to stop
<span class="dim">08.03.21 22:19:24.927</span> dream.log <span class="info">INFO</span> <span class="odd">REQ 1</span> GET / 127.0.0.1:58549 Mozilla/5.0 ...
Expand Down
Binary file modified docs/asset/log-sanitized.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions example/1-hello/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ At startup, Dream prints a message to the log, telling you where to point your
browser. Your terminal probably makes the link clickable.

<pre><code><b>$ cd example/1-hello</b>
<b>$ npm install esy && npx esy</b>
<b>$ npx esy start</b>
<b>$ opam install --deps-only --yes .</b>
<b>$ dune exec --root . ./hello.exe</b>
08.03.21 21:17:21.471 Running at http://localhost:8080
08.03.21 21:17:21.471 Type Ctrl+C to stop
</code></pre>
Expand All @@ -31,7 +31,7 @@ Playground](http://dream.as/1-hello).

If you'd like to copy out the server binary, you can do it like this:

<pre><code><b>$ npx esy cp '#{self.target_dir}/default/hello.exe' .
<pre><code><b>$ cp _build/default/hello.exe .
</b></code></pre>

The name will change as you go through the tutorial examples. It's always the
Expand Down
2 changes: 0 additions & 2 deletions example/1-hello/dune
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
(executable
(name hello)
(libraries dream))

(data_only_dirs _esy esy.lock lib node_modules)
18 changes: 0 additions & 18 deletions example/1-hello/esy.json

This file was deleted.

7 changes: 7 additions & 0 deletions example/1-hello/hello.opam
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
opam-version: "2.0"

depends: [
"ocaml" {>= "4.08.0"}
"dream"
"dune" {>= "2.0.0"}
]
2 changes: 0 additions & 2 deletions example/2-middleware/dune
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
(executable
(name middleware)
(libraries dream))

(data_only_dirs _esy esy.lock lib node_modules)
18 changes: 0 additions & 18 deletions example/2-middleware/esy.json

This file was deleted.

4 changes: 2 additions & 2 deletions example/3-router/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ let () =
```

<pre><code><b>$ cd example/3-router</b>
<b>$ npm install esy && npx esy</b>
<b>$ npx esy start</b></code></pre>
<b>$ opam install --deps-only --yes .</b>
<b>$ dune exec --root . ./router.exe</b></code></pre>

<br>

Expand Down
2 changes: 0 additions & 2 deletions example/3-router/dune
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
(executable
(name router)
(libraries dream))

(data_only_dirs _esy esy.lock lib node_modules)
18 changes: 0 additions & 18 deletions example/3-router/esy.json

This file was deleted.

7 changes: 7 additions & 0 deletions example/3-router/router.opam
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
opam-version: "2.0"

depends: [
"ocaml" {>= "4.08.0"}
"dream"
"dune" {>= "2.0.0"}
]
4 changes: 2 additions & 2 deletions example/4-counter/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ let () =
]
```
<pre><code><b>$ cd example/4-counter</b>
<b>$ npm install esy && npx esy</b>
<b>$ npx esy start</b></code></pre>
<b>$ opam install --deps-only --yes .</b>
<b>$ dune exec --root . ./counter.exe</b></code></pre>

<br>

Expand Down
7 changes: 7 additions & 0 deletions example/4-counter/counter.opam
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
opam-version: "2.0"

depends: [
"ocaml" {>= "4.08.0"}
"dream"
"dune" {>= "2.0.0"}
]
2 changes: 0 additions & 2 deletions example/4-counter/dune
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
(executable
(name counter)
(libraries dream))

(data_only_dirs _esy esy.lock lib node_modules)
18 changes: 0 additions & 18 deletions example/4-counter/esy.json

This file was deleted.

4 changes: 2 additions & 2 deletions example/5-promise/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ let () =
```

<pre><code><b>$ cd example/5-promise</b>
<b>$ npm install esy && npx esy</b>
<b>$ npx esy start</b></code></pre>
<b>$ opam install --deps-only --yes .</b>
<b>$ dune exec --root . ./promise.exe</b></code></pre>

Try it in the [playground](http://dream.as/5-promise).

Expand Down
2 changes: 0 additions & 2 deletions example/5-promise/dune
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,3 @@
(name promise)
(libraries dream)
(preprocess (pps lwt_ppx)))

(data_only_dirs _esy esy.lock lib node_modules)
18 changes: 0 additions & 18 deletions example/5-promise/esy.json

This file was deleted.

7 changes: 7 additions & 0 deletions example/5-promise/promise.opam
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
opam-version: "2.0"

depends: [
"ocaml" {>= "4.08.0"}
"dream"
"dune" {>= "2.0.0"}
]
4 changes: 2 additions & 2 deletions example/6-echo/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ let () =
```

<pre><code><b>$ cd example/6-echo</b>
<b>$ npm install esy && npx esy</b>
<b>$ npx esy start</b></code></pre>
<b>$ opam install --deps-only --yes .</b>
<b>$ dune exec --root . ./echo.exe</b></code></pre>

...or run it in the [playground](http://dream.as/6-echo).

Expand Down
2 changes: 0 additions & 2 deletions example/6-echo/dune
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,3 @@
(name echo)
(libraries dream)
(preprocess (pps lwt_ppx)))

(data_only_dirs _esy esy.lock lib node_modules)
7 changes: 7 additions & 0 deletions example/6-echo/echo.opam
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
opam-version: "2.0"

depends: [
"ocaml" {>= "4.08.0"}
"dream"
"dune" {>= "2.0.0"}
]
18 changes: 0 additions & 18 deletions example/6-echo/esy.json

This file was deleted.

4 changes: 2 additions & 2 deletions example/7-template/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ let () =
```

<pre><code><b>$ cd example/7-template</b>
<b>$ npm install esy && npx esy</b>
<b>$ npx esy start</b></code></pre>
<b>$ opam install --deps-only --yes .</b>
<b>$ dune exec --root . ./template.exe</b></code></pre>

<br>

Expand Down
2 changes: 0 additions & 2 deletions example/7-template/dune
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,3 @@
(targets template.ml)
(deps template.eml.ml)
(action (run dream_eml %{deps} --workspace %{workspace_root})))

(data_only_dirs _esy esy.lock lib node_modules)
18 changes: 0 additions & 18 deletions example/7-template/esy.json

This file was deleted.

7 changes: 7 additions & 0 deletions example/7-template/template.opam
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
opam-version: "2.0"

depends: [
"ocaml" {>= "4.08.0"}
"dream"
"dune" {>= "2.0.0"}
]
4 changes: 2 additions & 2 deletions example/8-debug/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ let () =
```

<pre><code><b>$ cd example/8-debug</b>
<b>$ npm install esy && npx esy</b>
<b>$ npx esy start</b></code></pre>
<b>$ opam install --deps-only --yes .</b>
<b>$ dune exec --root . ./debug.exe</b></code></pre>

<br>

Expand Down
7 changes: 7 additions & 0 deletions example/8-debug/debug.opam
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
opam-version: "2.0"

depends: [
"ocaml" {>= "4.08.0"}
"dream"
"dune" {>= "2.0.0"}
]
2 changes: 0 additions & 2 deletions example/8-debug/dune
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
(executable
(name debug)
(libraries dream))

(data_only_dirs _esy esy.lock lib node_modules)
18 changes: 0 additions & 18 deletions example/8-debug/esy.json

This file was deleted.

4 changes: 2 additions & 2 deletions example/9-error/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ let () =
```

<pre><code><b>$ cd example/9-error</b>
<b>$ npm install esy && npx esy</b>
<b>$ npx esy start</b></code></pre>
<b>$ opam install --deps-only --yes .</b>
<b>$ dune exec --root . ./error.exe</b></code></pre>

Try it in the [playground](http://dream.as/9-error).

Expand Down
2 changes: 0 additions & 2 deletions example/9-error/dune
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,3 @@
(targets error.ml)
(deps error.eml.ml)
(action (run dream_eml %{deps} --workspace %{workspace_root})))

(data_only_dirs _esy esy.lock lib node_modules)
7 changes: 7 additions & 0 deletions example/9-error/error.opam
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
opam-version: "2.0"

depends: [
"ocaml" {>= "4.08.0"}
"dream"
"dune" {>= "2.0.0"}
]
18 changes: 0 additions & 18 deletions example/9-error/esy.json

This file was deleted.

Loading

0 comments on commit 20f62d2

Please sign in to comment.