From c4f0a5f3d7006640fbbc78394983f6d292d682e8 Mon Sep 17 00:00:00 2001 From: Mathieu Barbin Date: Wed, 11 Mar 2026 09:38:59 +0100 Subject: [PATCH 1/6] Pin shas --- .github/workflows/ci.yml | 10 +++++----- .github/workflows/deploy-doc.yml | 10 +++++----- .github/workflows/test-deploy-doc.yml | 6 +++--- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e4979a0..a815cf7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -22,10 +22,10 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@v5 + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - name: Setup OCaml - uses: ocaml/setup-ocaml@v3 + uses: ocaml/setup-ocaml@dec6499fef64fc5d7ed43d43a87251b7b1c306f5 # v3.4.8 with: ocaml-compiler: ${{ matrix.ocaml-compiler }} opam-repositories: | @@ -47,10 +47,10 @@ jobs: run: git diff --exit-code - name: Lint opam - uses: ocaml/setup-ocaml/lint-opam@v3 + uses: ocaml/setup-ocaml/lint-opam@dec6499fef64fc5d7ed43d43a87251b7b1c306f5 # v3.4.8 - name: Lint fmt - uses: ocaml/setup-ocaml/lint-fmt@v3 + uses: ocaml/setup-ocaml/lint-fmt@dec6499fef64fc5d7ed43d43a87251b7b1c306f5 # v3.4.8 - name: Lint doc - uses: ocaml/setup-ocaml/lint-doc@v3 + uses: ocaml/setup-ocaml/lint-doc@dec6499fef64fc5d7ed43d43a87251b7b1c306f5 # v3.4.8 diff --git a/.github/workflows/deploy-doc.yml b/.github/workflows/deploy-doc.yml index aadad5b..11c1def 100644 --- a/.github/workflows/deploy-doc.yml +++ b/.github/workflows/deploy-doc.yml @@ -16,12 +16,12 @@ jobs: shell: bash steps: - name: Checkout - uses: actions/checkout@v5 + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: fetch-depth: 0 - name: Setup Node - uses: actions/setup-node@v5 + uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0 with: node-version: 24 cache: npm @@ -32,7 +32,7 @@ jobs: run: npm ci - name: Setup OCaml - uses: ocaml/setup-ocaml@v3 + uses: ocaml/setup-ocaml@dec6499fef64fc5d7ed43d43a87251b7b1c306f5 # v3.4.8 with: ocaml-compiler: "5.3.x" opam-repositories: | @@ -57,7 +57,7 @@ jobs: run: npm run build - name: Upload Build Artifact - uses: actions/upload-pages-artifact@v3 + uses: actions/upload-pages-artifact@7b1f4a764d45c48632c6b24a0339c27f5614fb0b # v4.0.0 with: path: doc/build @@ -83,4 +83,4 @@ jobs: steps: - name: Deploy to GitHub Pages id: deployment - uses: actions/deploy-pages@v4 + uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e # v4.0.5 diff --git a/.github/workflows/test-deploy-doc.yml b/.github/workflows/test-deploy-doc.yml index 8e171cd..b244566 100644 --- a/.github/workflows/test-deploy-doc.yml +++ b/.github/workflows/test-deploy-doc.yml @@ -16,12 +16,12 @@ jobs: shell: bash steps: - name: Checkout - uses: actions/checkout@v5 + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: fetch-depth: 0 - name: Setup Node - uses: actions/setup-node@v5 + uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0 with: node-version: 24 cache: npm @@ -32,7 +32,7 @@ jobs: run: npm ci - name: Setup OCaml - uses: ocaml/setup-ocaml@v3 + uses: ocaml/setup-ocaml@dec6499fef64fc5d7ed43d43a87251b7b1c306f5 # v3.4.8 with: ocaml-compiler: "5.3.x" opam-repositories: | From 7485fe59451977e75000b05e19c52b4c77236645 Mon Sep 17 00:00:00 2001 From: Mathieu Barbin Date: Wed, 11 Mar 2026 09:44:03 +0100 Subject: [PATCH 2/6] Add third party licenses used in actions --- third-party-license/README.md | 48 +++++++++++++++++++ third-party-license/actions/checkout/LICENSE | 21 ++++++++ .../actions/deploy-pages/LICENSE | 21 ++++++++ .../actions/setup-node/LICENSE | 21 ++++++++ .../actions/upload-pages-artifact/LICENSE | 21 ++++++++ third-party-license/ocaml/setup-ocaml/LICENSE | 21 ++++++++ 6 files changed, 153 insertions(+) create mode 100644 third-party-license/README.md create mode 100644 third-party-license/actions/checkout/LICENSE create mode 100644 third-party-license/actions/deploy-pages/LICENSE create mode 100644 third-party-license/actions/setup-node/LICENSE create mode 100644 third-party-license/actions/upload-pages-artifact/LICENSE create mode 100644 third-party-license/ocaml/setup-ocaml/LICENSE diff --git a/third-party-license/README.md b/third-party-license/README.md new file mode 100644 index 0000000..fe6a497 --- /dev/null +++ b/third-party-license/README.md @@ -0,0 +1,48 @@ +# Third Party Licenses + +This project uses the following third-party GitHub Actions: + +--- + +## actions/checkout + +- Repository: https://github.com/actions/checkout +- License: MIT License + +See the [actions/checkout license](https://github.com/actions/checkout/blob/main/LICENSE) for full details. + +--- + +## actions/deploy-pages + +- Repository: https://github.com/actions/deploy-pages +- License: MIT License + +See the [actions/deploy-pages license](https://github.com/actions/deploy-pages/blob/main/LICENSE) for full details. + +--- + +## actions/setup-node + +- Repository: https://github.com/actions/setup-node +- License: MIT License + +See the [actions/setup-node license](https://github.com/actions/setup-node/blob/main/LICENSE) for full details. + +--- + +## actions/upload-pages-artifact + +- Repository: https://github.com/actions/upload-pages-artifact +- License: MIT License + +See the [actions/upload-pages-artifact license](https://github.com/actions/upload-pages-artifact/blob/main/LICENSE) for full details. + +--- + +## ocaml/setup-ocaml + +- Repository: https://github.com/ocaml/setup-ocaml +- License: MIT License + +See the [ocaml/setup-ocaml license](https://github.com/ocaml/setup-ocaml/blob/master/LICENSE) for full details. diff --git a/third-party-license/actions/checkout/LICENSE b/third-party-license/actions/checkout/LICENSE new file mode 100644 index 0000000..cfbc8bb --- /dev/null +++ b/third-party-license/actions/checkout/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2018 GitHub, Inc. and contributors + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/third-party-license/actions/deploy-pages/LICENSE b/third-party-license/actions/deploy-pages/LICENSE new file mode 100644 index 0000000..8c9e791 --- /dev/null +++ b/third-party-license/actions/deploy-pages/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2021 GitHub, Inc. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/third-party-license/actions/setup-node/LICENSE b/third-party-license/actions/setup-node/LICENSE new file mode 100644 index 0000000..cfbc8bb --- /dev/null +++ b/third-party-license/actions/setup-node/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2018 GitHub, Inc. and contributors + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/third-party-license/actions/upload-pages-artifact/LICENSE b/third-party-license/actions/upload-pages-artifact/LICENSE new file mode 100644 index 0000000..ccc4ac8 --- /dev/null +++ b/third-party-license/actions/upload-pages-artifact/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2022 GitHub, Inc. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/third-party-license/ocaml/setup-ocaml/LICENSE b/third-party-license/ocaml/setup-ocaml/LICENSE new file mode 100644 index 0000000..761ba84 --- /dev/null +++ b/third-party-license/ocaml/setup-ocaml/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2019 Anil Madhavapeddy + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. From 5c68f90653993b3ad91ab9926f18cc16e7d3d5cc Mon Sep 17 00:00:00 2001 From: Mathieu Barbin Date: Wed, 11 Mar 2026 10:12:18 +0100 Subject: [PATCH 3/6] Modernize style and dependencies --- .ocamlformat | 2 +- bin/dune | 4 +- bin/main.ml | 8 +- doc/docs/tutorials/hello-mylib/README.md | 8 +- dune-project | 122 +++-------------------- lib/mylib/src/dune | 25 +---- lib/mylib/src/mylib.ml | 9 +- lib/mylib/src/mylib.mli | 4 +- lib/mylib/test/dune | 25 +---- lib/mylib/test/test__mylib.ml | 4 +- lib/myotherlib/src/dune | 25 +---- lib/myotherlib/src/myotherlib.ml | 9 +- lib/myotherlib/src/myotherlib.mli | 4 +- lib/myotherlib/test/dune | 28 +----- lib/myotherlib/test/test__myotherlib.ml | 4 +- mylib.opam | 18 +--- myotherlib.opam | 17 +--- 17 files changed, 66 insertions(+), 250 deletions(-) diff --git a/.ocamlformat b/.ocamlformat index e6fd08a..1484724 100644 --- a/.ocamlformat +++ b/.ocamlformat @@ -1,3 +1,3 @@ -version=0.27.0 +version=0.28.1 profile=janestreet parse-docstrings=true diff --git a/bin/dune b/bin/dune index ca7dc83..9865a81 100644 --- a/bin/dune +++ b/bin/dune @@ -1,6 +1,6 @@ (executable (name main) - (public_name mylib) + (public_name mybin) (package mylib) (flags :standard -w +a-4-40-41-42-44-45-48-66 -warn-error +a) - (libraries command-unix-for-opam mylib)) + (libraries cmdlang-cmdliner-err-runner dune-build-info mylib)) diff --git a/bin/main.ml b/bin/main.ml index ed85bf8..7baaac9 100644 --- a/bin/main.ml +++ b/bin/main.ml @@ -1 +1,7 @@ -let () = Command_unix_for_opam.run Mylib.main +let version = + match Build_info.V1.version () with + | None -> "n/a" + | Some v -> Build_info.V1.Version.to_string v [@coverage off] +;; + +let () = Cmdlang_cmdliner_err_runner.run Mylib.main ~name:"mybin" ~version diff --git a/doc/docs/tutorials/hello-mylib/README.md b/doc/docs/tutorials/hello-mylib/README.md index 2cebdcc..65e07d6 100644 --- a/doc/docs/tutorials/hello-mylib/README.md +++ b/doc/docs/tutorials/hello-mylib/README.md @@ -8,8 +8,8 @@ the doc up to date. We can make use of code defined in libraries. ```ocaml -# Stdio.print_s Mylib.hello_world -"Hello, World!" +# print_endline Mylib.hello_world +Hello, World! - : unit = () ``` @@ -18,6 +18,6 @@ We can make use of code defined in libraries. We can make use of executables defined in packages. ```bash -$ mylib print -"Hello, World!" +$ mybin print +Hello, World! ``` diff --git a/dune-project b/dune-project index 8585289..bfbcd3e 100644 --- a/dune-project +++ b/dune-project @@ -1,4 +1,4 @@ -(lang dune 3.16) +(lang dune 3.17) (name doc-experiment-docusaurus) @@ -17,75 +17,31 @@ (using mdx 0.4) +(implicit_transitive_deps false) + (package (name mylib) (synopsis "A package named mylib in this project") (depends (ocaml (>= 5.2)) - (base - (and - (>= v0.17) - (< v0.18))) - (command-unix-for-opam - (>= 0.0.2)) - (core - (and - (>= v0.17) - (< v0.18))) - (expect_test_helpers_core - (and - :with-test - (>= v0.17) - (< v0.18))) + (cmdlang + (>= 0.0.9)) + (cmdlang-cmdliner-err-runner + (>= 0.0.16)) + (dune-build-info + (>= 3.17)) (mdx (>= 2.4)) - (ppx_compare - (and - (>= v0.17) - (< v0.18))) - (ppx_enumerate - (and - (>= v0.17) - (< v0.18))) (ppx_expect (and :with-test (>= v0.17) (< v0.18))) - (ppx_hash - (and - (>= v0.17) - (< v0.18))) - (ppx_here - (and - (>= v0.17) - (< v0.18))) - (ppx_js_style - (and - :dev - (>= v0.17) - (< v0.18))) - (ppx_let - (and - (>= v0.17) - (< v0.18))) - (ppx_sexp_conv - (and - (>= v0.17) - (< v0.18))) - (ppx_sexp_value - (and - (>= v0.17) - (< v0.18))) (sherlodoc (and :with-doc - (>= 0.2))) - (stdio - (and - (>= v0.17) - (< v0.18))))) + (>= 0.2))))) (package (name myotherlib) @@ -93,64 +49,16 @@ (depends (ocaml (>= 5.2)) - (base - (and - (>= v0.17) - (< v0.18))) - (command-unix-for-opam - (>= 0.0.2)) - (core - (and - (>= v0.17) - (< v0.18))) - (expect_test_helpers_core - (and - :with-test - (>= v0.17) - (< v0.18))) - (ppx_compare - (and - (>= v0.17) - (< v0.18))) - (ppx_enumerate - (and - (>= v0.17) - (< v0.18))) + (cmdlang + (>= 0.0.9)) + (cmdlang-cmdliner-err-runner + (>= 0.0.16)) (ppx_expect (and :with-test (>= v0.17) (< v0.18))) - (ppx_hash - (and - (>= v0.17) - (< v0.18))) - (ppx_here - (and - (>= v0.17) - (< v0.18))) - (ppx_js_style - (and - :dev - (>= v0.17) - (< v0.18))) - (ppx_let - (and - (>= v0.17) - (< v0.18))) - (ppx_sexp_conv - (and - (>= v0.17) - (< v0.18))) - (ppx_sexp_value - (and - (>= v0.17) - (< v0.18))) (sherlodoc (and :with-doc - (>= 0.2))) - (stdio - (and - (>= v0.17) - (< v0.18))))) + (>= 0.2))))) diff --git a/lib/mylib/src/dune b/lib/mylib/src/dune index c6a2349..7685e3c 100644 --- a/lib/mylib/src/dune +++ b/lib/mylib/src/dune @@ -1,25 +1,6 @@ (library (name mylib) (public_name mylib) - (flags - :standard - -w - +a-4-40-41-42-44-45-48-66 - -warn-error - +a - -open - Base - -open - Stdio) - (libraries base core.command stdio) - (lint - (pps ppx_js_style -check-doc-comments)) - (preprocess - (pps - ppx_compare - ppx_enumerate - ppx_hash - ppx_here - ppx_let - ppx_sexp_conv - ppx_sexp_value))) + (flags :standard -w +a-4-40-41-42-44-45-48-66 -warn-error +a -open Cmdlang) + (libraries cmdlang) + (preprocess no_preprocessing)) diff --git a/lib/mylib/src/mylib.ml b/lib/mylib/src/mylib.ml index d70dd1c..35b9aed 100644 --- a/lib/mylib/src/mylib.ml +++ b/lib/mylib/src/mylib.ml @@ -1,10 +1,11 @@ -let hello_world = [%sexp "Hello, World!"] +let hello_world = "Hello, World!" let print_cmd = - Command.basic + Command.make ~summary:"print hello world" - (let%map_open.Command () = return () in - fun () -> print_s hello_world) + (let open Command.Std in + let+ () = Arg.return () in + print_endline hello_world) ;; let main = Command.group ~summary:"" [ "print", print_cmd ] diff --git a/lib/mylib/src/mylib.mli b/lib/mylib/src/mylib.mli index b9a196d..7272bdf 100644 --- a/lib/mylib/src/mylib.mli +++ b/lib/mylib/src/mylib.mli @@ -1,2 +1,2 @@ -val hello_world : Sexp.t -val main : Command.t +val hello_world : string +val main : unit Command.t diff --git a/lib/mylib/test/dune b/lib/mylib/test/dune index f696ead..329f10d 100644 --- a/lib/mylib/test/dune +++ b/lib/mylib/test/dune @@ -1,26 +1,7 @@ (library (name mylib_test) - (flags - :standard - -w - +a-4-40-41-42-44-45-48-66 - -warn-error - +a - -open - Base - -open - Expect_test_helpers_base) - (libraries base expect_test_helpers_core.expect_test_helpers_base mylib) + (flags :standard -w +a-4-40-41-42-44-45-48-66 -warn-error +a) + (libraries mylib) (inline_tests) - (lint - (pps ppx_js_style -check-doc-comments)) (preprocess - (pps - ppx_compare - ppx_enumerate - ppx_expect - ppx_hash - ppx_here - ppx_let - ppx_sexp_conv - ppx_sexp_value))) + (pps ppx_expect))) diff --git a/lib/mylib/test/test__mylib.ml b/lib/mylib/test/test__mylib.ml index f6f5699..ee05385 100644 --- a/lib/mylib/test/test__mylib.ml +++ b/lib/mylib/test/test__mylib.ml @@ -1,4 +1,4 @@ let%expect_test "hello" = - print_s Mylib.hello_world; - [%expect {| "Hello, World!" |}] + print_endline Mylib.hello_world; + [%expect {| Hello, World! |}] ;; diff --git a/lib/myotherlib/src/dune b/lib/myotherlib/src/dune index 9765976..45ac0a4 100644 --- a/lib/myotherlib/src/dune +++ b/lib/myotherlib/src/dune @@ -1,25 +1,6 @@ (library (name myotherlib) (public_name myotherlib) - (flags - :standard - -w - +a-4-40-41-42-44-45-48-66 - -warn-error - +a - -open - Base - -open - Stdio) - (libraries base core.command stdio) - (lint - (pps ppx_js_style -check-doc-comments)) - (preprocess - (pps - ppx_compare - ppx_enumerate - ppx_hash - ppx_here - ppx_let - ppx_sexp_conv - ppx_sexp_value))) + (flags :standard -w +a-4-40-41-42-44-45-48-66 -warn-error +a -open Cmdlang) + (libraries cmdlang) + (preprocess no_preprocessing)) diff --git a/lib/myotherlib/src/myotherlib.ml b/lib/myotherlib/src/myotherlib.ml index 533a996..d58e865 100644 --- a/lib/myotherlib/src/myotherlib.ml +++ b/lib/myotherlib/src/myotherlib.ml @@ -1,10 +1,11 @@ -let hello_world = [%sexp "Hello, World From My Other Lib!"] +let hello_world = "Hello, World From My Other Lib!" let print_cmd = - Command.basic + Command.make ~summary:"print hello world" - (let%map_open.Command () = return () in - fun () -> print_s hello_world) + (let open Command.Std in + let+ () = Arg.return () in + print_endline hello_world) ;; let main = Command.group ~summary:"" [ "print", print_cmd ] diff --git a/lib/myotherlib/src/myotherlib.mli b/lib/myotherlib/src/myotherlib.mli index b9a196d..7272bdf 100644 --- a/lib/myotherlib/src/myotherlib.mli +++ b/lib/myotherlib/src/myotherlib.mli @@ -1,2 +1,2 @@ -val hello_world : Sexp.t -val main : Command.t +val hello_world : string +val main : unit Command.t diff --git a/lib/myotherlib/test/dune b/lib/myotherlib/test/dune index 87dbab1..ab99e5b 100644 --- a/lib/myotherlib/test/dune +++ b/lib/myotherlib/test/dune @@ -1,29 +1,7 @@ (library (name myotherlib_test) - (flags - :standard - -w - +a-4-40-41-42-44-45-48-66 - -warn-error - +a - -open - Base - -open - Expect_test_helpers_base) - (libraries - base - expect_test_helpers_core.expect_test_helpers_base - myotherlib) + (flags :standard -w +a-4-40-41-42-44-45-48-66 -warn-error +a) + (libraries myotherlib) (inline_tests) - (lint - (pps ppx_js_style -check-doc-comments)) (preprocess - (pps - ppx_compare - ppx_enumerate - ppx_expect - ppx_hash - ppx_here - ppx_let - ppx_sexp_conv - ppx_sexp_value))) + (pps ppx_expect))) diff --git a/lib/myotherlib/test/test__myotherlib.ml b/lib/myotherlib/test/test__myotherlib.ml index 4352d4a..c112dc3 100644 --- a/lib/myotherlib/test/test__myotherlib.ml +++ b/lib/myotherlib/test/test__myotherlib.ml @@ -1,4 +1,4 @@ let%expect_test "hello" = - print_s Myotherlib.hello_world; - [%expect {| "Hello, World From My Other Lib!" |}] + print_endline Myotherlib.hello_world; + [%expect {| Hello, World From My Other Lib! |}] ;; diff --git a/mylib.opam b/mylib.opam index 1f43675..a9c8df6 100644 --- a/mylib.opam +++ b/mylib.opam @@ -8,24 +8,14 @@ homepage: "https://github.com/mbarbin/doc-experiment-docusaurus" doc: "https://mbarbin.github.io/doc-experiment-docusaurus/" bug-reports: "https://github.com/mbarbin/doc-experiment-docusaurus/issues" depends: [ - "dune" {>= "3.16"} + "dune" {>= "3.17"} "ocaml" {>= "5.2"} - "base" {>= "v0.17" & < "v0.18"} - "command-unix-for-opam" {>= "0.0.2"} - "core" {>= "v0.17" & < "v0.18"} - "expect_test_helpers_core" {with-test & >= "v0.17" & < "v0.18"} + "cmdlang" {>= "0.0.9"} + "cmdlang-cmdliner-err-runner" {>= "0.0.16"} + "dune-build-info" {>= "3.17"} "mdx" {>= "2.4"} - "ppx_compare" {>= "v0.17" & < "v0.18"} - "ppx_enumerate" {>= "v0.17" & < "v0.18"} "ppx_expect" {with-test & >= "v0.17" & < "v0.18"} - "ppx_hash" {>= "v0.17" & < "v0.18"} - "ppx_here" {>= "v0.17" & < "v0.18"} - "ppx_js_style" {dev & >= "v0.17" & < "v0.18"} - "ppx_let" {>= "v0.17" & < "v0.18"} - "ppx_sexp_conv" {>= "v0.17" & < "v0.18"} - "ppx_sexp_value" {>= "v0.17" & < "v0.18"} "sherlodoc" {with-doc & >= "0.2"} - "stdio" {>= "v0.17" & < "v0.18"} "odoc" {with-doc} ] build: [ diff --git a/myotherlib.opam b/myotherlib.opam index 29a2d5f..ac58f74 100644 --- a/myotherlib.opam +++ b/myotherlib.opam @@ -8,23 +8,12 @@ homepage: "https://github.com/mbarbin/doc-experiment-docusaurus" doc: "https://mbarbin.github.io/doc-experiment-docusaurus/" bug-reports: "https://github.com/mbarbin/doc-experiment-docusaurus/issues" depends: [ - "dune" {>= "3.16"} + "dune" {>= "3.17"} "ocaml" {>= "5.2"} - "base" {>= "v0.17" & < "v0.18"} - "command-unix-for-opam" {>= "0.0.2"} - "core" {>= "v0.17" & < "v0.18"} - "expect_test_helpers_core" {with-test & >= "v0.17" & < "v0.18"} - "ppx_compare" {>= "v0.17" & < "v0.18"} - "ppx_enumerate" {>= "v0.17" & < "v0.18"} + "cmdlang" {>= "0.0.9"} + "cmdlang-cmdliner-err-runner" {>= "0.0.16"} "ppx_expect" {with-test & >= "v0.17" & < "v0.18"} - "ppx_hash" {>= "v0.17" & < "v0.18"} - "ppx_here" {>= "v0.17" & < "v0.18"} - "ppx_js_style" {dev & >= "v0.17" & < "v0.18"} - "ppx_let" {>= "v0.17" & < "v0.18"} - "ppx_sexp_conv" {>= "v0.17" & < "v0.18"} - "ppx_sexp_value" {>= "v0.17" & < "v0.18"} "sherlodoc" {with-doc & >= "0.2"} - "stdio" {>= "v0.17" & < "v0.18"} "odoc" {with-doc} ] build: [ From 0009c1ae726fa1b431f0dcba251e02e96482fc45 Mon Sep 17 00:00:00 2001 From: Mathieu Barbin Date: Wed, 11 Mar 2026 10:15:38 +0100 Subject: [PATCH 4/6] Switch to new directory structure --- {bin => src/mylib/bin}/dune | 0 {bin => src/mylib/bin}/main.ml | 0 {lib/mylib/src => src/mylib}/dune | 0 {lib/mylib/src => src/mylib}/mylib.ml | 0 {lib/mylib/src => src/mylib}/mylib.mli | 0 {lib/myotherlib/src => src/myotherlib}/dune | 0 {lib/myotherlib/src => src/myotherlib}/myotherlib.ml | 0 {lib/myotherlib/src => src/myotherlib}/myotherlib.mli | 0 {lib/mylib/test => test/mylib}/dune | 0 {lib/mylib/test => test/mylib}/test__mylib.ml | 0 {lib/mylib/test => test/mylib}/test__mylib.mli | 0 {lib/myotherlib/test => test/myotherlib}/dune | 0 {lib/myotherlib/test => test/myotherlib}/test__myotherlib.ml | 0 {lib/myotherlib/test => test/myotherlib}/test__myotherlib.mli | 0 14 files changed, 0 insertions(+), 0 deletions(-) rename {bin => src/mylib/bin}/dune (100%) rename {bin => src/mylib/bin}/main.ml (100%) rename {lib/mylib/src => src/mylib}/dune (100%) rename {lib/mylib/src => src/mylib}/mylib.ml (100%) rename {lib/mylib/src => src/mylib}/mylib.mli (100%) rename {lib/myotherlib/src => src/myotherlib}/dune (100%) rename {lib/myotherlib/src => src/myotherlib}/myotherlib.ml (100%) rename {lib/myotherlib/src => src/myotherlib}/myotherlib.mli (100%) rename {lib/mylib/test => test/mylib}/dune (100%) rename {lib/mylib/test => test/mylib}/test__mylib.ml (100%) rename {lib/mylib/test => test/mylib}/test__mylib.mli (100%) rename {lib/myotherlib/test => test/myotherlib}/dune (100%) rename {lib/myotherlib/test => test/myotherlib}/test__myotherlib.ml (100%) rename {lib/myotherlib/test => test/myotherlib}/test__myotherlib.mli (100%) diff --git a/bin/dune b/src/mylib/bin/dune similarity index 100% rename from bin/dune rename to src/mylib/bin/dune diff --git a/bin/main.ml b/src/mylib/bin/main.ml similarity index 100% rename from bin/main.ml rename to src/mylib/bin/main.ml diff --git a/lib/mylib/src/dune b/src/mylib/dune similarity index 100% rename from lib/mylib/src/dune rename to src/mylib/dune diff --git a/lib/mylib/src/mylib.ml b/src/mylib/mylib.ml similarity index 100% rename from lib/mylib/src/mylib.ml rename to src/mylib/mylib.ml diff --git a/lib/mylib/src/mylib.mli b/src/mylib/mylib.mli similarity index 100% rename from lib/mylib/src/mylib.mli rename to src/mylib/mylib.mli diff --git a/lib/myotherlib/src/dune b/src/myotherlib/dune similarity index 100% rename from lib/myotherlib/src/dune rename to src/myotherlib/dune diff --git a/lib/myotherlib/src/myotherlib.ml b/src/myotherlib/myotherlib.ml similarity index 100% rename from lib/myotherlib/src/myotherlib.ml rename to src/myotherlib/myotherlib.ml diff --git a/lib/myotherlib/src/myotherlib.mli b/src/myotherlib/myotherlib.mli similarity index 100% rename from lib/myotherlib/src/myotherlib.mli rename to src/myotherlib/myotherlib.mli diff --git a/lib/mylib/test/dune b/test/mylib/dune similarity index 100% rename from lib/mylib/test/dune rename to test/mylib/dune diff --git a/lib/mylib/test/test__mylib.ml b/test/mylib/test__mylib.ml similarity index 100% rename from lib/mylib/test/test__mylib.ml rename to test/mylib/test__mylib.ml diff --git a/lib/mylib/test/test__mylib.mli b/test/mylib/test__mylib.mli similarity index 100% rename from lib/mylib/test/test__mylib.mli rename to test/mylib/test__mylib.mli diff --git a/lib/myotherlib/test/dune b/test/myotherlib/dune similarity index 100% rename from lib/myotherlib/test/dune rename to test/myotherlib/dune diff --git a/lib/myotherlib/test/test__myotherlib.ml b/test/myotherlib/test__myotherlib.ml similarity index 100% rename from lib/myotherlib/test/test__myotherlib.ml rename to test/myotherlib/test__myotherlib.ml diff --git a/lib/myotherlib/test/test__myotherlib.mli b/test/myotherlib/test__myotherlib.mli similarity index 100% rename from lib/myotherlib/test/test__myotherlib.mli rename to test/myotherlib/test__myotherlib.mli From 07af571c8e0afe829c1625cde5a6d349a0e4e393 Mon Sep 17 00:00:00 2001 From: Mathieu Barbin Date: Wed, 11 Mar 2026 21:04:07 +0100 Subject: [PATCH 5/6] Add dev and test packages --- doc-experiment-docusaurus-dev.opam | 35 +++++++++++++++++++ doc-experiment-docusaurus-tests.opam | 32 +++++++++++++++++ doc/docs/tutorials/hello-mylib/dune | 1 + dune-project | 52 ++++++++++++++++++---------- mylib.opam | 3 -- myotherlib.opam | 2 -- test/mylib/dune | 1 + test/myotherlib/dune | 1 + 8 files changed, 104 insertions(+), 23 deletions(-) create mode 100644 doc-experiment-docusaurus-dev.opam create mode 100644 doc-experiment-docusaurus-tests.opam diff --git a/doc-experiment-docusaurus-dev.opam b/doc-experiment-docusaurus-dev.opam new file mode 100644 index 0000000..2d04691 --- /dev/null +++ b/doc-experiment-docusaurus-dev.opam @@ -0,0 +1,35 @@ +# This file is generated by dune, edit dune-project instead +opam-version: "2.0" +synopsis: "Dev targets and documentation" +maintainer: ["Mathieu Barbin"] +authors: ["Mathieu Barbin"] +license: "MIT" +homepage: "https://github.com/mbarbin/doc-experiment-docusaurus" +doc: "https://mbarbin.github.io/doc-experiment-docusaurus/" +bug-reports: "https://github.com/mbarbin/doc-experiment-docusaurus/issues" +depends: [ + "dune" {>= "3.17"} + "ocaml" {>= "5.2"} + "doc-experiment-docusaurus-tests" {= version} + "mylib" {= version} + "myotherlib" {= version} + "mdx" {>= "2.4"} + "ocamlformat" {= "0.28.1"} + "sherlodoc" {>= "0.2"} + "odoc" {with-doc} +] +build: [ + ["dune" "subst"] {dev} + [ + "dune" + "build" + "-p" + name + "-j" + jobs + "@install" + "@runtest" {with-test} + "@doc" {with-doc} + ] +] +dev-repo: "git+https://github.com/mbarbin/doc-experiment-docusaurus.git" diff --git a/doc-experiment-docusaurus-tests.opam b/doc-experiment-docusaurus-tests.opam new file mode 100644 index 0000000..c186695 --- /dev/null +++ b/doc-experiment-docusaurus-tests.opam @@ -0,0 +1,32 @@ +# This file is generated by dune, edit dune-project instead +opam-version: "2.0" +synopsis: "Tests for doc-experiment-docusaurus" +maintainer: ["Mathieu Barbin"] +authors: ["Mathieu Barbin"] +license: "MIT" +homepage: "https://github.com/mbarbin/doc-experiment-docusaurus" +doc: "https://mbarbin.github.io/doc-experiment-docusaurus/" +bug-reports: "https://github.com/mbarbin/doc-experiment-docusaurus/issues" +depends: [ + "dune" {>= "3.17"} + "ocaml" {>= "5.2"} + "mylib" {= version} + "myotherlib" {= version} + "ppx_expect" {>= "v0.17" & < "v0.18"} + "odoc" {with-doc} +] +build: [ + ["dune" "subst"] {dev} + [ + "dune" + "build" + "-p" + name + "-j" + jobs + "@install" + "@runtest" {with-test} + "@doc" {with-doc} + ] +] +dev-repo: "git+https://github.com/mbarbin/doc-experiment-docusaurus.git" diff --git a/doc/docs/tutorials/hello-mylib/dune b/doc/docs/tutorials/hello-mylib/dune index a10e6e2..c8d8c13 100644 --- a/doc/docs/tutorials/hello-mylib/dune +++ b/doc/docs/tutorials/hello-mylib/dune @@ -1,4 +1,5 @@ (mdx + (package doc-experiment-docusaurus-dev) (deps (package mylib)) (preludes prelude.txt)) diff --git a/dune-project b/dune-project index bfbcd3e..7050ea3 100644 --- a/dune-project +++ b/dune-project @@ -30,18 +30,7 @@ (cmdlang-cmdliner-err-runner (>= 0.0.16)) (dune-build-info - (>= 3.17)) - (mdx - (>= 2.4)) - (ppx_expect - (and - :with-test - (>= v0.17) - (< v0.18))) - (sherlodoc - (and - :with-doc - (>= 0.2))))) + (>= 3.17)))) (package (name myotherlib) @@ -52,13 +41,40 @@ (cmdlang (>= 0.0.9)) (cmdlang-cmdliner-err-runner - (>= 0.0.16)) + (>= 0.0.16)))) + +(package + (name doc-experiment-docusaurus-tests) + (synopsis "Tests for doc-experiment-docusaurus") + (allow_empty) + (depends + (ocaml + (>= 5.2)) + (mylib + (= :version)) + (myotherlib + (= :version)) (ppx_expect (and - :with-test (>= v0.17) - (< v0.18))) + (< v0.18))))) + +(package + (name doc-experiment-docusaurus-dev) + (synopsis "Dev targets and documentation") + (allow_empty) + (depends + (ocaml + (>= 5.2)) + (doc-experiment-docusaurus-tests + (= :version)) + (mylib + (= :version)) + (myotherlib + (= :version)) + (mdx + (>= 2.4)) + (ocamlformat + (= 0.28.1)) (sherlodoc - (and - :with-doc - (>= 0.2))))) + (>= 0.2)))) diff --git a/mylib.opam b/mylib.opam index a9c8df6..9b45782 100644 --- a/mylib.opam +++ b/mylib.opam @@ -13,9 +13,6 @@ depends: [ "cmdlang" {>= "0.0.9"} "cmdlang-cmdliner-err-runner" {>= "0.0.16"} "dune-build-info" {>= "3.17"} - "mdx" {>= "2.4"} - "ppx_expect" {with-test & >= "v0.17" & < "v0.18"} - "sherlodoc" {with-doc & >= "0.2"} "odoc" {with-doc} ] build: [ diff --git a/myotherlib.opam b/myotherlib.opam index ac58f74..21660c3 100644 --- a/myotherlib.opam +++ b/myotherlib.opam @@ -12,8 +12,6 @@ depends: [ "ocaml" {>= "5.2"} "cmdlang" {>= "0.0.9"} "cmdlang-cmdliner-err-runner" {>= "0.0.16"} - "ppx_expect" {with-test & >= "v0.17" & < "v0.18"} - "sherlodoc" {with-doc & >= "0.2"} "odoc" {with-doc} ] build: [ diff --git a/test/mylib/dune b/test/mylib/dune index 329f10d..9f33e25 100644 --- a/test/mylib/dune +++ b/test/mylib/dune @@ -1,5 +1,6 @@ (library (name mylib_test) + (package doc-experiment-docusaurus-tests) (flags :standard -w +a-4-40-41-42-44-45-48-66 -warn-error +a) (libraries mylib) (inline_tests) diff --git a/test/myotherlib/dune b/test/myotherlib/dune index ab99e5b..763add7 100644 --- a/test/myotherlib/dune +++ b/test/myotherlib/dune @@ -1,5 +1,6 @@ (library (name myotherlib_test) + (package doc-experiment-docusaurus-tests) (flags :standard -w +a-4-40-41-42-44-45-48-66 -warn-error +a) (libraries myotherlib) (inline_tests) From 3c73d7e3eb205c935944978d966b045cc671e61e Mon Sep 17 00:00:00 2001 From: Mathieu Barbin Date: Wed, 11 Mar 2026 21:04:16 +0100 Subject: [PATCH 6/6] Add dunolint config --- dunolint | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 dunolint diff --git a/dunolint b/dunolint new file mode 100644 index 0000000..3552342 --- /dev/null +++ b/dunolint @@ -0,0 +1,10 @@ +(lang dunolint 1.0) + +(rule + (cond + ((path (glob test/**)) + (enforce + (dune + (library + (and (not (has_field public_name)) + (package (equals doc-experiment-docusaurus-tests)))))))))