Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move to melange 2.1 #144

Merged
merged 2 commits into from
Nov 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
node-version:
- 18.x
ocaml-compiler:
- 4.14.x
- 5.1.x

runs-on: ${{ matrix.system }}

Expand Down
9 changes: 5 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,11 @@ init: create-switch install ## Configure everything to develop this repository i

.PHONY: install
install: ## Install development dependencies
yarn install
opam install -y . --deps-only
opam pin -y add $(project_name).dev .
rm -rf node_modules/melange && ln -sfn $$(opam var melange:lib)/runtime node_modules/melange
yarn install ## install JavaScript packages that the project might depend on, like `react` or `react-dom`
opam update ## make sure that opam has the latest information about published libraries in the opam repository https://opam.ocaml.org/packages/
opam install -y . --deps-only --with-test ## install the Melange and OCaml dependencies
opam pin -y add $(project_name).dev . ## somehow needed to get relude to show up in dune?
opam exec opam-check-npm-deps ## check that the versions of the JavaScript packages installed match the requirements defined by Melange libraries

.PHONY: build
build: ## Build the project
Expand Down
22 changes: 13 additions & 9 deletions bs-decode.opam
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,20 @@ homepage: "https://github.com/mlms13/bs-decode"
bug-reports: "https://github.com/mlms13/bs-decode/issues"
depends: [
"dot-merlin-reader" {dev}
"dune" {dev}
"melange" {dev}
"melange-compiler-libs" {dev}
"ocaml" {>= "4.14.0" & < "5.0.0"}
"reason" {>= "3.8.1" & < "4.0.0"}
"dune" {>= "3.8"}
"melange" {>= "2.0.0"}
"ocaml" {>= "5.1.0"}
"reason" {>= "3.10.0" & < "4.0.0"}
"ocaml-lsp-server" {dev}
"ocamlformat" {dev}
"odoc" {with-doc}
"relude" {dev}
"bastet" {dev}
"melange-jest" {>= "0.1.0"}
"opam-check-npm-deps" {with-test}
]

pin-depends: [
[ "dune.dev" "git+https://github.com/ocaml/dune.git#a0dd51512f269d7c18f0c6216ab66d3ab7368da2" ]
[ "melange-compiler-libs.dev" "git+https://github.com/melange-re/melange-compiler-libs.git#48ff923f2c25136de8ab96678f623f54cdac438c" ]
[ "melange.dev" "git+https://github.com/melange-re/melange.git#cb1962c15799b2c4045121a280d83600ece3bb59" ]
]
[ "relude.dev" "git+https://github.com/reazen/relude.git#v2" ]
[ "bastet.dev" "git+https://github.com/johnhaley81/bastet.git#6c8f53a9da55254691df49bddf96b279b38be204" ]
]
26 changes: 1 addition & 25 deletions dune
Original file line number Diff line number Diff line change
@@ -1,25 +1 @@
(subdir
node_modules
(vendored_dirs melange.belt)
(data_only_dirs bs-jest bs-bastet relude))

(subdir
node_modules/@glennsl/bs-jest/src
(library
(name jest)
(modes melange)))

(subdir
node_modules/bs-bastet/bastet/src
(library
(name bsBastet)
(modes melange)
(flags -w -67)))

(subdir
node_modules/relude/src
(include_subdirs unqualified)
(library
(name relude)
(modes melange)
(libraries bsBastet)))
(dirs :standard \ node_modules)
17 changes: 2 additions & 15 deletions dune-project
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(lang dune 3.7)
(lang dune 3.8)

(using directory-targets 0.1)

Expand All @@ -20,17 +20,4 @@
(allow_empty)
(name bs-decode)
(synopsis "Type-safe JSON decoding for ReasonML and OCaml")
(description "Type-safe JSON decoding for ReasonML and OCaml")
(depends
(ocaml
(and
(>= "4.14.0")
(< "4.15.0")))
(reason
(and
(>= "3.8.2")
(< "4.0.0")))
mel
melange
(ocaml-lsp-server :dev)
(dot-merlin-reader :dev)))
(description "Type-safe JSON decoding for ReasonML and OCaml"))
9 changes: 2 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,11 @@
],
"author": "Michael Martin",
"license": "MIT",
"peerDependencies": {
"bs-bastet": "^2.0.0",
"relude": "^0.66.1"
},
"devDependencies": {
"@glennsl/bs-jest": "^0.7.0",
"bs-bastet": "^2.0.0",
"bs-platform": "^7.2.2",
"coveralls": "^3.0.9",
"relude": "^0.66.1"
"jest": "^26.5.2",
"@testing-library/jest-dom": "^5.10.0"
},
"jest": {
"testPathIgnorePatterns": [
Expand Down
2 changes: 1 addition & 1 deletion src/Decode_Base.re
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
open Relude.Globals;
open BsBastet.Interface;
open Bastet.Interface;

module ParseError = Decode_ParseError;

Expand Down
6 changes: 4 additions & 2 deletions src/dune
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
(library
(name bsDecode)
(wrapped false)
(libraries bsBastet relude)
(modes melange))
(libraries bastet relude)
(modes melange)
(preprocess
(pps melange.ppx)))
2 changes: 1 addition & 1 deletion test/Decode_AsResult_OfParseError_test.re
Original file line number Diff line number Diff line change
Expand Up @@ -1031,7 +1031,7 @@ describe("Deprecated decoders", () => {

// here we import a gigantic json file (as raw json, to avoid slowing down the
// compiler)
[@bs.module] external bigjson: Js.Json.t = "./utils/BigJson.json";
[@mel.module] external bigjson: Js.Json.t = "./utils/BigJson.json";

describe("Big JSON", () => {
test("is stack-safe", () =>
Expand Down
6 changes: 4 additions & 2 deletions test/dune
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,7 @@
(promote (until-clean))
(alias main)
(compile_flags -open Relude.Globals)
(libraries melange jest bsBastet relude bsDecode)
(module_systems commonjs))
(libraries melange melange-jest.jest bastet relude bsDecode)
(module_systems commonjs)
(preprocess
(pps melange.ppx)))
4 changes: 2 additions & 2 deletions test/utils/Decode_TestSampleData.re
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,10 @@ let jsonShapeInvalid: Js.Json.t = [%raw
];

// typed variants and converters
[@bs.deriving jsConverter]
[@deriving jsConverter]
type color = [ | `blue | `red | `green];

[@bs.deriving jsConverter]
[@deriving jsConverter]
type numbers =
| Zero
| One
Expand Down
Loading