@lozlow/bs-atdgen-generator

0.2.0 • Public • Published

Project is under migration

The installation instructions still point to the old binaries, the project has changed owners but I haven't had a chance to publish binaries under my name yet. Apologies.

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 @lozlow/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.

Package Sidebar

Install

npm i @lozlow/bs-atdgen-generator

Weekly Downloads

0

Version

0.2.0

License

MIT

Unpacked Size

15.6 MB

Total Files

10

Last publish

Collaborators

  • lozlow