@jchavarri/bs-atdgen-generator
v0.1.0
Published
Atdgen prebuilt binaries for 3 major OS platforms.
Downloads
7,467
Maintainers
Readme
bs-atdgen-generator
Atdgen prebuilt binaries for 3 major OS platforms.
Mainly for BuckleScript users, to avoid the step of installing esy.
Getting started
(Prefer example? Check the test folder)
With yarn:
yarn add -D @jchavarri/bs-atdgen-generator
yarn --check-files
Tell bsb which files need to be processed:
"generators": [
{
"name": "atd_t",
"command": "yarn run atdgen -t $in"
},
{
"name": "atd_bs",
"command": "yarn run atdgen -bs $in"
}
],
Or with node:
npm install @jchavarri/bs-atdgen-generator --save-dev
And then:
"generators": [
{
"name": "atd_t",
"command": "npx atdgen -t $in"
},
{
"name": "atd_bs",
"command": "npx atdgen -bs $in"
}
],
Now that the generator is defined, add the files that need to be processed to sources
(still in bsconfig
):
"sources": {
"dir" : "src",
"subdirs" : true,
"generators": [
{
"name": "atd_t",
"edge": ["meetup_t.ml", "meetup_t.mli", ":", "meetup.atd"]
},
{
"name": "atd_bs",
"edge": ["meetup_bs.ml", "meetup_bs.mli", ":", "meetup.atd"]
}
]
},
For Windows users
Unfortunately, it's not possible for npx
or yarn run
to work directly in Windows environments, due to
the way ninja calls CreateProcess.
In order to use atdgen for this platform, there are two options:
1. Use relative path
In bsconfig.json
:
"generators": [
{
"name": "atd_t",
- "command": "npx atdgen -t $in"
+ "command": "../../node_modules/\@jchavarri/bs-atdgen-generator/atdgen.exe -t $in"
},
{
"name": "atd_bs",
- "command": "npx atdgen -bs $in"
+ "command": "../../node_modules/\@jchavarri/bs-atdgen-generator/atdgen.exe -bs $in"
}
],
2. Use cmd /c
:
"generators": [
{
"name": "atd_t",
- "command": "npx atdgen -t $in"
+ "command": "cmd /c npx atdgen -t $in"
},
{
"name": "atd_bs",
- "command": "npx atdgen -bs $in"
+ "command": "cmd /c npx atdgen -bs $in"
}
],
Both solutions are shell independent, and work with both Powershell and Windows bash.