Skip to content

Commit 84b356b

Browse files
Merge pull request #747 from fhammerschmidt/rescript-json
rescript.json
2 parents 183becd + e5a8ce4 commit 84b356b

12 files changed

+24
-26
lines changed

misc_docs/syntax/decorator_react_component.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ You will need this decorator whenever you want to use a ReScript / React compone
1212

1313

1414
> **Note**
15-
> The `@react.component` decorator requires the [react-jsx or jsx config](/docs/react/latest/installation) to be set in your `bsconfig.json` to enable the required React transformations.
15+
> The `@react.component` decorator requires the [react-jsx or jsx config](/docs/react/latest/installation) to be set in your `rescript.json` to enable the required React transformations.
1616
1717
### Example
1818

pages/docs/gentype/latest/getting-started.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ npm install gentype --save-dev
1717
npx gentype --help
1818
```
1919

20-
Add a `gentypeconfig` section to your `bsconfig.json` (See [Configuration](#configuration) for details):
20+
Add a `gentypeconfig` section to your `rescript.json` (See [Configuration](#configuration) for details):
2121

2222
```
2323
"gentypeconfig": {
@@ -35,7 +35,7 @@ Add a `gentypeconfig` section to your `bsconfig.json` (See [Configuration](#conf
3535
## Configuration
3636

3737
Every `genType` powered project requires a configuration item `"gentypeconfig"`
38-
at top level in the project's `bsconfig.json`. The configuration has following
38+
at top level in the project's `rescript.json`. The configuration has following
3939
structure:
4040

4141
```js
@@ -67,7 +67,7 @@ structure:
6767

6868
A shim is a TS file that provides user-provided definitions for library types.
6969

70-
Configure your shim files within `"gentypeconfig"` in your [`bsconfig.json`](https://github.com/rescript-lang/rescript-compiler/blob/master/jscomp/gentype_tests/typescript-react-example/bsconfig.json), and add relevant `.shims.ts` files in a directory which is visible by ReScript e.g. [`src/shims/`](https://github.com/rescript-lang/rescript-compiler/tree/master/jscomp/gentype_tests/typescript-react-example/src/shims). An example shim to export ReactEvent can be found [here](https://github.com/rescript-lang/rescript-compiler/blob/master/jscomp/gentype_tests/typescript-react-example/src/shims/ReactEvent.shim.ts).
70+
Configure your shim files within `"gentypeconfig"` in your [`rescript.json`](https://github.com/rescript-lang/rescript-compiler/blob/master/jscomp/gentype_tests/typescript-react-example/rescript.json), and add relevant `.shims.ts` files in a directory which is visible by ReScript e.g. [`src/shims/`](https://github.com/rescript-lang/rescript-compiler/tree/master/jscomp/gentype_tests/typescript-react-example/src/shims). An example shim to export ReactEvent can be found [here](https://github.com/rescript-lang/rescript-compiler/blob/master/jscomp/gentype_tests/typescript-react-example/src/shims/ReactEvent.shim.ts).
7171

7272
## Testing the Whole Setup
7373

pages/docs/manual/latest/api/belt.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ If you want to open Belt globally for all files in your project instead, you can
3030
"bsc-flags": ["-open Belt"],
3131
```
3232

33-
into your `bsconfig.json`.
33+
into your `rescript.json`.
3434

3535
**Note**: this is the **only** `open` we encourage.
3636

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,27 @@
11
---
22
title: "Configuration"
33
metaTitle: "Build System Configuration"
4-
description: "Details about the configuration of the ReScript build system (bsconfig.json)"
4+
description: "Details about the configuration of the ReScript build system (rescript.json)"
55
canonical: "/docs/manual/latest/build-configuration"
66
---
77

88
# Configuration
99

10-
`bsconfig.json` is the single, mandatory build meta file needed for `rescript`.
10+
`rescript.json` (or `rescript.json` in versions prior ReScript 11) is the single, mandatory build meta file needed for `rescript`.
1111

1212
**The complete configuration schema is [here](./build-configuration-schema)**. We'll _non-exhaustively_ highlight the important parts in prose below.
1313

1414
## name, namespace
1515

16-
`name` is the name of the library, used as its "namespace". You can activate namespacing through `"namespace": true` in your `bsconfig.json`. Namespacing is almost **mandatory**; we haven't turned it on by default yet to preserve backward-compatibility.
16+
`name` is the name of the library, used as its "namespace". You can activate namespacing through `"namespace": true` in your `rescript.json`. Namespacing is almost **mandatory**; we haven't turned it on by default yet to preserve backward-compatibility.
1717

1818
**Explanation**: by default, your files, once used as a third-party dependency, are available globally to the consumer. E.g. if you have an `Util.re` and the consumer also has a file of the same name, they will clash. Turning on `namespace` avoids this by wrapping all your own project's files into an extra module layer; instead of a global `Util` module, the consumer will see you as `MyProject.Util`. **The namespacing affects your consumers, not yourself**.
1919

2020
Aka, in ReScript, "namespace" is just a fancy term for an auto-generated module that wraps all your project's files (efficiently and correctly, of course!) for third-party consumption.
2121

2222
We don't do folder-level namespacing for your own project; all your own file names must be unique. This is a constraint that enables several features such as fast search and easier project reorganization.
2323

24-
**Note**: the `bsconfig.json` `name` should be the same as the `package.json` `name`, to avoid confusing corner-cases. However, this means that you can't use a camelCased names such as `MyProject`, since `package.json` and npm forbid you to do so (some file systems are case-insensitive). To have the namespace/module as `MyProject`, write `"name": "my-project"`. ReScript will turn that into the camelCased name correctly.
24+
**Note**: the `rescript.json` `name` should be the same as the `package.json` `name`, to avoid confusing corner-cases. However, this means that you can't use a camelCased names such as `MyProject`, since `package.json` and npm forbid you to do so (some file systems are case-insensitive). To have the namespace/module as `MyProject`, write `"name": "my-project"`. ReScript will turn that into the camelCased name correctly.
2525

2626
**Note on custom namespacing**: if for some reason, you need a namespace that is different from what your `name` will produce, you can directly send a string to the `namespace` option. For example, if your package is a binding named `bs-some-thing`, you can use `"namespace": "some-thing"` to get `SomeThing` namespace instead of `BsSomeThing`.
2727

@@ -148,7 +148,7 @@ Output to either CommonJS (the default) or ES6 modules. Example:
148148
- `"module": "es6-global"` resolves `node_modules` using relative paths. Good for development-time usage of ES6 in conjunction with browsers like Safari and Firefox that support ES6 modules today. **No more dev-time bundling**!
149149
- `"in-source": true` generates output alongside source files. If you omit it, it'll generate the artifacts into `lib/js`. The output directory is not configurable otherwise.
150150

151-
This configuration only applies to you, when you develop the project. When the project is used as a third-party library, the consumer's own `bsconfig.json` `package-specs` overrides the configuration here, logically.
151+
This configuration only applies to you, when you develop the project. When the project is used as a third-party library, the consumer's own `rescript.json` `package-specs` overrides the configuration here, logically.
152152

153153
## suffix
154154

pages/docs/manual/latest/build-external-stdlib.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ npm install [email protected] --save-dev
2828
npm install @rescript/[email protected]
2929
```
3030

31-
Then add this to `bsconfig.json`:
31+
Then add this to `rescript.json`:
3232

3333
```json
3434
{

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ canonical: "/docs/manual/latest/build-overview"
99

1010
ReScript comes with a build system, [`rescript`](https://www.npmjs.com/package/rescript), that's fast, lean and used as the authoritative build system of the community.
1111

12-
Every ReScript project needs a build description file, `bsconfig.json`.
12+
Every ReScript project needs a build description file, `rescript.json`.
1313

1414
## Options
1515

@@ -55,7 +55,7 @@ Any new file change will be picked up and the build will re-run.
5555

5656
**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.
5757

58-
**Note 2**: In case you want to set up a project in a JS-monorepo-esque approach (`npm` and `yarn` workspaces) where changes in your sub packages should be noticed by the build, you will need to define pinned dependencies in your main project's `bsconfig.json`. More details [here](./build-pinned-dependencies).
58+
**Note 2**: In case you want to set up a project in a JS-monorepo-esque approach (`npm` and `yarn` workspaces) where changes in your sub packages should be noticed by the build, you will need to define pinned dependencies in your main project's `rescript.json`. More details [here](./build-pinned-dependencies).
5959

6060
## Clean Project
6161

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ import Image from "src/components/Image";
2727

2828
ReScript itself uses a build system under the hood, called [Ninja](https://ninja-build.org). Ninja is like Make, but cross-platform, minimal, focuses in perf and destined to be more of a low-level building block than a full-blown build system. In this regard, Ninja's a great implementation detail for `rescript`.
2929

30-
ReScript reads into `bsconfig.json` and generates the Ninja build file in `lib/bs`. The file contains the low-level compiler commands, namespacing rules, intermediate artifacts generation & others. It then runs `ninja` for the actual build.
30+
ReScript reads into `rescript.json` and generates the Ninja build file in `lib/bs`. The file contains the low-level compiler commands, namespacing rules, intermediate artifacts generation & others. It then runs `ninja` for the actual build.
3131

3232
## The JS Wrapper
3333

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

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,7 @@ canonical: "/docs/manual/latest/build-pinned-dependencies"
77

88
# Pinned Dependencies
99

10-
**Since 8.4**
11-
12-
Usually we'd recommend to use ReScript in a single-codebase style by using one `bsconfig.json` file for your whole codebase.
10+
Usually we'd recommend to use ReScript in a single-codebase style by using one `rescript.json` file for your whole codebase.
1311

1412
There are scenarios where you still want to connect and build multiple independent ReScript packages for one main project though (`npm` workspaces-like "monorepos"). This is where `pinned-dependencies` come into play.
1513

@@ -60,13 +58,13 @@ Let's assume we have a codebase like this:
6058
myproject/
6159
app/
6260
- src/App.res
63-
- bsconfig.json
61+
- rescript.json
6462
common/
6563
- src/Header.res
66-
- bsconfig.json
64+
- rescript.json
6765
myplugin/
6866
- src/MyPlugin.res
69-
- bsconfig.json
67+
- rescript.json
7068
package.json
7169
```
7270

@@ -87,7 +85,7 @@ Our `package.json` file within our codebase root would look like this:
8785
```
8886

8987

90-
Our `app` folder would be our toplevel package, consuming our `common` and `myplugin` packages as `pinned-dependencies`. The configuration for `app/bsconfig.json` looks like this:
88+
Our `app` folder would be our toplevel package, consuming our `common` and `myplugin` packages as `pinned-dependencies`. The configuration for `app/rescript.json` looks like this:
9189

9290
```json
9391
{

pages/docs/manual/latest/converting-from-js.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ ReScript offers a unique project conversion methodology which:
1313

1414
## Step 1: Install ReScript
1515

16-
Run `npm install rescript` on your project, then imitate our [New Project](installation#new-project) workflow by adding a `bsconfig.json` at the root. Then start `npx rescript build -w`.
16+
Run `npm install rescript` on your project, then imitate our [New Project](installation#new-project) workflow by adding a `rescript.json` at the root. Then start `npx rescript build -w`.
1717

1818
## Step 2: Copy Paste the Entire JS File
1919

@@ -73,7 +73,7 @@ function queryResult(usePayload, payload) {
7373

7474
</CodeTab>
7575

76-
Add this file to `bsconfig.json`:
76+
Add this file to `rescript.json`:
7777

7878
```json
7979
"sources": {

pages/docs/manual/latest/import-from-export-to-js.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ We support 2 JavaScript import/export formats:
1919
- CommonJS: `require('myFile')` and `module.exports = ...`.
2020
- ES6 modules: `import * from 'MyReScriptFile'` and `export let ...`.
2121

22-
The format is [configurable in via `bsconfig.json`](build-configuration.md#package-specs).
22+
The format is [configurable in via `rescript.json`](build-configuration.md#package-specs).
2323

2424
## Import From JavaScript
2525

pages/docs/manual/latest/installation.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ If you already have a JavaScript project into which you'd like to add ReScript:
6262
"bs-dependencies": []
6363
}
6464
```
65-
See [Build Configuration](build-configuration) for more details on `bsconfig.json`.
65+
See [Build Configuration](build-configuration) for more details on `rescript.json`.
6666
- Add convenience `npm` scripts to `package.json`:
6767
```json
6868
"scripts": {

pages/docs/manual/latest/interop-with-js-build-systems.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ For what it's worth, you can also turn `rescript` into an automated step in your
2525

2626
### Tips & Tricks
2727

28-
You can make ReScript JS files look even more idiomatic through the in-source + bs suffix config in `bsconfig.json`:
28+
You can make ReScript JS files look even more idiomatic through the in-source + bs suffix config in `rescript.json`:
2929

3030
```json
3131
{

0 commit comments

Comments
 (0)