forked from JerryI/wolfram-js-frontend
-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.prior.wls
executable file
·37 lines (29 loc) · 1.45 KB
/
config.prior.wls
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
wconfig = <|
"watch" -> "src",
"merge" -> {
"src/frontend.js",
"src/misc.js",
"https://raw.githubusercontent.com/JerryI/Mathematica-ThreeJS-graphics-engine/night/src/graphics3d.js"
},
"after" :> (
(* copy core files *)
CopyFile["src/core.js", "public/assets/core.js", OverwriteTarget->True];
CopyFile["src/converter.wls", "modules/converter.wls", OverwriteTarget->True];
Import["modules/converter.wls"];
CopyFile["src/notebook.wls", "modules/notebook.wls", OverwriteTarget->True];
Import["modules/notebook.wls"];
CopyFile["src/cells.wls", "modules/cells.wls", OverwriteTarget->True];
Import["modules/cells.wls"];
CopyFile["src/webobjects.wls", "shared/webobjects.wls", OverwriteTarget->True];
Import["shared/webobjects.wls"];
(* Rollup a bundle for graphics and cells*)
RunProcess[{"./node_modules/.bin/rollup", "--config", "rollup.config.mjs"}]//Print;
(* To change the order of the function. Rollup puts "var core" to the bottom, which is wrong *)
wcontent = Import["temp/bundle.js", "String"];
(* A bug of non-stricked mode *)
wcontent = StringReplace[wcontent, {"const top = typeof globalThis"->"const top0 = typeof globalThis", "chrome"->"chromee"}];
(* Export the modified bundle *)
Export["public/assets/notebooks/bundle.js", wcontent, "String"];
Print["merged"];
)
|>