Skip to content

Commit 03605d8

Browse files
committed
Update build overview / pinned dependency doc
1 parent f8a2266 commit 03605d8

File tree

2 files changed

+18
-24
lines changed

2 files changed

+18
-24
lines changed

pages/docs/manual/latest/build-overview.mdx

Lines changed: 16 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -11,43 +11,37 @@ ReScript comes with a build system, bsb, that's meant to be fast, lean and used
1111

1212
The build description file is called `bsconfig.json`. Every ReScript project needs one.
1313

14-
**To build a project**, run:
14+
## Build Project
15+
16+
Each build will create build artifacts from your project's source files.
17+
18+
**To build a project (including its dependencies / pinned-dependencies)**, run:
1519

1620
```sh
1721
bsb -make-world
1822
```
1923

2024
Add `-w` to keep the built-in watcher running. Any new file change will be picked up and the build will re-run.
2125

22-
**Note**: third-party libraries (in `node_modules`) aren't watched, as doing so may exceed the node.js watcher count limit. If you're doing quick and dirty modifications inside `node_modules`, you have to do `bsb -clean-world -make-world` to rebuild them.
23-
24-
**Note 3**: If you are developing across multiple devices, you may find the `-ws` configuration useful in order to have live-reloading across the network. Possible configurations are:
25-
- `bsb -make-world -w -ws _` (default)
26-
- `bsb -make-world -w -ws 0.0.0.0:9999`
27-
- `bsb -make-world -w -ws 5000`
26+
**Note**: third-party libraries (in `node_modules`, or via `pinned-dependencies`) aren't watched, as doing so may exceed the node.js watcher count limit.
2827

29-
**To build only yourself**, use `bsb`.
28+
**Note 2**: In case you want to set up a project in a JS-monorepo-esque approach (`yarn workspaces` / `lerna`) where changes in your sub packages should be noticed by the compiler (`bsb -make-world`), you will need to define pinned dependencies in your main project's `bsconfig.json`. More details [here](./build-pinned-dependencies).
3029

31-
`bsb -help` to see all the available options.
30+
**To build only your project's files (without dependencies)**, run:
3231

33-
## Artifacts Cleaning
34-
35-
If you ever get into a stable build for edge-case reasons, use:
3632

3733
```sh
38-
bsb -clean-world
34+
bsb
3935
```
4036

41-
Or `bsb -clean` to clean only your own artifacts.
37+
## Clean Project
4238

43-
## Editor Support
39+
If you ever get into a stale build for edge-case reasons, use:
4440

45-
Bsb generates a `.merlin` file, used by various [editor plugins](editor-plugins.md) under the hood to power e.g. autocomplete, type hint, diagnosis, etc.
46-
47-
### Tips & Tricks
48-
49-
A typical problem with traditional build systems is that they're not resilient against the user moving/deleting source files. Most don't clean up the old artifacts correctly after such user action\*. Bsb is unfortunately no different, **unless** you turn on `"suffix": ".bs.js"` in `bsconfig.json`, in which case we can track which JS artifact belongs to which source file correctly, even against source file moving/deletion.
41+
```sh
42+
bsb -clean-world
43+
```
5044

51-
## Design Decisions
45+
This will clean all your project's build artifacts, including those in your dependencies. Alternatively you can run `bsb -clean` to clean your project's build artifacts only.
5246

53-
\* One such build system that tracks these correctly & efficiently is [Tup](http://gittup.org/tup/). See the (rather accessible!) paper [here](http://gittup.org/tup/build_system_rules_and_algorithms.pdf). Unfortunately, Tup's implementation uses FUSE and other systems, which we can't safely use on every platform.
47+
For more infos, run `bsb -help` to see all the available options.

pages/docs/manual/latest/build-pinned-dependencies.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Usually we'd recommend to use ReScript in a single-codebase style: One `bsconfig
1414
There are scenarios where you still want to connect and build multiple independent ReScript packages for one main project though. This is where `pinned-dependencies` come into play.
1515

1616

17-
### Package Types
17+
## Package Types
1818

1919
Before we go into detail, let's first explain all the different package types recognized by the build system:
2020

@@ -24,7 +24,7 @@ Before we go into detail, let's first explain all the different package types re
2424

2525
Whenever a package is being built (`bsb -make-world`), the build system will build the toplevel package with its pinned-dependencies. So any changes made in a pinned dependency will automatically be reflected in the final app.
2626

27-
### Build System Package Rules
27+
## Build System Package Rules
2828

2929
The build system respects the following rules for each package type:
3030

0 commit comments

Comments
 (0)