Skip to content

Commit 9d3e0d0

Browse files
author
Maxime Mangel
committed
docs: add a dedicated page for the CLI
1 parent c89b7ce commit 9d3e0d0

File tree

2 files changed

+309
-1
lines changed

2 files changed

+309
-1
lines changed

docs/docs/getting-started/cli.md

Lines changed: 307 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,307 @@
1+
---
2+
title: Fable CLI
3+
layout: standard
4+
---
5+
6+
## Commands
7+
8+
### `fable`
9+
10+
Run Fable in release mode, `RELEASE` compiler directive will be set.
11+
12+
13+
### `fable watch`
14+
15+
Run Fable in watch mode, `DEBUG` compiler directive will be set.
16+
17+
```fs
18+
let host =
19+
#if DEBUG
20+
"http://localhost:8080"
21+
#else
22+
"https://myapp.com"
23+
#endif
24+
```
25+
26+
### `fable clean`
27+
28+
Remove `fable_modules` folders and files with specified extensions (default `.fs.js`).
29+
30+
## Options
31+
32+
33+
<table class="table is-hoverable is-striped" style="min-width: 300px">
34+
<thead>
35+
<tr>
36+
<th> Options </th>
37+
<th> Description </th>
38+
</tr>
39+
</thead>
40+
41+
<tbody>
42+
43+
<tr>
44+
<td>
45+
46+
`--cwd`
47+
</td>
48+
<td>
49+
50+
Working directory
51+
</td>
52+
</tr>
53+
54+
<tr>
55+
<td>
56+
57+
`-o|--outDir`
58+
</td>
59+
<td>
60+
61+
Redirect compilation output to a directory
62+
</td>
63+
</tr>
64+
65+
<tr>
66+
<td>
67+
68+
`-e|--extension`
69+
</td>
70+
<td>
71+
72+
Extension for generated JS files (default .fs.js)
73+
</td>
74+
</tr>
75+
76+
<tr>
77+
<td>
78+
79+
`-s|--sourceMaps`
80+
</td>
81+
<td>
82+
83+
Enable source maps
84+
</td>
85+
</tr>
86+
87+
<tr>
88+
<td>
89+
90+
`--sourceMapsRoot`
91+
</td>
92+
<td>
93+
94+
Set the value of the `sourceRoot` property in generated source maps
95+
</td>
96+
</tr>
97+
98+
<tr>
99+
<td>
100+
101+
`--define`
102+
</td>
103+
<td>
104+
105+
Defines a symbol for use in conditional compilation
106+
</td>
107+
</tr>
108+
109+
<tr>
110+
<td>
111+
112+
`-c|--configuration`
113+
</td>
114+
<td>
115+
116+
The configuration to use when parsing .fsproj with MSBuild, default is 'Debug' in watch mode, or 'Release' otherwise
117+
</td>
118+
</tr>
119+
120+
<tr>
121+
<td>
122+
123+
`--verbose`
124+
</td>
125+
<td>
126+
127+
Print more info during compilation
128+
</td>
129+
</tr>
130+
131+
<tr>
132+
<td>
133+
134+
`--silent`
135+
</td>
136+
<td>
137+
138+
Don't print any log during compilation
139+
</td>
140+
</tr>
141+
142+
<tr>
143+
<td>
144+
145+
`--typedArrays`
146+
</td>
147+
<td>
148+
149+
Compile numeric arrays as JS typed arrays (default is true for JS, false for TS)
150+
</td>
151+
</tr>
152+
153+
<tr>
154+
<td>
155+
156+
`--watch`
157+
</td>
158+
<td>
159+
160+
Alias of watch command
161+
</td>
162+
</tr>
163+
164+
<tr>
165+
<td>
166+
167+
`--watchDelay`
168+
</td>
169+
<td>
170+
171+
Delay in ms before recompiling after a file changes (default 200)
172+
</td>
173+
</tr>
174+
175+
<tr>
176+
<td>
177+
178+
`--run`
179+
</td>
180+
<td>
181+
182+
The command after the argument will be executed after compilation
183+
</td>
184+
</tr>
185+
186+
<tr>
187+
<td>
188+
189+
`--runFast`
190+
</td>
191+
<td>
192+
193+
The command after the argument will be executed BEFORE compilation
194+
</td>
195+
</tr>
196+
197+
<tr>
198+
<td>
199+
200+
`--runWatch`
201+
</td>
202+
<td>
203+
204+
Like run, but will execute after each watch compilation
205+
</td>
206+
</tr>
207+
208+
<tr>
209+
<td>
210+
211+
`--runScript`
212+
</td>
213+
<td>
214+
215+
Runs the generated script for last file with node
216+
217+
(Requires `"type": "module"` in package.json and at minimum Node.js 12.20, 14.14, or 16.0.0)
218+
</td>
219+
</tr>
220+
221+
<tr>
222+
<td>
223+
224+
`--yes`
225+
</td>
226+
<td>
227+
228+
Automatically reply 'yes' (e.g. with `clean` command)
229+
</td>
230+
</tr>
231+
232+
<tr>
233+
<td>
234+
235+
`--noRestore`
236+
</td>
237+
<td>
238+
239+
Skip `dotnet restore`
240+
</td>
241+
</tr>
242+
243+
<tr>
244+
<td>
245+
246+
`--noCache`
247+
</td>
248+
<td>
249+
250+
Recompile all files, including sources from packages
251+
</td>
252+
</tr>
253+
254+
<tr>
255+
<td>
256+
257+
`--exclude`
258+
</td>
259+
<td>
260+
261+
Don't merge sources of referenced projects with specified pattern (Intended for plugin development)
262+
</td>
263+
</tr>
264+
265+
<tr>
266+
<td>
267+
268+
`--optimize`
269+
</td>
270+
<td>
271+
272+
Compile with optimized F# AST (experimental)
273+
</td>
274+
</tr>
275+
276+
<tr>
277+
<td>
278+
279+
`--lang|--language`
280+
</td>
281+
<td>
282+
283+
Choose wich languages to compile to
284+
285+
Available options:
286+
- javascript (alias js) - **stable**
287+
- typescript (alias ts) - **stable**
288+
- python (alias py) - **beta**
289+
- rust (alias rs) - **beta**
290+
- dart - **beta**
291+
- php - **experimental**
292+
293+
Default is javascript
294+
295+
</td>
296+
</tr>
297+
298+
</tbody>
299+
</table>
300+
301+
## Environment variables
302+
303+
### `DOTNET_USE_POLLING_FILE_WATCHER`
304+
305+
When set to '1' or 'true', Fable watch will poll the file system for changes.
306+
This is required for some file systems, such as network shares,
307+
Docker mounted volumes, and other virtual file systems.

docs/docs/menu.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@
1717
"docs/getting-started/javascript",
1818
"docs/getting-started/typescript",
1919
"docs/getting-started/python",
20-
"docs/getting-started/rust"
20+
"docs/getting-started/rust",
21+
"docs/getting-started/cli"
2122
]
2223
},
2324
{

0 commit comments

Comments
 (0)