(rule
 (target e2e.ml)
 (deps ../e2e.eliom %{cmo:../e2e})
 (action
  (with-stdout-to
   %{target}
   (chdir
    ..
    (run
     %{bin:ppx_eliom_client}
     --as-pp
     -server-cmo
     %{cmo:../e2e}
     --impl
     e2e.eliom)))))

(executable
 (name e2e)
 (modes js wasm)
 (modules e2e)
 (preprocess
  (pps js_of_ocaml-ppx js_of_ocaml-ppx_deriving_json))
 (libraries eliom.client))

; The client programs, as the application expects them: e2e.js, and
; e2e.wasm.js with its assets, which keep their name. server.exe serves this
; whole build directory, since a dune rule cannot simply copy the directory of
; the assets.

(rule
 (copy e2e.bc.js e2e.js))

(rule
 (deps e2e.bc.wasm.assets)
 (action
  (copy e2e.bc.wasm.js e2e.wasm.js)))
