Skip to content
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

Sources with type "dev" are not being compiled and are skipped. #124

Open
Yummy-sk opened this issue Jun 17, 2024 · 4 comments
Open

Sources with type "dev" are not being compiled and are skipped. #124

Yummy-sk opened this issue Jun 17, 2024 · 4 comments

Comments

@Yummy-sk
Copy link
Contributor

Yummy-sk commented Jun 17, 2024

I noticed that sources with the type "dev" are not being compiled and are being skipped in the get_source_files function. ( packages.rs#L451 )

Is there a reason for skipping the dev sources?

@CarlOlson
Copy link

Is this something that is being worked or would a PR be accepted? Any info on blockers would be nice. Without this I don't think most people will be able to use rewatch.

@rolandpeelen
Copy link
Member

A PR would be super helpful here @Yummy-sk / @CarlOlson - I remember me and @jfrolich having a discussion about this at some point but I can't recall exactly why we skipped them. Perhaps enabling them 'just works ™'

@rolandpeelen
Copy link
Member

Ok - so the reason we don't do this, is that for packages that get installed through node_modules, we sometimes don't find the folder. AKA - it's not in the files section of the package.json when being shipped.

Key example being the test folder of rescript-core - it's not in the corresponding package.json.

What we can do - and what we've done in the past, is just swallow the error, which I think could work here. We can just try to read the folder and compile.
However - this does come at a speed penalty as we're potentially building dev dependencies by third-parties. @jfrolich - IIRC, we currently don't distinguish between direct or transient dependencies, right? So there isn't currently a way of knowing wether the project should compile with dev or not.

Perhaps we should have a --debug and --release mode like Rust has? Where we compile the dev dependencies, unless we're building with --release mode?

@nojaf
Copy link

nojaf commented Nov 20, 2024

I believe I'm hitting this as well in https://github.com/rescript-lang/experimental-rescript-webapi
I don't think new tests/*.res (or changes) are picked up.

rescript.json snippet:

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

When users install my package the folder will indeed not be there.
But when I work on the project, it should compile these files.

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

No branches or pull requests

4 participants