Skip to content

Improving the interaction between bsconfig & package.json #4621

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
BlueHotDog opened this issue Aug 13, 2020 · 5 comments
Closed

Improving the interaction between bsconfig & package.json #4621

BlueHotDog opened this issue Aug 13, 2020 · 5 comments
Labels
stale Old issues that went stale

Comments

@BlueHotDog
Copy link

Hey, following up the discussion here:
https://reasonml.chat/t/moving-bsconfig-to-package-json/2458/12
Opening this issue.

The problem

  • Developers need, for every package they install, add it to package.json + add it to bsconfig, this is both confusing(isnt required in any other common tojs lang) and error-prone.
  • Package name is required to match in bsconfig and package.json else weird errors happen

The theory

package.json should handle everything related to dependency management and packaging while bsconfig should handle compiler options(flags/errors/ppx etc).

The solution

  • remove the dependencies from bsconfig
  • remove name from bsconfig
  • when rescript runs make-world it'll scan all node_modules, packages that include a bsconfig will be compiled.
  • when rescript runs bsb, nothing changes

Bonus points

rename bsconfig to rsconfig?

@bobzhang
Copy link
Member

bobzhang commented Nov 6, 2020

There are some trade offs to be made.
The benefit for removing bsconfig.json is stated above.
The benefit for keeping it is that it is very easy to tell if it's a rescript project by inspecting whether bsconfig.json exists (like tsconfig.json). We need clear benefits to justify such big changes

@bobzhang bobzhang closed this as completed Nov 6, 2020
@BlueHotDog
Copy link
Author

Right, and i really would love us to follow typescript suite for everything related to developer ergonomics - Keep the bsconfig for BuckleScript configuration:

  • warnings/jsx etc etc.
  • Detecting if its a rescript project
  • enabled ppxes
    etc

Stop doing anything else:

  • What package is a dependency, this can easily be deducted from package.json(same way typescript is doing it) - This will reduce huge source of friction for newcomers(and old comers alike) - no one likes typing something twice and maintaining things in two places without some real benefit(to which i see very little if i'm not the linker developer)
  • Remove package name - package.json is the de-facto source of truth regarding the name of the package.

Would appreciate re-opening the issue as your answer didn't really address the pain point

@pgbradbury
Copy link

There is a ticket in the Typescript project asking for the same functionality. It is very easy to see what language a project is using without that file in the root.

You also don't have to remove bsconfig.json, you can make it a hierarchy where it would look in package.json first, then for bsconfig.json for example. This is similar to what many javascript packages do it, allowing the development organisation the choice.

The clear benefit is centralising all configuration into one file, for example in my existing js project, I have all config for linting, testing, transpiling etc. all in one place.

@joakin
Copy link

joakin commented Jul 3, 2022

package.json is a node.js specific feature, other platforms like deno, or tauri, do not use it. Having the compiler be tied to one platform and package manager seems like a bad decision thinking long term.

There is probably something in between like reading package.json dependencies if none are specified in rescript.json, or maybe add a flag to rescript.json with target/platform or something like that, and when that is node, rely on package.json and complain if the rescript.json has dependencies instead.

Copy link

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@github-actions github-actions bot added the stale Old issues that went stale label Oct 15, 2024
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Oct 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale Old issues that went stale
Projects
None yet
Development

No branches or pull requests

4 participants