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

ReScript 11 #124

Draft
wants to merge 21 commits into
base: master
Choose a base branch
from
Draft
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
287 changes: 205 additions & 82 deletions .github/workflows/ci.yml

Large diffs are not rendered by default.

41 changes: 20 additions & 21 deletions .github/workflows/scripts/postinstall.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,44 +8,43 @@ let arch = process.arch;
let platform = process.platform;

if (arch === "ia32") {
arch = "x86";
arch = "x86";
}

if (platform === "win32") {
platform = "win";
platform = "win";
}

const filename = `bin/${PPX}-${platform}-${arch}.exe`;

const supported = fs.existsSync(filename);

if (!supported) {
console.error(`${PPX} does not support this platform :(`);
console.error("");
console.error(`${PPX} comes prepacked as built binaries to avoid large`);
console.error("dependencies at build-time.");
console.error("");
console.error(`If you want ${PPX} to support this platform natively,`);
console.error("please open an issue at our repository, linked above. Please");
console.error(`specify that you are on the ${platform} platform,`);
console.error(`on the ${arch} architecture.`);

console.error(`${PPX} does not support this platform :(`);
console.error("");
console.error(`${PPX} comes prepacked as built binaries to avoid large`);
console.error("dependencies at build-time.");
console.error("");
console.error(`If you want ${PPX} to support this platform natively,`);
console.error("please open an issue at our repository, linked above. Please");
console.error(`specify that you are on the ${platform} platform,`);
console.error(`on the ${arch} architecture.`);
}

if (!fs.existsSync("ppx.exe")) {
copyFileSync(filename, "ppx.exe");
fs.chmodSync("ppx.exe", 0755);
copyFileSync(filename, "ppx.exe");
fs.chmodSync("ppx.exe", 0755);
}

if (!fs.existsSync("ppx")) {
copyFileSync(filename, "ppx");
fs.chmodSync("ppx", 0755);
copyFileSync(filename, "ppx");
fs.chmodSync("ppx", 0755);
}

function copyFileSync(source, dest) {
if (typeof fs.copyFileSync === "function") {
fs.copyFileSync(source, dest);
} else {
fs.writeFileSync(dest, fs.readFileSync(source));
}
if (typeof fs.copyFileSync === "function") {
fs.copyFileSync(source, dest);
} else {
fs.writeFileSync(dest, fs.readFileSync(source));
}
}
15 changes: 0 additions & 15 deletions .github/workflows/scripts/print-esy-cache.js

This file was deleted.

53 changes: 18 additions & 35 deletions .github/workflows/scripts/write-package-json.js
Original file line number Diff line number Diff line change
@@ -1,43 +1,26 @@
const fs = require("fs");
const path = require("path");

const {
name,
version,
description,
author,
license,
repository,
keywords
} = require("../../../package.json");
const { name, version, description, author, license, repository, keywords } = require("../../../package.json");
const { dependencies } = require("../../../lib/package.json");

const packageJson = JSON.stringify(
{
name,
version,
description,
author,
license,
repository,
keywords,
dependencies,
files: [
"src",
"bin",
"bsconfig.json",
"postinstall.js",
],
scripts: {
postinstall: "node ./postinstall.js"
}
},
null,
2
{
name,
version,
description,
author,
license,
repository,
keywords,
dependencies,
files: ["src", "bin", "rescript.json", "postinstall.js"],
scripts: {
postinstall: "node ./postinstall.js",
},
},
null,
2,
);

fs.writeFileSync(
path.join(__dirname, "..", "..", "..", "_release", "package.json"),
packageJson,
{ encoding: "utf8" }
);
fs.writeFileSync(path.join(__dirname, "..", "..", "..", "_release", "package.json"), packageJson, { encoding: "utf8" });
5 changes: 1 addition & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,14 @@ node_modules/
.merlin
.bsb.lock
.parcel-cache
*.bs.js
*.res.js
yarn-error.log
.DS_Store
*/dist/
/_esy
/_build
/_release
/examples/lib/
/lib/lib/
/specs/lib/
/scripts/aws.env
/scripts/aws.pem
/ppx/test/**/*.cm[itj]
re-formality-ppx.install
1 change: 1 addition & 0 deletions .ocamlformat
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
profile = janestreet
14 changes: 7 additions & 7 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,12 @@ It would be great if you could reduce your test case to minimal size. I.e. inste
- ppx/ # PPX
- bin/ # PPX binary
- lib/ # PPX implementation
- sandbox/ # PPX sandbox for debugging
- test/ # PPX tests
- specs/ # Integration tests
```

### Setup
This repo uses `yarn` workspaces to manage frontend related dependencies and `esy` to manage PPX related dependencies (optionally, you can use `nix` shell instead of `esy` for development).
This repo uses `yarn` workspaces to manage frontend related dependencies and `opam` to manage PPX related dependencies (optionally, you can use `nix` shell instead of `opam` for development).

Install Yarn dependencies:

Expand All @@ -58,25 +57,26 @@ Build public interface of the ReScript lib:
# Apparently `rescript` doesn't have `bsb -install` counterpart
# So you need to build any app in this workspace that relies on `re-formality`

# E.g. in ppx/sandbox folder
# E.g. in ./examples folder
yarn rescript build -with-deps
```

**Esy flow**
**Opam flow**
Install Esy dependencies:

