Skip to content

Commit ea0dd35

Browse files
Dev environment using nix
1 parent 8bcf003 commit ea0dd35

File tree

9 files changed

+2180
-1589
lines changed

9 files changed

+2180
-1589
lines changed

HISTORY.md

Lines changed: 3 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -1,66 +1,5 @@
1-
## 5.0.2
2-
3-
Changes:
4-
5-
- Add compat with React 18 (a1bd63a)
6-
7-
## 5.0.1
8-
9-
Changes:
10-
11-
- Add compat with ReScript React 0.11.x (6c0d979)
12-
13-
## 5.0.0
14-
15-
Fixes:
16-
17-
- Fixed effect cleanup (1816f51)
18-
19-
## 4.0.0
20-
21-
Changes:
22-
23-
- **Breaking change**: the argument order has been changed to match React's APIs (af9447e)
24-
25-
## 3.0.2
26-
27-
Changes:
28-
29-
- Update React & React DOM peer dependencies (44c6959)
30-
31-
## 3.0.1
32-
33-
Fixes:
34-
35-
- Fixed `bsconfig` name (thanks @jasim) (2ebd081)
36-
37-
## 3.0.0
38-
39-
Changes:
40-
41-
- Move to ReScript (62665af)
42-
- Move from reason-react to @rescript/react (62665af)
43-
- Rename project to `rescript-react-update` (62665af)
44-
45-
## 2.0.0
46-
47-
Changes:
48-
49-
- Make effect management preact-safe (76664b6)
50-
511
## 1.0.0
522

53-
Features:
54-
55-
- Add `ReactUpdateLegacy` for uncancellable effects, easing the migration process if copy pasting from record API reducers (c4ccec5)
56-
- Add `useReducerWithMapState` API to enable lazy state init (19eee9a)
57-
58-
## 0.1.1
59-
60-
Changes:
61-
62-
- Stop exposing fullState
63-
64-
## 0.1.0
65-
66-
Initial release
3+
* Fork from `rescript-react-update`.
4+
* Re-design and extend the API.
5+
* Fix Effect cleanup before re-run an effect function.

OLD_HISTORY.md

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
# Old History from original lib: `rescript-react-update`
2+
3+
## 5.0.2
4+
5+
Changes:
6+
7+
- Add compat with React 18 (a1bd63a)
8+
9+
## 5.0.1
10+
11+
Changes:
12+
13+
- Add compat with ReScript React 0.11.x (6c0d979)
14+
15+
## 5.0.0
16+
17+
Fixes:
18+
19+
- Fixed effect cleanup (1816f51)
20+
21+
## 4.0.0
22+
23+
Changes:
24+
25+
- **Breaking change**: the argument order has been changed to match React's APIs (af9447e)
26+
27+
## 3.0.2
28+
29+
Changes:
30+
31+
- Update React & React DOM peer dependencies (44c6959)
32+
33+
## 3.0.1
34+
35+
Fixes:
36+
37+
- Fixed `bsconfig` name (thanks @jasim) (2ebd081)
38+
39+
## 3.0.0
40+
41+
Changes:
42+
43+
- Move to ReScript (62665af)
44+
- Move from reason-react to @rescript/react (62665af)
45+
- Rename project to `rescript-react-update` (62665af)
46+
47+
## 2.0.0
48+
49+
Changes:
50+
51+
- Make effect management preact-safe (76664b6)
52+
53+
## 1.0.0
54+
55+
Features:
56+
57+
- Add `ReactUpdateLegacy` for uncancellable effects, easing the migration process if copy pasting from record API reducers (c4ccec5)
58+
- Add `useReducerWithMapState` API to enable lazy state init (19eee9a)
59+
60+
## 0.1.1
61+
62+
Changes:
63+
64+
- Stop exposing fullState
65+
66+
## 0.1.0
67+
68+
Initial release

examples/LegacyUsage.re

Lines changed: 0 additions & 29 deletions
This file was deleted.

examples/Restate_Example.res

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ let make = () => {
4646

4747
}
4848

