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

Support rescript.json #6382

Merged
merged 5 commits into from
Oct 9, 2023
Merged

Support rescript.json #6382

merged 5 commits into from
Oct 9, 2023

Conversation

cometkim
Copy link
Member

@cometkim cometkim commented Sep 4, 2023

Resolves #5278
Closes #6193

@cometkim
Copy link
Member Author

cometkim commented Sep 4, 2023

Note: This is essential to supporting the rescript.json. We need to discuss some existing issues.

1. Backporting

Do we need it for v10?

2. Simplifying config

The config is currently over-bloated. There are many variants of config structure, recursive definitions, deprecated features, and even undocumented features no one uses.

It adds a lot of complexity to the codebase, making refactoring and third-party replication difficult.

Here's a list we can point out:

  • reason (legacy jsx support)
  • generators, cut-generators (undocumented)
  • pp-flags (I think it is a deprecated one)
  • entries (???)
  • sources[].generators (undocumented)
  • sources[].group (undocumented)
  • sources[].resources (undocumented)
  • sources[].internal-depends (undocumented)
  • sources[].subdirs (recursive definition, it's too complex)

And maybe we can remove all the bs- prefixes from fields.

3. Refactoring plan

In the current codebase, the loading and parsing of rescript.json (or bsconfig.json) tends to be repetitive. This is because building config is an IO-heavy operation so difficult to reuse elsewhere.

I suggested separating "config" and "manifest" in my previous PR.

  • config: a program context
  • manifest: a parsed user input

Making manifest input pure logic can make it easier to reuse, and perhaps we can publish it to opam so third-party tools can use it.

4. Migration

This PR simply adds the printing message "bsconfig.json is deprecated"

It may be sufficient since bsconfig.json is still supported, but a more complex strategy may be needed to achieve "Simplifying config" and "Refactoring plan" together.

5. Further works

  • Documents, website, and comments need to change.
  • Blog post about it.
  • Interacting with library authors

@cometkim cometkim force-pushed the rescript-json branch 2 times, most recently from 4bcfc66 to f88643e Compare September 14, 2023 14:12
@cometkim
Copy link
Member Author

cometkim commented Oct 3, 2023

Just rebased PR.

I think this can be included in v11.0, we can then release the new configuration in v11.x in "compat mode"

No matter how we change the configuration, it should be in v12. I'll open a new issue for that.

@cknitt cknitt mentioned this pull request Oct 9, 2023
Copy link
Member

@cknitt cknitt left a comment

Choose a reason for hiding this comment

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

Thanks a lot for this! Looks good to me.
Also tested it against the project that I am currently working on.

@cristianoc @zth Anything to add from your side?

@cknitt cknitt merged commit 6aab920 into rescript-lang:master Oct 9, 2023
14 checks passed
@cometkim cometkim deleted the rescript-json branch October 10, 2023 01:38
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.

support both bsconfig.json and rescript.json
2 participants