Skip to content

Commit 09b291f

Browse files
committed
Initial rename and swap from esy to rescript-atdgen-generator
1 parent 6177625 commit 09b291f

File tree

63 files changed

+77
-4203
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+77
-4203
lines changed

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,7 @@ yarn-debug.log*
88
yarn-error.log*
99
*.bs.js
1010

11-
_esy
11+
*_t.ml
12+
*_t.mli
13+
*_bs.ml
14+
*_bs.mli

.ocamlformat

Lines changed: 0 additions & 1 deletion
This file was deleted.

LICENSE

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
MIT License
22

3-
Copyright (c) 2018
3+
Copyright (c) 2024 Andrew Herron
4+
5+
Previous maintainers:
6+
7+
- Copyright (c) 2018 ahrefs
48

59
Permission is hereby granted, free of charge, to any person obtaining a copy
610
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 21 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,32 @@
1-
# bs-atdgen-codec-runtime
1+
# rescript-atdgen-codec-runtime
22

3-
`bs-atdgen-codec-runtime` is a bucklescript runtime for
4-
[atdgen](https://github.com/ahrefs/atd). It is based on the json type
5-
provided by bucklescript and combinators of
3+
`rescript-atdgen-codec-runtime` is a ReScript runtime for
4+
[atdgen](https://github.com/ahrefs/atd), a code-generation tool for JSON handling. It is based on the json type
5+
provided by ReScript and combinators of
66
[@glennsl/bs-json](https://github.com/glennsl/bs-json).
77

88
## Installation
99

1010
```
11-
yarn add @ahrefs/bs-atdgen-codec-runtime
11+
yarn add rescript-atdgen-codec-runtime
1212
```
1313

14-
This package doesn't take care of running atdgen to derive code from
15-
type definitions. This step requires the `atdgen` binary which can be
16-
obtained using [opam](https://opam.ocaml.org/) or [esy](https://esy.sh/).
14+
This package doesn't take care of running `atdgen` to derive code from type definitions. For that, you need to [`rescript-atdgen-generator`](https://github.com/TheSpyder/rescript-atdgen-generator) to generate the `.ml` and `.mli` files from `.atd` sources.
1715

18-
Alternatively, if your project is using BuckleScript exclusively (i.e. not using native OCaml or Reason in the backend),
19-
you might consider using [`bs-atdgen-generator`](https://github.com/jchavarri/bs-atdgen-generator) in combination with
20-
this runtime library, in order to generate the `.ml` and `.mli` files from `.atd` sources without having to use native
21-
package managers like `esy` or `opam`.
16+
## A note about ReScript 11
17+
The `atd` code-generation project is an OCaml tool, and generates OCaml files. As such it does not support uncurried mode. The ahrefs team is open to a contribution that generates ReScript instead, but so long as this project only has one user that doesn't seem worth the effort. For more information and to add your voice to the discussion please follow the github issue (TODO).
2218

2319
## Usage
2420

25-
Add `@ahrefs/bs-atdgen-codec-runtime` to the `bs-dependencies` of
26-
`bsconfig.json`.
21+
Add `rescript-atdgen-generator` to the `bs-dependencies` of `bsconfig.json`.
2722

28-
To write atd type definitions, please have a look at the [great atd
29-
documentation](https://atd.readthedocs.io/en/latest/).
23+
To write atd type definitions, please have a look at the [atd documentation](https://atd.readthedocs.io/en/latest/).
3024

3125
## Simple example
3226

33-
Reason code to query and deserialize the response of a REST API. It
34-
requires `bs-fetch`.
27+
Reason code to query and deserialize the response of a REST API using the `meetup.atd` file in `example/src`. It requires `bs-fetch`.
28+
29+
(TODO: rewrite in ReScript with either rescript-webapi or rescript-fetch)
3530

3631
```
3732
let get = (url, decode) =>
@@ -53,9 +48,12 @@ let v: Meetup_t.events =
5348

5449
## Full example
5550

56-
The [example](example) directory contains a full example of a simple
57-
cli to read and write data in a JSON file.
51+
The [example](example) directory contains a full example of a simple cli to read and write data in a JSON file.
52+
53+
For a complete introduction from atdgen installation to json manipulation, please refer to [Getting started with atdgen and melange](https://tech.ahrefs.com/getting-started-with-atdgen-and-bucklescript-1f3a14004081). The article talks about melange a lot, which isn't relevant, but it does still serve as a good introduction to `atd` syntax.
54+
55+
## License and Credits
56+
57+
All code is licensed as MIT. See [LICENSE](LICENSE).
5858

59-
For a complete introduction from atdgen installation to json
60-
manipulation, please refer to [Getting started with atdgen and
61-
bucklescript](https://tech.ahrefs.com/getting-started-with-atdgen-and-bucklescript-1f3a14004081).
59+
This project was forked from [@ahrefs/bs-atdgen-codec-runtime](https://github.com/ahrefs/bs-atdgen-codec-runtime). That project has now migrated to melange, I made a copy of the commit I forked from [here](https://github.com/thespyder/bs-atdgen-codec-runtime).

0 commit comments

Comments
 (0)