How to target subdirectories in BuckleScript bsconfig.json
Asked Answered
P

2

7

I have the following folder structure

--| button
--|--| button.re
main.re

In my bsconfig.json, using the quickstart guide found here. I have in my config the following key/value:

"sources": [
  "src/"
]

It is only targeting the main.re file. I have tried some conventional config options such as *.re, but to no avail. If I would like to target all sub-directories, how would I do so? Thank you.

Psychoneurosis answered 13/9, 2017 at 1:56 Comment(1)
One way to circumvent the problem is to not have nested directories at all, and instead put all your source files in a single directory, with names like ui_Button.re. You'll then also need a 'table of contents' module for each level of the hierarchy to set up the nested module structure using module aliases, e.g. in ui.re: module Button = Ui_Button.Commutable
M
10

There was actually a PR merged just yesterday that adds support for directory traversal. It'll be in the next release, which should be out shortly.

The configuration will then be:

"sources": [{"dir": "src", "subdirs": true}]

Edit: This feature was released in 1.9.2

Mahon answered 14/9, 2017 at 20:6 Comment(2)
I will say I am running across some errors using the above, and will try to be vocal in github repo.Psychoneurosis
Happy to help! You're more than welcome to hop on to the Reason Discord to ask for help too. The author of BuckleScript hangs around there as well.Mahon
P
6

Looking at documentation the solution would be the following:

"sources": [{"dir": "src", "subdirs": ["button"]}],

Source for documentation: https://bucklescript.github.io/bucklescript/docson/#build-schema.json

Psychoneurosis answered 13/9, 2017 at 2:1 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.