Skip to content

Commit 4282bee

Browse files
committed
update docs
1 parent d333db4 commit 4282bee

File tree

3 files changed

+11
-24
lines changed

3 files changed

+11
-24
lines changed

jscomp/bsb/Docs.md

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,9 @@ There's a `templates/` subdirectory. It's the thing shown when you do `bsb -them
88

99
## Add/edit a template
1010

11-
The content of `templates` is packed into `bsb_templates.ml` automatically when running `pack-templates.sh`, located in this directory.
11+
The content of `templates` is packed into `bsb_templates.ml` automatically when running [pack.js](../../scripts/pack.js).
1212

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:
14-
15-
```sh
16-
opam install ocp-ocamlres
17-
```
13+
When adding/editing a template the script needs to be rerun to update the relevant parts in `bsb_templates.ml`.
1814

1915
## Testing a template locally
2016

jscomp/bsb/pack-templates.sh

Lines changed: 0 additions & 11 deletions
This file was deleted.
Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,12 @@ ${" ".repeat(indent)})`;
5858
return output;
5959
}
6060

61-
function main() {
62-
var output = child_process.spawnSync(`git clean -dfx templates`, {
61+
/**
62+
*
63+
* @param {string} templatesDir
64+
*/
65+
function main(templatesDir) {
66+
var output = child_process.spawnSync(`git clean -dfx ${templatesDir}`, {
6367
shell: true,
6468
encoding: "utf-8",
6569
});
@@ -71,11 +75,9 @@ function main() {
7175
console.log(output.stderr);
7276
}
7377

74-
var templatesDir = path.join(__dirname, "templates");
75-
7678
// run git clean -dfx . first
7779
fs.writeFileSync(
78-
path.join(__dirname, "bsb_templates.ml"),
80+
path.join(templatesDir, "..", "bsb_templates.ml"),
7981
`
8082
type node =
8183
| Dir of string * node list
@@ -90,5 +92,5 @@ ${fs
9092
"utf8"
9193
);
9294
}
93-
94-
main();
95+
var templatesDir = path.join(__dirname, "..", "jscomp", "bsb", "templates");
96+
main(templatesDir);

0 commit comments

Comments
 (0)