```shell
esy install
opam init -a --disable-sandboxing --compiler=4.14.1
opam install . --deps-only --with-test
```

Build PPX:

```shell
esy build
opam exec -- dune build
```

**Nix/Devbox flow**
Build PPX:
Considering you are already in Devbox shell, build PPX:

```shell
dune build
Expand Down
10 changes: 10 additions & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# History

## 4.0.0-beta.21
** This is the last release before library rename: `re-formality → rescript-formality` (unless there are bugs)**

* **[ BREAKING ]** Update to ReScript v11. All the functions are now uncurried. We don't offer curried option, sorry.
* **[ BREAKING ]** Remove Linux `arm64` binary.

Internal changes:
* PPX source code is converted from Reason to OCaml.
* ReScript library source code is converted from Reason to ReScript.

## 4.0.0-beta.20
* Fix Linux `arm64` binary name.

Expand Down
20 changes: 9 additions & 11 deletions devbox.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
{
"packages": [
"path:./nix/ocaml#ocaml",
"path:./nix/ocaml#dune",
"path:./nix/ocaml#reason",
"path:./nix/ocaml#result",
"path:./nix/ocaml#findlib",
"path:./nix/ocaml#ppxlib",
"path:./nix/ocaml#alcotest",
"path:./nix/ocaml#merlin",
"path:./nix/ocaml#lsp",
"ocamlPackages.ocaml",
"ocamlPackages.dune_3",
"ocamlPackages.findlib",
"ocamlPackages.ppxlib",
"ocamlPackages.alcotest",
"ocamlPackages.ocaml-lsp",
"ocamlPackages.ocamlformat",
"ocamlPackages.ocamlformat-rpc-lib",
"nodejs",
"yarn",
"awscli2"
"yarn"
],
"shell": {
"init_hook": [
Expand Down
45 changes: 32 additions & 13 deletions devbox.lock
Original file line number Diff line number Diff line change
@@ -1,23 +1,42 @@
{
"lockfile_version": "1",
"packages": {
"awscli2": {
"resolved": "github:NixOS/nixpkgs/f80ac848e3d6f0c12c52758c0f25c10c97ca3b62#awscli2",
"source": "nixpkg"
},
"nodejs": {
"resolved": "github:NixOS/nixpkgs/f80ac848e3d6f0c12c52758c0f25c10c97ca3b62#nodejs",
"source": "nixpkg"
},
"path:./nix/ocaml#alcotest": {},
"path:./nix/ocaml#dune": {},
"path:./nix/ocaml#findlib": {},
"path:./nix/ocaml#lsp": {},
"path:./nix/ocaml#merlin": {},
"path:./nix/ocaml#ocaml": {},
"path:./nix/ocaml#ppxlib": {},
"path:./nix/ocaml#reason": {},
"path:./nix/ocaml#result": {},
"ocamlPackages.alcotest": {
"resolved": "github:NixOS/nixpkgs/75a52265bda7fd25e06e3a67dee3f0354e73243c#ocamlPackages.alcotest",
"source": "nixpkg"
},
"ocamlPackages.dune_3": {
"resolved": "github:NixOS/nixpkgs/75a52265bda7fd25e06e3a67dee3f0354e73243c#ocamlPackages.dune_3",
"source": "nixpkg"
},
"ocamlPackages.findlib": {
"resolved": "github:NixOS/nixpkgs/75a52265bda7fd25e06e3a67dee3f0354e73243c#ocamlPackages.findlib",
"source": "nixpkg"
},
"ocamlPackages.ocaml": {
"resolved": "github:NixOS/nixpkgs/75a52265bda7fd25e06e3a67dee3f0354e73243c#ocamlPackages.ocaml",
"source": "nixpkg"
},
"ocamlPackages.ocaml-lsp": {
"resolved": "github:NixOS/nixpkgs/75a52265bda7fd25e06e3a67dee3f0354e73243c#ocamlPackages.ocaml-lsp",
"source": "nixpkg"
},
"ocamlPackages.ocamlformat": {
"resolved": "github:NixOS/nixpkgs/75a52265bda7fd25e06e3a67dee3f0354e73243c#ocamlPackages.ocamlformat",
"source": "nixpkg"
},
"ocamlPackages.ocamlformat-rpc-lib": {
"resolved": "github:NixOS/nixpkgs/75a52265bda7fd25e06e3a67dee3f0354e73243c#ocamlPackages.ocamlformat-rpc-lib",
"source": "nixpkg"
},
"ocamlPackages.ppxlib": {
"resolved": "github:NixOS/nixpkgs/75a52265bda7fd25e06e3a67dee3f0354e73243c#ocamlPackages.ppxlib",
"source": "nixpkg"
},
"yarn": {
"resolved": "github:NixOS/nixpkgs/f80ac848e3d6f0c12c52758c0f25c10c97ca3b62#yarn",
"source": "nixpkg"
Expand Down
2 changes: 1 addition & 1 deletion dune-project
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
(lang dune 2.6)
(name re-formality-ppx)
(name re-formality-ppx)
1 change: 1 addition & 0 deletions dune-workspace
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
(lang dune 2.6)
22 changes: 0 additions & 22 deletions esy.json

This file was deleted.

3 changes: 0 additions & 3 deletions esy.lock/.gitattributes

This file was deleted.

3 changes: 0 additions & 3 deletions esy.lock/.gitignore

This file was deleted.

Loading
Loading