Skip to content

Commit 957a09a

Browse files
committed
update docs
1 parent 4282bee commit 957a09a

File tree

4 files changed

+12
-7
lines changed

4 files changed

+12
-7
lines changed

jscomp/bsb/Docs.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Bsb is ReScript's build system. User-facing documentations are [here](https://re
44

55
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.
66

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`.
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.
88

99
## Add/edit a template
1010

scripts/pack.js

+8-4
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,9 @@ ${" ".repeat(indent)})`;
6060

6161
/**
6262
*
63-
* @param {string} templatesDir
6463
*/
65-
function main(templatesDir) {
64+
function updateThemes() {
65+
var templatesDir = path.join(__dirname, "..", "jscomp", "bsb", "templates");
6666
var output = child_process.spawnSync(`git clean -dfx ${templatesDir}`, {
6767
shell: true,
6868
encoding: "utf-8",
@@ -92,5 +92,9 @@ ${fs
9292
"utf8"
9393
);
9494
}
95-
var templatesDir = path.join(__dirname, "..", "jscomp", "bsb", "templates");
96-
main(templatesDir);
95+
exports.updateThemes = updateThemes;
96+
97+
98+
if (require.main === module) {
99+
updateThemes();
100+
}

scripts/prebuilt.js

+1
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ function buildCompiler() {
4343
}
4444
if (!is_windows) {
4545
if (!process.argv.includes("-noclean")) {
46+
require("./pack").updateThemes();
4647
rebuild();
4748
}
4849

scripts/release.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ function run() {
2121

2222
cp.execSync(`git clean -dfx stubs ext common syntax depends core bsb main .`,
2323
{ cwd: jscompDir, encoding: 'utf8', stdio: [0, 1, 2] })
24-
cp.execSync(`git clean -dfx templates && ocp-ocamlres templates -o bsb_templates.ml`,
25-
{ cwd: path.join(jscompDir,'bsb'), encoding: 'utf8', stdio: [0, 1, 2] })
24+
// cp.execSync(`git clean -dfx templates && ocp-ocamlres templates -o bsb_templates.ml`,
25+
// { cwd: path.join(jscompDir,'bsb'), encoding: 'utf8', stdio: [0, 1, 2] })
2626
cp.execSync(`ninja -t clean -g && ninja`,
2727
{ cwd: jscompDir, encoding: 'utf8', stdio: [0, 1, 2] })
2828
cp.execSync('ninja', {cwd : path.join(rootDir,'lib'), stdio:[0,1,2]})

0 commit comments

Comments
 (0)