forked from TheSpyder/rescript-atdgen-generator
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmakeBsconfig.js
58 lines (54 loc) · 1.13 KB
/
makeBsconfig.js
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
const fs = require("fs");
if (process.argv.length === 2) {
console.error("Expected one argument to atdgen binary");
process.exit(1);
}
const atdgenPath = process.argv[2];
const bsconfigJson = JSON.stringify(
{
name: "bs-atdgen-generator-integration-test",
generators: [
{
name: "atd_t",
command: `${atdgenPath} -t $in`,
},
{
name: "atd_bs",
command: `${atdgenPath} -bs $in`,
},
],
sources: [
"src",
{
dir: "src/atd",
generators: [
{
name: "atd_t",
edge: ["Foo_t.ml", "Foo_t.mli", ":", "Foo.atd"],
},
{
name: "atd_bs",
edge: ["Foo_bs.ml", "Foo_bs.mli", ":", "Foo.atd"],
},
],
},
],
"package-specs": {
module: "commonjs",
"in-source": true,
},
suffix: ".bs.js",
"bs-dependencies": ["@ahrefs/bs-atdgen-codec-runtime"],
warnings: {
error: "+101",
},
"generate-merlin": true,
namespace: true,
refmt: 3,
},
null,
2
);
fs.writeFileSync("bsconfig.json", bsconfigJson, {
encoding: "utf8",
});