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
Copy file name to clipboardExpand all lines: jscomp/bsb/README.md
+10Lines changed: 10 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -5,3 +5,13 @@ Bsb is BuckleScript's build system. User-facing documentations are [here](https:
5
5
This directory hosts its implementation. It reads into `bsconfig.json`, uses some BS/OCaml/Reason-specific logic, and generates a [ninja](https://ninja-build.org) build file then calls `ninja` on it. So much of the incremental build and perf work is delegated to Ninja.
6
6
7
7
There's a `templates/` subdirectory. It's the thing shown when you do `bsb -themes`. To generate a template for the user, it basically picks the chosen template from `templates/` and copy pastes it into the destined user directory while substituting some strings in those templates, like `${bsb:proj-version}` in the `package.json`s. The copy-pasting of folders isn't actually done naively through a call to unix `cp`. It's cleverly achieved through something called ocamlres. Please see more descriptions in `pack-templates.sh`.
8
+
9
+
## Add/edit a template
10
+
11
+
The content of `templates` is packed into `bsb_templates.ml` automatically when running `pack-templates.sh`, located in this directory.
12
+
13
+
When adding/editing a template the script needs to be rerun to update the relevant parts in `bsb_templates.ml`. The script uses [`ocamlres`](https://github.com/OCamlPro/ocp-ocamlres), a tool for embedding files inside ocaml executables. You will need to install it with [`opam`](https://opam.ocaml.org/doc/Install.html), ocaml package manager. Follow the [instructions](https://opam.ocaml.org/doc/Install.html) to install `opam`, if you haven't installed it yet. To install `ocp-ocamlres` run:
\ \"test\": \"echo \\\"Error: no test specified\\\" && exit 1\"\n\
1100
+
\ },\n\
1101
+
\ \"keywords\": [\n\
1102
+
\ \"BuckleScript\",\n\
1103
+
\ \"ReasonReact\",\n\
1104
+
\ \"reason-react\"\n\
1105
+
\ ],\n\
1106
+
\ \"author\": \"\",\n\
1107
+
\ \"license\": \"MIT\",\n\
1108
+
\ \"dependencies\": {\n\
1109
+
\ \"react\": \"^16.8.1\",\n\
1110
+
\ \"react-dom\": \"^16.8.1\",\n\
1111
+
\ \"reason-react\": \">=0.7.0\"\n\
1112
+
\ },\n\
1113
+
\ \"devDependencies\": {\n\
1114
+
\ \"bs-platform\": \"^${bsb:bs-version}\",\n\
1115
+
\ \"webpack\": \"^4.0.1\",\n\
1116
+
\ \"webpack-cli\": \"^3.1.1\",\n\
1117
+
\ \"webpack-dev-server\": \"^3.1.8\",\n\
1118
+
\ \"html-webpack-plugin\": \"^3.2.0\",\n\
1119
+
\ \"style-loader\": \"^1.0.0\",\n\
1120
+
\ \"css-loader\": \"^3.2.0\"\n\
1121
+
\ }\n\
1122
+
}\n\
1123
+
") ;
1124
+
File (".gitignore",
1125
+
".DS_Store\n\
1126
+
.merlin\n\
1127
+
.bsb.lock\n\
1128
+
npm-debug.log\n\
1129
+
/lib/bs/\n\
1130
+
/node_modules/\n\
1131
+
*.bs.js\n\
1132
+
") ;
1133
+
File ("README.md",
1134
+
"# Reason react starter\n\
1135
+
\n\
1136
+
## Run Project\n\
1137
+
\n\
1138
+
```sh\n\
1139
+
npm install\n\
1140
+
npm start\n\
1141
+
# in another tab\n\
1142
+
npm run server\n\
1143
+
```\n\
1144
+
\n\
1145
+
View the app in the browser at http://localhost:8000. Running in this environment provides hot reloading and support for routing; just edit and save the file and the browser will automatically refresh.\n\
1146
+
\n\
1147
+
To use a port other than 8000 set the `PORT` environment variable (`PORT=8080 npm run server`).\n\
1148
+
\n\
1149
+
## Build for Production\n\
1150
+
\n\
1151
+
```sh\n\
1152
+
npm run clean\n\
1153
+
npm run build\n\
1154
+
npm run webpack:production\n\
1155
+
```\n\
1156
+
\n\
1157
+
This will replace the development artifact `build/Index.js` for an optimized version as well as copy `src/index.html` into `build/`. You can then deploy the contents of the `build` directory (`index.html` and `Index.js`).\n\
1158
+
\n\
1159
+
**To enable dead code elimination**, change `bsconfig.json`'s `package-specs` `module` from `\"commonjs\"` to `\"es6\"`. Then re-run the above 2 commands. This will allow Webpack to remove unused code.\n\
0 commit comments