Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Compiling Reason source files to the same directory as the source files

I'm writing a node application, where I would like to mix Reason and raw JavaScript.

This section in the bucklescript documentation describes it

When user has an existing JS project, it makes sense to output the JS file in the same directory as vanilla JS, the schema added a key called in-source so that generate JS file next to ML file.

I assume that this is in the bsconfig.json file? But what value should the key have? The schema documentation does not mention this option.

I'm running Bucklescript version 1.9.1 - so the functionality should be available (available since 1.9.0).

How do I use the in-source option?

My bsconfig.json file looks like this:

{
  "name": "re-server",
  "version": "0.1.0",
  "bsc-flags": ["-bs-super-errors"],
  "in-source": true,  // I tried adding the key here
  "sources": [{
    "dir": "src",
    "in-source": true  // I tried adding the key here
  }
  ],
  "bs-dependencies" : [
    "bs-express"
  ]
}
like image 992
Pete Avatar asked Oct 15 '17 17:10

Pete


1 Answers

It should be in the "package-specs" section:

{
  ...
  "package-specs" : [{
    "module": ...,
    "in-source": true
  }]
}

So your bsconfig.json should look like:

{
  "name": "re-server",
  "version": "0.1.0",
  "bsc-flags": ["-bs-super-errors"],
  "package-specs" : [{
    "module": "commonjs",
    "in-source": true
  }],
  "sources": [{
    "dir": "src"
  }
  ],
  "bs-dependencies" : [
    "bs-express"
  ]
}
like image 68
glennsl Avatar answered Nov 20 '22 01:11

glennsl