49-
module Exemple2 = {
49+
module Example2 = {
5050
module C = {
5151
type state = int
5252

flake.lock

Lines changed: 79 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
{
2+
description = "Rescript React Restate developers environment";
3+
4+
inputs = {
5+
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
6+
flake-utils.url = "github:numtide/flake-utils";
7+
rescript-compiler = {
8+
url = "github:rescript-lang/rescript-compiler?ref=10.1.3";
9+
flake = false;
10+
};
11+
};
12+
13+
outputs = { self, nixpkgs, flake-utils, rescript-compiler}:
14+
flake-utils.lib.eachSystem [ "x86_64-linux" ] (system:
15+
let
16+
pkgs = import nixpkgs { inherit system; };
17+
python3 = pkgs.python39;
18+
nodejs = pkgs.nodejs_18;
19+
yarn = pkgs.yarn.override { nodejs = nodejs; };
20+
rescript = pkgs.callPackage ./rescript.nix {
21+
inherit nodejs python3 rescript-compiler;
22+
inherit (pkgs) stdenv ocaml-ng;
23+
};
24+
in
25+
{
26+
packages = {
27+
rescript = rescript;
28+
};
29+
devShell = pkgs.mkShell {
30+
buildInputs = [
31+
python3
32+
nodejs
33+
yarn
34+
rescript
35+
];
36+
shellHook = ''
37+
yarn install
38+
ln -s "${rescript}/rescript" "$PWD/node_modules/.bin/rescript"
39+
ln -s ${rescript} "$PWD/node_modules/rescript"
40+
export PATH="${rescript}:$PWD/node_modules/.bin:$PATH"
41+
'';
42+
};
43+
}
44+
);
45+
}

package.json

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,22 @@
11
{
22
"name": "rescript-react-update",
3-
"version": "5.0.2",
3+
"version": "1.0.0",
44
"scripts": {
5-
"build": "bsb -make-world",
6-
"start": "bsb -make-world -w",
7-
"clean": "bsb -clean-world",
8-
"test": "bsb -make-world",
9-
"dev": "bsb -make-world && parcel examples/index.html"
5+
"dev": "yarn re:build && parcel examples/index.html",
6+
"re:build": "rescript",
7+
"re:watch": "rescript build -w"
108
},
11-
"bugs": "https://github.com/bloodyowl/rescript-react-update/issues",
9+
"bugs": "https://github.com/emeks-studio/rescript-react-restate/issues",
1210
"repository": {
1311
"type": "git",
14-
"url": "https://github.com/bloodyowl/rescript-react-update.git"
12+
"url": "https://github.com/emeks-studio/rescript-react-restate.git"
1513
},
1614
"keywords": [
17-
"reason-react",
15+
"rescript-react",
1816
"rescript",
1917
"react"
2018
],
21-
"author": "bloodyowl <bloodyowl@icloud.com>",
19+
"author": "mk <mirko@emeks.com.ar>",
2220
"license": "MIT",
2321
"peerDependencies": {
2422
"@rescript/react": "^0.10.1 || ^0.11.0",
@@ -27,7 +25,6 @@
2725
},
2826
"devDependencies": {
2927
"@rescript/react": "^0.10.1",
30-
"bs-platform": "^8.3.0",
3128
"parcel-bundler": "^1.12.5",
3229
"react": "^16.8.0",
3330
"react-dom": "^16.8.0"

rescript.nix

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{ stdenv
2+
, python3
3+
, nodejs
4+
, ocaml-ng
5+
, rescript-compiler
6+
}:
7+
8+
stdenv.mkDerivation {
9+
name = "rescript";
10+
version = rescript-compiler.shortRev;
11+
src = rescript-compiler;
12+
BS_RELEASE_BUILD = "true";
13+
buildInputs = [ nodejs python3 ];
14+
patchPhase = ''
15+
sed -i 's:./configure.py --bootstrap:python3 ./configure.py --bootstrap:' ./scripts/install.js
16+
mkdir -p native/4.14.1/bin/
17+
ln -s ${ocaml-ng.ocamlPackages_4_14.ocaml}/bin/ocamlopt.opt native/4.14.1/bin/ocamlopt.opt
18+
'';
19+
dontConfigure = true;
20+
buildPhase = ''
21+
# release build https://github.com/BuckleScript/bucklescript/issues/4091#issuecomment-574514891
22+
node scripts/install.js
23+
'';
24+
installPhase = ''
25+
cp -rf . $out
26+
'';
27+
}

0 commit comments

Comments
 (0)