Skip to content

Commit ffea8d3

Browse files
committed
add docs, address rescript-lang#1629
1 parent 94feb80 commit ffea8d3

File tree

2 files changed

+83
-3
lines changed

2 files changed

+83
-3
lines changed

docs/Manual.html

+46-2
Original file line numberDiff line numberDiff line change
@@ -514,7 +514,8 @@ <h1><a href="https://github.com/bloomberg/bucklescript">BuckleScript</a> User Ma
514514
</li>
515515
<li><a href="#_get_started">Get Started</a>
516516
<ul class="sectlevel2">
517-
<li><a href="#_first_example">First example</a></li>
517+
<li><a href="#_using_existing_templates_since_1_7_4">Using existing templates (@since 1.7.4 )</a></li>
518+
<li><a href="#_first_example_by_hand_without_samples">First example by hand without samples</a></li>
518519
<li><a href="#_an_example_with_multiple_modules">An example with multiple modules</a></li>
519520
</ul>
520521
</li>
@@ -1062,7 +1063,50 @@ <h4 id="_minimal_dependencies"><a class="anchor" href="#_minimal_dependencies"><
10621063
<h2 id="_get_started"><a class="anchor" href="#_get_started"></a>Get Started</h2>
10631064
<div class="sectionbody">
10641065
<div class="sect2">
1065-
<h3 id="_first_example"><a class="anchor" href="#_first_example"></a>First example</h3>
1066+
<h3 id="_using_existing_templates_since_1_7_4"><a class="anchor" href="#_using_existing_templates_since_1_7_4"></a>Using existing templates (@since 1.7.4 )</h3>
1067+
<div class="paragraph">
1068+
<p>BuckleScript provide some project templates, to help people get started on board as fast as possible.</p>
1069+
</div>
1070+
<div class="listingblock">
1071+
<div class="content">
1072+
<pre class="pygments highlight"><code data-lang="sh">npm install -g bs-platform <span class="tok-o">&amp;&amp;</span> bsb -init hello <span class="tok-o">&amp;&amp;</span> <span class="tok-nb">cd </span>hello <span class="tok-o">&amp;&amp;</span> npm run build</code></pre>
1073+
</div>
1074+
</div>
1075+
<div class="paragraph">
1076+
<p>First, it installs <code>bs-platform</code> globally, then we use the command line tool <code>bsb</code> to set up a sample project named <code>hello</code>, then we run the build.</p>
1077+
</div>
1078+
<div class="paragraph">
1079+
<p>The output project layout is similar as below</p>
1080+
</div>
1081+
<div class="listingblock">
1082+
<div class="content">
1083+
<pre class="pygments highlight"><code data-lang="sh">hello&gt;tree -d .
1084+
.
1085+
<span class="tok-p">|</span>---.vscode
1086+
├── lib
1087+
│   ├── bs
1088+
│   │   └── src
1089+
│   └── js
1090+
│   └── src
1091+
├── node_modules
1092+
│   └── bs-platform -&gt; ...
1093+
└── src</code></pre>
1094+
</div>
1095+
</div>
1096+
<div class="paragraph">
1097+
<p>To enter watch mode, you can run <code>npm run watch</code>,
1098+
then you can edit <code>src/demo.ml</code> and see it compiled on the fly, and changes are updated on <code>lib/js/src/demo.js</code></p>
1099+
</div>
1100+
<div class="paragraph">
1101+
<p>If you happen to use VSCode as editor, we provide <code>.vscode/tasks.json</code> as well, type <code>Tasks&gt;build</code>, it will enter watch mode, the great thing is that VSCode comes with
1102+
a <code>Problems</code> panel which has a much nicer UI.</p>
1103+
</div>
1104+
<div class="paragraph">
1105+
<p>Currently there are not too many project templates, you can contribute more project templates here <a href="https://github.com/bloomberg/bucklescript/tree/master/jscomp/bsb/templates">here</a>,</p>
1106+
</div>
1107+
</div>
1108+
<div class="sect2">
1109+
<h3 id="_first_example_by_hand_without_samples"><a class="anchor" href="#_first_example_by_hand_without_samples"></a>First example by hand without samples</h3>
10661110
<div class="ulist">
10671111
<ul>
10681112
<li>

site/docsource/Get_started.adoc

+37-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,42 @@
11
## Get Started
22

3-
### First example
3+
### Using existing templates (@since 1.7.4 )
4+
5+
BuckleScript provide some project templates, to help people get started on board as fast as possible.
6+
7+
[source,sh]
8+
--------------
9+
npm install -g bs-platform && bsb -init hello && cd hello && npm run build
10+
--------------
11+
12+
First, it installs `bs-platform` globally, then we use the command line tool `bsb` to set up a sample project named `hello`, then we run the build.
13+
14+
The output project layout is similar as below
15+
16+
[source,sh]
17+
-----------
18+
hello>tree -d .
19+
.
20+
|---.vscode
21+
├── lib
22+
│   ├── bs
23+
│   │   └── src
24+
│   └── js
25+
│   └── src
26+
├── node_modules
27+
│   └── bs-platform -> ...
28+
└── src
29+
-----------
30+
31+
To enter watch mode, you can run `npm run watch`,
32+
then you can edit `src/demo.ml` and see it compiled on the fly, and changes are updated on `lib/js/src/demo.js`
33+
34+
If you happen to use VSCode as editor, we provide `.vscode/tasks.json` as well, type `Tasks>build`, it will enter watch mode, the great thing is that VSCode comes with
35+
a `Problems` panel which has a much nicer UI.
36+
37+
Currently there are not too many project templates, you can contribute more project templates here https://github.com/bloomberg/bucklescript/tree/master/jscomp/bsb/templates[here],
38+
39+
### First example by hand without samples
440

541
* Create a directory called `hello` and create `bsconfig.json` and `package.json`
642
as below:

0 commit comments

Comments
 (0)