Skip to content

Commit

Permalink
s/browser/js
Browse files Browse the repository at this point in the history
  • Loading branch information
jchavarri committed Aug 15, 2024
1 parent b5aa8a5 commit 460e4a4
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 21 deletions.
9 changes: 5 additions & 4 deletions ppx/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ Finally, add the `dune` configuration to your project:
(library
(modes melange)
(preprocess (pps melange-json.browser)))
(preprocess (pps melange-json.js)))
```

Note that you need to use the `melange-json.native` preprocessor for native and
the `melange-json.browser` preprocessor for melange.
Note that you need to use the `melange-json.native` preprocessor for OCaml
native and the `melange-json.js` preprocessor for Melange.

## Usage

Expand Down Expand Up @@ -143,5 +143,6 @@ let json = to_json B
(* json = `String "bbb" *)
```

[ppx deriver plugin]: https://ocaml.org/docs/metaprogramming#attributes-and-derivers
[ppx deriver plugin]:
https://ocaml.org/docs/metaprogramming#attributes-and-derivers
[melange]: https://melange.re
22 changes: 11 additions & 11 deletions ppx/browser/dune
Original file line number Diff line number Diff line change
@@ -1,38 +1,38 @@
(library
(public_name melange-json.browser)
(name ppx_deriving_json_browser)
(public_name melange-json.js)
(name ppx_deriving_json_js)
(modules
:standard
\
ppx_deriving_json_runtime
ppx_deriving_json_browser_test)
ppx_deriving_json_js_test)
(libraries ppxlib)
(ppx_runtime_libraries melange-json.browser_runtime)
(ppx_runtime_libraries melange-json.js_runtime)
(preprocess
(pps ppxlib.metaquot))
(kind ppx_deriver))

(library
(public_name melange-json.browser_runtime)
(name ppx_deriving_json_browser_runtime)
(public_name melange-json.js_runtime)
(name ppx_deriving_json_js_runtime)
(modules ppx_deriving_json_runtime)
(wrapped false)
(modes melange))

(executable
(name ppx_deriving_json_browser_test)
(modules ppx_deriving_json_browser_test)
(libraries melange-json.browser ppxlib))
(name ppx_deriving_json_js_test)
(modules ppx_deriving_json_js_test)
(libraries melange-json.js ppxlib))

(rule
(target ppx_deriving_json_browser.mli)
(target ppx_deriving_json_js.mli)
(action
(with-stdout-to
%{target}
(run echo ""))))

(rule
(target ppx_deriving_json_browser_test.ml)
(target ppx_deriving_json_js_test.ml)
(action
(with-stdout-to
%{target}
Expand Down
File renamed without changes.
6 changes: 3 additions & 3 deletions ppx/test/Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
update-test: ppx_deriving_json_native.t ppx_deriving_json_browser.t
update-test: ppx_deriving_json_native.t ppx_deriving_json_js.t

ppx_deriving_json_browser.t: example.ml
bash ./gen_test.sh ../browser/ppx_deriving_json_browser_test.exe > $@
ppx_deriving_json_js.t: example.ml
bash ./gen_test.sh ../browser/ppx_deriving_json_js_test.exe > $@

ppx_deriving_json_native.t: example.ml
bash ./gen_test.sh ../native/ppx_deriving_json_native_test.exe > $@
2 changes: 1 addition & 1 deletion ppx/test/dune
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
./example.ml
../../.ocamlformat
../native/ppx_deriving_json_native_test.exe
../browser/ppx_deriving_json_browser_test.exe))
../browser/ppx_deriving_json_js_test.exe))
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
> (modes melange)
> (modules example main)
> (flags :standard -w -37-69 -open Ppx_deriving_json_runtime.Primitives)
> (preprocess (pps melange.ppx melange-json.browser)))
> (preprocess (pps melange.ppx melange-json.js)))
> (melange.emit
> (alias js)
> (target output)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
$ alias run='../browser/ppx_deriving_json_browser_test.exe -impl - | ocamlformat - --impl'
$ alias run='../browser/ppx_deriving_json_js_test.exe -impl - | ocamlformat - --impl'

$ cat <<"EOF" | run
> type user = int [@@deriving json]
Expand Down

0 comments on commit 460e4a4

Please sign in to comment.