You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* replace the basic theme Reason project with the bsb-native example
* note behavior to create a new project
* add back bs-dependencies to basic template bsconfig; code review nits
* add back code review nit; rebase off master
Copy file name to clipboardExpand all lines: README.md
+23-14Lines changed: 23 additions & 14 deletions
Original file line number
Diff line number
Diff line change
@@ -8,7 +8,7 @@ Bsb-native is a fork of [bsb](http://bucklescript.github.io/bucklescript/Manual.
8
8
2) Add a `bsconfig.json` like you would for bsb. Bsb-native uses the same schema, located [here](http://bucklescript.github.io/bucklescript/docson/#build-schema.json) with small additions like `entries`.
@@ -25,6 +25,16 @@ For [example](https://github.com/bsansouci/BetterErrors/tree/bsb-support):
25
25
26
26
That will pickup the first entry's `backend` and build all entries to that `backend`. e.g if you have multiple `bytecode` targets, they'll all get built but not the `js` ones nor `native` ones. If you want to build to all targets you need to run the build command multiple times with different `-backend`.
27
27
28
+
## Initialize a new package
29
+
30
+
Bsb-native comes with a basic init package to get you started. To create a package named Hello run:
31
+
32
+
```sh
33
+
bsb -init Hello
34
+
```
35
+
36
+
And a folder named `Hello` will be created with a basic project layout. If you want to initialize an already created folder, use `.` as the last argument.
37
+
28
38
## Useful flags
29
39
The `-make-world` flag builds all of the dependencies and the project.
30
40
@@ -37,7 +47,7 @@ The `-backend [js|bytecode|native]` flag tells `bsb-native` to build all entries
37
47
The build artifacts are put into the folder `lib/bs`. The bytecode executable would be at `lib/bs/bytecode/index.byte` and the native one at `lib/bs/native/index.native` for example.
38
48
39
49
## Opam packages
40
-
Yes `bsb-native` supports opam packages (see [ocamlfind example](https://github.com/bsansouci/bsb-native-example/tree/opam-example)).
50
+
Yes `bsb-native` supports opam packages (see [ocamlfind example](https://github.com/bsansouci/bsb-native-example/tree/opam-example)).
41
51
**BUT** you need to be on the switch `4.02.3+buckle-master` (which you can get to by running `opam switch 4.02.3+buckle-master`).
// Command invoked first, before bsb tries to build anything else.
98
-
// Useful for building C code linked into the exec using
108
+
// Useful for building C code linked into the exec using
99
109
// `static-libraries`.
100
110
"build-script":"make",
101
111
@@ -123,4 +133,3 @@ include
123
133
}];
124
134
```
125
135
inside a file called `MyModule` (for example). Then when you build to JS that module will use the `MyModule_Js` implementation. Same for native/bytecode. This is deeply integrated into bsb-native to make everything easier.
This is a quick demo project to showcase [bsb-native](https://github.com/bsansouci/bsb-native).
2
5
3
-
# Build
4
-
```
5
-
npm run build
6
-
```
6
+
For publishing on opam see [opam_of_packagejson](https://github.com/bsansouci/opam_of_packagejson/) as a helper.
7
7
8
-
# Watch
9
8
10
-
```
11
-
npm run watch
12
-
```
9
+
## Install
10
+
`npm i`
13
11
12
+
## Build bytecode
13
+
`npm run build`
14
14
15
-
# Editor
16
-
If you use `vscode`, Press `Windows + Shift + B` it will build automatically
15
+
To build other targets (like native or js) you can call bsb directly (or add a npm script) with the `-backend` flag, like `./node_nodules/.bin/bsb -backend native` or `./node_nodules/.bin/bsb -backend js`.
0 commit comments