Skip to content

Commit 42e0a81

Browse files
authored
Clean up installation page & remove old doc installation page (#277)
1 parent f308838 commit 42e0a81

File tree

2 files changed

+46
-110
lines changed

2 files changed

+46
-110
lines changed

pages/docs/manual/latest/installation.mdx

Lines changed: 46 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -24,88 +24,54 @@ npm run build
2424
node src/Demo.bs.js
2525
```
2626

27-
<!-- TODO: rescript template -->
28-
29-
That compiles your ReScript into JavaScript, then uses NodeJS to run said JavaScript. **We recommend you use our highly unique workflow of keeping a tab open for the generated `.bs.js` file**, so that you can learn how ReScript transforms to JavaScript. Not many languages output clean JavaScript code you can manually inspect!
27+
That compiles your ReScript into JavaScript, then uses NodeJS to run said JavaScript. **We recommend you use our unique workflow of keeping a tab open for the generated `.bs.js` file**, so that you can learn how ReScript transforms into JavaScript. Not many languages output clean JavaScript code you can inspect and learn from!
3028

3129
During development, instead of running `npm run build` each time to compile, use `npm run start` to start a watcher that recompiles automatically after file changes.
3230

33-
Alternatively, **to start a [rescript-react](/docs/react/latest/introduction) app**, follow the instructions [here](/docs/react/latest/installation).
34-
3531
## Integrate Into Existing JS Project
3632

37-
You can install ReScript locally into an existing JavaScript project using the following steps.
38-
39-
### Install ReScript
40-
41-
```sh
42-
npm install --save-dev bs-platform
43-
```
44-
45-
### Create config file
46-
47-
Create a `bsconfig.json` file in the root of your project with the following content.
48-
49-
```json
50-
{
51-
"name": "your-project-name",
52-
"bsc-flags": ["-bs-super-errors"],
53-
"sources": [
54-
{
55-
"dir": "src",
56-
"subdirs": true
57-
}
58-
],
59-
"package-specs": [
60-
{
61-
"module": "es6",
62-
"in-source": true
63-
}
64-
],
65-
"suffix": ".bs.js",
66-
"namespace": true,
67-
"bs-dependencies": [],
68-
"ppx-flags": [],
69-
"refmt": 3
70-
}
71-
```
72-
73-
> Update `sources` to indicate where your ReScript source files will be located.
74-
75-
See [Build Configuration](build-configuration) for more details on `bsconfig.json`.
76-
77-
### Add scripts to package.json
78-
79-
You may also like to add two scripts to your `package.json` to help with compiling ReScript.
80-
81-
```json
82-
"scripts": {
83-
"re:build": "bsb -make-world -clean-world",
84-
"re:watch": "bsb -make-world -clean-world -w"
85-
}
86-
```
87-
88-
### Enabling React JS
89-
90-
If you would like to enable React in your ReScript code, use the following additional steps:
91-
92-
Install [rescript-react](/docs/react/latest/introduction). Here's the quick version:
93-
94-
```sh
95-
npm install @rescript/react --save
96-
```
97-
98-
Make the following changes to your `bsconfig.json` file:
99-
100-
```json
101-
"reason": { "react-jsx": 3 },
102-
"bs-dependencies": ["@rescript/react"],
103-
```
104-
105-
### Integration with the Existing Code
106-
107-
Since ReScript compiles to clean readable JS files the rest of your existing toolchain (e.g. Babel and Webpack) should just work.
108-
109-
See the [Export to JS guide](import-from-export-to-js#export-to-javascript) to learn how to import ReScript compiled modules into your existing project.
110-
111-
See the [Converting from JS guide](converting-from-js) to learn how to convert existing JS code to ReScript.
33+
If you already have a JavaScript project into which you'd like to add ReScript:
34+
35+
- Install ReScript locally as a [devDependency](https://docs.npmjs.com/specifying-dependencies-and-devdependencies-in-a-package-json-file):
36+
```sh
37+
npm install --save-dev bs-platform
38+
```
39+
- Create a ReScript build configuration at the root:
40+
```json
41+
{
42+
"name": "your-project-name",
43+
"sources": [
44+
{
45+
"dir": "src", // update this to wherever you're putting ReScript files
46+
"subdirs": true
47+
}
48+
],
49+
"package-specs": [
50+
{
51+
"module": "es6",
52+
"in-source": true
53+
}
54+
],
55+
"suffix": ".bs.js",
56+
"bs-dependencies": []
57+
}
58+
```
59+
See [Build Configuration](build-configuration) for more details on `bsconfig.json`.
60+
- Add convenience `npm` scripts to `package.json`:
61+
```json
62+
"scripts": {
63+
"re:build": "bsb -make-world -clean-world",
64+
"re:start": "bsb -make-world -clean-world -w"
65+
}
66+
```
67+
68+
Since ReScript compiles to clean readable JS files, the rest of your existing toolchain (e.g. Babel and Webpack) should just work!
69+
70+
Helpful guides:
71+
- [Converting from JS](converting-from-js).
72+
- [Shared Data Types](shared-data-types).
73+
- [Import from/Export to JS](import-from-export-to-js).
74+
75+
### Integrate with a ReactJS Project
76+
77+
To start a [rescript-react](/docs/react/latest/introduction) app, or to integrate ReScript into an existing ReactJS app, follow the instructions [here](/docs/react/latest/installation).

pages/docs/reason-compiler/latest/new-project.mdx

Lines changed: 0 additions & 30 deletions
This file was deleted.

0 commit comments

Comments
 (0)