Skip to content

ReScript Project spec #51

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed

ReScript Project spec #51

wants to merge 3 commits into from

Conversation

IwanKaramazow
Copy link
Contributor

Formalize the heuristics to detect compiler executables for editor tooling

@IwanKaramazow IwanKaramazow changed the title [DRAFT] ReScript Project spec [Draft] ReScript Project spec Dec 19, 2020
@IwanKaramazow IwanKaramazow marked this pull request as draft December 19, 2020 09:38
@IwanKaramazow
Copy link
Contributor Author

@bobzhang could you give this a review? Editor tooling needs to be able to get this correct for monorepos and normal projects.

@IwanKaramazow IwanKaramazow marked this pull request as ready for review December 19, 2020 09:56
@IwanKaramazow IwanKaramazow changed the title [Draft] ReScript Project spec ReScript Project spec Dec 19, 2020
Copy link
Member

@bobzhang bobzhang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can schedule a meeting if you find it more efficient

2. platform specific `bsc.exe` (formatter)
- Starting from the current open file, walk the filesystem upwards, until `./node_modules/bs-platform` is located
- `bsc.exe` is located at `path.join(foundDirectory, "./node_modules/bs-platform", platform, "bsc.exe")`

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not exact since if you are not in the root project but in a dependency, this might be wrong

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have a vague memory that there is something called path.resolve


1. `.compiler.log` (diagnostics)
- Starting from the current open file, walk the filesystem upwards, until `bsconfig.json` is located
- `.compiler.log` is located at `path.join(foundDirectory, "lib", "bs", ".compiler.log")`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is correct

1. `bsc.exe` can be found in `/root/node_modules/bs-platform/{platform}/bsc.exe`
2. `.compiler.log` can be found in `/root/folder1/lib/bs/.compiler.log`
3. `bsb` to get a build for this project and get the freshest data: `/root/folder1/node_modules/.bin/bsb`. Note that there's also a one in `/root/node_modules/.bin/bsb`. The bsb in the subfolder is a symlink to the one in the root's node_modules. Bsb needs a `bsconfig.json` in the current working directory, so the cwd for bsb needs to be `/root/folder1`

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems correct

1. run `yarn` in the root
2. build folder1: `cd folder1 && yarn bsb`
3. build folder2: `cd folder2 && yarn bsb`

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is incorrect. user should only run bsb in the main repo.
The project is organised with the assumption that there's only main entry point, user should never run bsb in different directories.

### Yarn workspace with multiple ReScript projects in subfolders where one is on a different bs-platform version

Monorepo where `folder1` and `folder2` are on `bs-platform` 8.4.2 and `folder3` on 8.3.3

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should not happen, since the main entry point decides the compiler version

@IwanKaramazow
Copy link
Contributor Author

@bobzhang if you have some time, would it be possible to schedule a short meeting to go over my questions and your feedback? It might be faster.

@chenglou
Copy link
Member

chenglou commented Jan 6, 2021

Superseded by #59 and 5caa099. Closing for now til we reopen this.

@chenglou chenglou closed this Jan 6, 2021
@chenglou chenglou deleted the project-heuristics branch January 6, 2021 09:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants