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

Test HMR with Rescript #37

Draft
wants to merge 1 commit 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
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,7 @@
/yarn-error.log
yarn-debug.log*
.yarn-integrity

.merlin
.bsb.lock
*.bs.js
5 changes: 5 additions & 0 deletions app/javascript/packs/rescript.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import * as React from 'react';

import Random from './random.bs.js';

export default ({ context, ...props }) => <Random props={props} context={context} />;
19 changes: 19 additions & 0 deletions app/javascript/rescript/random.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
.aboutSectionHeadContainer {
.subtitle {
max-width: 900px;
margin: 0 auto;
font-size: 18px;
color: $gray-text;
line-height: 25px;
text-align: center;
}

h2 {
color: $black;
font-size: 32px;
font-weight: 600;
line-height: 40px;
margin-bottom: 15px;
text-align: center;
}
}
7 changes: 7 additions & 0 deletions app/javascript/rescript/random.res
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
@module external css: {..} = "./random.css"

@react.component
let make = () =>
<div>
<h2>"Test"</h2>
</div>
34 changes: 34 additions & 0 deletions bsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"name": "quick-search-rescript",
"sources": [
{
"dir": "src",
"subdirs": true
}
],
"bs-dependencies": [
"@rescript/react",
"rescript-react-update",
"rescript-classnames",
"rescript-debounce-react",
"rescript-logger",
"bs-webapi"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You probably need only "@rescript/react for such test.

],
"reason": {
"react-jsx": 3
},
"package-specs": [
{
"module": "es6",
"in-source": true
}
],
"suffix": ".bs.js",
"bsc-flags": [
"-open Belt",
"-open Cx"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not needed, unless you plan to use rescript-classnames.

],
"ppx-flags": [
"rescript-logger/ppx"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not needed, unless you plan to userescript-logger.

]
}
9 changes: 9 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,17 @@
},
"devDependencies": {
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.1",
"@rescript/react": "0.10.3",
"fork-ts-checker-webpack-plugin": "^6.0.1",
"react-refresh": "^0.9.0",
"rescript": "9.1.2",
"rescript-classnames": "6.0.0",
"rescript-debounce-react": "1.0.0",
"rescript-logger": "2.0.2",
"rescript-react-update": "3.0.2",
"webpack-dev-server": "^4.7.3"
},
"scripts": {
"res:watch": "rescript build -w"
}
}
37 changes: 37 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1221,6 +1221,11 @@
schema-utils "^3.0.0"
source-map "^0.7.3"

"@rescript/[email protected]":
version "0.10.3"
resolved "https://registry.yarnpkg.com/@rescript/react/-/react-0.10.3.tgz#a2a8bed6b017940ec26c2154764b350f50348889"
integrity sha512-Lf9rzrR3bQPKJjOK3PBRa/B3xrJ7CqQ1HYr9VHPVxJidarIJJFZBhj0Dg1uZURX+Wg/xiP0PHFxXmdj2bK8Vxw==

"@trysound/[email protected]":
version "0.1.1"
resolved "https://registry.yarnpkg.com/@trysound/sax/-/sax-0.1.1.tgz#3348564048e7a2d7398c935d466c0414ebb6a669"
Expand Down Expand Up @@ -4390,6 +4395,38 @@ requires-port@^1.0.0:
resolved "https://registry.yarnpkg.com/requires-port/-/requires-port-1.0.0.tgz#925d2601d39ac485e091cf0da5c6e694dc3dcaff"
integrity sha1-kl0mAdOaxIXgkc8NpcbmlNw9yv8=

[email protected]:
version "6.0.0"
resolved "https://registry.yarnpkg.com/rescript-classnames/-/rescript-classnames-6.0.0.tgz#e833d9fc88e0e494c2ef39862721a80ab75fae32"
integrity sha512-hfOffijzIPnULtRZW3Kf0DCfCaw9lhGaMxf81WYlREieyBS2KNMcdI/8g5uSXFj0j4Ci21xkf70EFCKjuCTqpw==

[email protected]:
version "1.0.0"
resolved "https://registry.yarnpkg.com/rescript-debounce-react/-/rescript-debounce-react-1.0.0.tgz#8dd45967b818745dcb840439fd07bee10d06afde"
integrity sha512-WUgn8qGxWDXUHgOR4dDwI+h+FCWKdmZTBwCznvxTq/GiJZcusMr3fenazKiGIKzmxTUnnCCR2vcv43lq8YxZYA==
dependencies:
rescript-debounce "^1.0.0"

rescript-debounce@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/rescript-debounce/-/rescript-debounce-1.0.0.tgz#943ba92f4f8560b6dba387f0f2614db87ae47eb1"
integrity sha512-vb1UlJvReXl9+p6TubaoEF06VBfAXdw+GPtDOPflce2IrqwCgwBVRn6mvImNFktPvyYvvDFDi36lihDamAM48w==

[email protected]:
version "2.0.2"
resolved "https://registry.yarnpkg.com/rescript-logger/-/rescript-logger-2.0.2.tgz#fdcd564f0c04310cb673f475d501072d371bdeed"
integrity sha512-jbml41IgTyuiA7jnEYUqFeAKWnXAnlg5INCOpRPvhu99cLKFyFLl2B4GO04jznEDOgcpisJmwjm4WhfwhZETsQ==

[email protected]:
version "3.0.2"
resolved "https://registry.yarnpkg.com/rescript-react-update/-/rescript-react-update-3.0.2.tgz#8efece4c578110a35fdb1389d890a186dcdf03c6"
integrity sha512-oOOaeWma6XEhfZwlB/hB6u+UfYtuHjWS4RpoBeE8NbPX60GYLx5BLoVjEqLKoqXFPJv/2ZgghOKBn2LZo0VaJg==

[email protected]:
version "9.1.2"
resolved "https://registry.yarnpkg.com/rescript/-/rescript-9.1.2.tgz#a81f8a735f1a7006233bfc72eb081ca7182a0d79"
integrity sha512-4wHvTDv3nyYnAPJHcg1RGG8z7u3HDiBf6RN3P/dITDv859Qo35aKOzJWQtfBzbAs0EKNafLqei3TnUqiAv6BwQ==

resolve-cwd@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/resolve-cwd/-/resolve-cwd-3.0.0.tgz#0f0075f1bb2544766cf73ba6a6e2adfebcb13f2d"
Expand Down