|
130 | 130 |
|
131 | 131 | ## Editor Support |
132 | 132 |
|
133 | | -#### Prepare Your Editor |
| 133 | +### Prepare Your Editor |
134 | 134 |
|
135 | 135 | Configure your editor to load the `Reason` plugins. See the instructions for |
136 | 136 | [Atom](http://facebook.github.io/reason/tools.html#merlin-atom) and |
137 | 137 | [Vim](https://github.com/facebook/reason/tree/master/editorSupport/VimReason) |
138 | 138 | and [emacs](https://github.com/facebook/reason/tree/master/editorSupport/emacs). |
139 | 139 |
|
140 | | -#### IDE support included. |
| 140 | +### IDE support included. |
141 | 141 |
|
142 | 142 | The editor configurations above prepare your editor to load the *actual* editor |
143 | 143 | support, from the `ReasonProject` build. The only thing we need is to make sure the `PATH` |
144 | 144 | contains all the important stuff from `ReasonProject`'s build at the time we launch |
145 | 145 | our editor. There are two approaches: one continues to avoid global variables |
146 | 146 | (as we've done so far), and the other doesn't. |
147 | 147 |
|
148 | | -##### Avoiding Global Paths |
| 148 | +#### Avoiding Global Paths |
149 | 149 |
|
150 | 150 | You can continue to develop entirely in the isolated sandbox without polluting |
151 | 151 | global environment variables, by opening your editor within the sandbox |
|
168 | 168 | > commenting out any part in your `bashrc` that sources opam environments. We |
169 | 169 | > will come up with a long term solution at some point. |
170 | 170 |
|
171 | | -##### Using Global Paths |
| 171 | +#### Using Global Paths |
172 | 172 |
|
173 | 173 | Pure sandboxed based development doesn't always work for certain workflows. |
174 | 174 | (prefixing *all* commands with `npm run` may not work well). In that case, you |
|
194 | 194 | [this repo](https://github.com/yunxing/opam-npm/) and the package will automatically |
195 | 195 | be ported (as soon as the daemon picks it up). |
196 | 196 |
|
197 | | -##### Add Another Dependency |
| 197 | +#### Add Another Dependency |
198 | 198 |
|
199 | 199 | **Option `1`:** Install a dependency into the project sandbox, and use `--save` |
200 | 200 | so that your `package.json` is updated. |
|
226 | 226 | need to configure the `reasonBuild` entry in `package.json` to add the `-pkg |
227 | 227 | dependencyPackage`. Consult your dependency's docs. |
228 | 228 |
|
| 229 | +Don't forget to add your new dependency also to the `.merlin` (configuration)[https://github.com/ocaml/merlin/wiki/emacs-from-scratch#using-libraries] with `PKG dependencyPackage` so that your editor knows about it too. |
| 230 | +
|
229 | 231 | ### Add Your Own Scripts |
230 | 232 |
|
231 | 233 | `npm` allows `scripts` to be specified in your project's `package.json`. These |
|
290 | 292 | > Note: We will soon make it impossible for these kinds of conflicts to occur. |
291 | 293 |
|
292 | 294 |
|
293 | | -#### Debugging Failed Dependencies |
| 295 | +### Debugging Failed Dependencies |
294 | 296 |
|
295 | 297 | When `npm install` fails to install one of your dependencies, it's typically |
296 | 298 | because a `postinstall` step of a package has failed. Read the logs to |
|
300 | 302 | `@opam-alpha/qcheck` package failed to install. Let's recreate the failure so |
301 | 303 | we can debug it. |
302 | 304 |
|
303 | | -#####Do a dry run: |
| 305 | +####Do a dry run: |
304 | 306 | Let's see what an `npm install` for this package *would* install. The `--dry-run` |
305 | 307 | flag avoids actually installing anything. |
306 | 308 |
|
|
321 | 323 | > Note: Sometimes it won't traverse `git` dependencies to find all the potentially installed |
322 | 324 | package. That's okay. |
323 | 325 |
|
324 | | -###### Install Source Without Building |
| 326 | +##### Install Source Without Building |
325 | 327 | So we want to install that now, but *without* executing the install scripts so we |
326 | 328 | pass the `--ignore-scripts` flag. Without that flag, it would fail when running |
327 | 329 | the scripts again, and then remove the package again! |
|
332 | 334 |
|
333 | 335 | This will just install the source code, and let us know what it actually installed. |
334 | 336 |
|
335 | | -###### Try The Build Manually, In Place |
| 337 | +##### Try The Build Manually, In Place |
336 | 338 | Now, make sure `npm` didn't do something weird with installing new versions of package |
337 | 339 | that didn't show up in the dry run, and make sure it installed things |
338 | 340 | as flat as possible in `node_modules`, as opposed to nesting `node_modules` |
|
0 commit comments