Skip to content

Commit

Permalink
Add quick setup section to installation
Browse files Browse the repository at this point in the history
  • Loading branch information
fhammerschmidt committed Dec 9, 2023
1 parent 99f280a commit a800af1
Showing 1 changed file with 24 additions and 12 deletions.
36 changes: 24 additions & 12 deletions pages/docs/manual/latest/installation.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -11,30 +11,42 @@ canonical: "/docs/manual/latest/installation"
- [Node.js](https://nodejs.org/) version >= 14
- [npm](https://docs.npmjs.com/cli/) (which comes with Node.js) or [Yarn](https://yarnpkg.com/)

## New Project
## Quick Setup

```sh
npm create rescript-app
```

1. Follow the steps of the setup.
2. Trigger a ReScript build

```sh
git clone https://github.com/rescript-lang/rescript-project-template
cd rescript-project-template
npm install
npm run res:build
node src/Demo.bs.js
```

or use the create-rescript-app tool:
3. If you selected the basic theme, simply run it with

```
node src/Demo.res.js
```

### New Project

### Manual Setup

```sh
npm create rescript-app // Select basic template
cd <your-rescript-project-name>
git clone https://github.com/rescript-lang/rescript-project-template
cd rescript-project-template
npm install
npm run res:build
node src/Demo.bs.js
node src/Demo.res.js
```

That compiles your ReScript into JavaScript, then uses Node.js 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!
That compiles your ReScript into JavaScript, then uses Node.js to run said JavaScript. **We recommend you use our unique workflow of keeping a tab open for the generated `.res.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!

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

## Integrate Into an Existing JS Project
### Integrate Into an Existing JS Project

If you already have a JavaScript project into which you'd like to add ReScript:

Expand All @@ -58,7 +70,7 @@ If you already have a JavaScript project into which you'd like to add ReScript:
"in-source": true
}
],
"suffix": ".bs.js",
"suffix": ".res.js",
"bs-dependencies": []
}
```
Expand Down

0 comments on commit a800af1

Please sign in to comment.