@@ -7,7 +7,7 @@ When `rescript`, `@rescript/react` and `rescript-react-native` are installed, yo
7
7
can run the following command
8
8
9
9
``` console
10
- yarn bsb -make-world
10
+ npm run rescript
11
11
```
12
12
13
13
⚠️ _ If this process looks fast to you, don't be surprised, that's because ReScript is fast!_
@@ -51,17 +51,19 @@ extension if you have existing JavaScript covered by Flow.
51
51
⚠️ If you don’t want to use VSCode, we still recommend you to
52
52
[ get a ReScript editor plugin] ( https://rescript-lang.org/docs/manual/latest/editor-plugins ) .
53
53
54
- By having an IDE that handle ReScript compilation, you will not have to run a
55
- command in the terminal to handle this & will just have to follow the standard
54
+ 🎉 ** By having an IDE that handle ReScript compilation, you will not have to run a
55
+ command in the terminal** to handle this & will just have to follow the standard
56
56
React Native workflow, your ReScript files being compiled to JavaScript.
57
57
58
- You will also have inline errors & much more feature that won't be provided by
59
- using a CLI workflow.
58
+ _ You will also have inline errors & much more feature that won't be provided by
59
+ using a CLI workflow._
60
60
61
61
## Vscode workflow
62
62
63
63
When you open VSCode with the ReScript plugin, you won't have to do anything.
64
- The plugin will detect ReScript & will offer you to handle compilation.
64
+ The plugin will detect ReScript & will offer you to handle compilation by just clicking a button.
65
+
66
+ ![ VSCode ReScript plugin] ( /usage/vscode-alert.png )
65
67
66
68
⛑ _ Even if you decide to use Vscode or a smiliar IDE to ease your day to day
67
69
development workflow, you should have a look to CLI workflow so you know how it
@@ -73,35 +75,29 @@ When you use React Native, you usually always have a terminal opened around with
73
75
Metro Bundler running, which bundle the JavaScript files.
74
76
75
77
Now you need to also have a process watching for your ReScript files to compile
76
- then to JavaScript. The easiest way is to rely on ReScript ` bsb ` watch
78
+ then to JavaScript. The easiest way is to rely on ReScript ` rescript ` watch
77
79
option ` -w ` :
78
80
79
81
``` console
80
- yarn bsb -make-world -w
82
+ npm run rescript build -w
81
83
```
82
84
83
- If you are not familiar with ReScript ` bsb ` you should know that you might
85
+ If you are not familiar with ReScript ` rescript ` you should know that you might
84
86
sometimes have weird compilation errors due to outdated build artifacts. This
85
87
should not happen often but in case you are facing something weird, you can try
86
- using ` bsb ` ` - clean-world ` option
88
+ using ` rescript ` ` clean ` option
87
89
88
90
``` console
89
- yarn bsb -clean-world
90
- ```
91
-
92
- On a daily basis, you can use this complete command that will clean, build &
93
- watch for changes
94
-
95
- ``` console
96
- yarn bsb -clean-world -make-world -w
91
+ npm run rescript clean
97
92
```
98
93
99
94
You might want to add this two commands in your ` package.json ` scripts:
100
95
101
96
``` json
102
97
"scripts" : {
103
- "re:build" : " bsb -clean-world -make-world" ,
104
- "re:watch" : " bsb -clean-world -make-world -w" ,
98
+ "res:clean" : " rescript clean" ,
99
+ "res:build" : " rescript build" ,
100
+ "res:watch" : " rescript build -w" ,
105
101
"start" : " react-native start" ,
106
102
"ios" : " react-native run-ios" ,
107
103
"android" : " react-native run-android" ,
@@ -118,7 +114,7 @@ workflow
118
114
** In one terminal:**
119
115
120
116
``` console
121
- yarn re :watch
117
+ npm run res :watch
122
118
```
123
119
124
120
As soon as ` .res ` files are being compiled to ` .bs.js ` , you can either start the
@@ -129,13 +125,13 @@ are unfamiliar with _Android Studio_, you might be interested by
129
125
** In another terminal:**
130
126
131
127
``` console
132
- yarn ios
128
+ npm run ios
133
129
```
134
130
135
131
or
136
132
137
133
``` console
138
- yarn android
134
+ npm run android
139
135
```
140
136
141
137
This commands should open up a virtual device & start React Native
@@ -150,7 +146,7 @@ Now you can start coding by editing files in `src/`!
150
146
just run**
151
147
152
148
``` console
153
- yarn start
149
+ npm start
154
150
```
155
151
156
152
This avoid rebuilding the entire native parts & will just start React Native
@@ -162,18 +158,14 @@ metro bundler.
162
158
163
159
### Using JavaScript components from Reason
164
160
165
- @todo
166
-
167
- Meanwhile, check out
161
+ Check out
168
162
[ ReScript _ Import from/Export to JS_ page] ( https://rescript-lang.org/docs/manual/latest/import-from-export-to-js ) .
169
163
170
164
You can also browse the source of
171
- [ rescript-react-native] ( https://github.com/rescript-react-native/rescript-react-native/tree/master /src )
165
+ [ rescript-react-native] ( https://github.com/rescript-react-native/rescript-react-native/tree/main /src )
172
166
because that's exactly what this project is doing!
173
167
174
168
### Using ReScript React Native components from JavaScript
175
169
176
- @todo
177
-
178
- Meanwhile, check out
170
+ Check out
179
171
[ ReScript _ Import from/Export to JS_ page] ( https://rescript-lang.org/docs/manual/latest/import-from-export-to-js )
0 commit comments