Skip to content

Commit 337c12d

Browse files
committed
Mimic a package with compiler-builtins and update the upload_bundle.sh script to make it work with rescript-lang.org
1 parent 889fa49 commit 337c12d

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

packages/playground-bundling/scripts/generate_cmijs.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ function e(cmd) {
4848

4949
e(`npm install`);
5050
e(`npm link ${RESCRIPT_COMPILER_ROOT_DIR}`);
51+
e(`npx rescript clean`);
5152
e(`npx rescript`);
5253

5354
const packages = bsconfig["bs-dependencies"];
@@ -63,10 +64,16 @@ function buildCompilerCmij() {
6364
"ocaml"
6465
);
6566

66-
const rescriptCompilerCmijFile = path.join(PACKAGES_DIR, "compilerCmij.js");
67+
const outputFolder = path.join(PACKAGES_DIR, "compiler-builtins");
68+
69+
const cmijFile = path.join(outputFolder, `cmij.js`);
70+
71+
if (!fs.existsSync(outputFolder)) {
72+
fs.mkdirSync(outputFolder, { recursive: true });
73+
}
6774

6875
e(
69-
`find ${rescriptLibOcamlFolder} -name "*.cmi" -or -name "*.cmj" | xargs -n1 basename | xargs js_of_ocaml build-fs -o ${rescriptCompilerCmijFile} -I ${rescriptLibOcamlFolder}`
76+
`find ${rescriptLibOcamlFolder} -name "*.cmi" -or -name "*.cmj" | xargs -n1 basename | xargs js_of_ocaml build-fs -o ${cmijFile} -I ${rescriptLibOcamlFolder}`
7077
);
7178
}
7279

playground/playground_test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
require("./compiler.js")
2-
require("./packages/compilerCmij.js")
2+
require("./packages/compiler-builtins/cmij.js")
33
require("./packages/@rescript/react/cmij.js")
44
require("./packages/@rescript/core/cmij.js")
55

playground/upload_bundle.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ if [ ! -f "${NETRC_FILE}" ]; then
2929
echo "machine ${KEYCDN_SRV} login $KEYCDN_USER password $KEYCDN_PASSWORD" > "${NETRC_FILE}"
3030
fi
3131

32-
PACKAGES=( "@rescript/react")
32+
PACKAGES=( "compiler-builtins" "@rescript/react" "@rescript/core")
3333

3434
echo "Uploading compiler.js file..."
3535
curl --ftp-create-dirs -T "${SCRIPT_DIR}/compiler.js" --ssl --netrc-file $NETRC_FILE ftp://${KEYCDN_SRV}/v${VERSION}/compiler.js

0 commit comments

Comments
 (0)