rescript-compiler icon indicating copy to clipboard operation
rescript-compiler copied to clipboard

npm install should not build the compiler in local development

Open cknitt opened this issue 3 years ago • 1 comments

Currently, the npm post install script (scripts/install.js) builds ninja and the compiler if they are not present already. This is meant for installation of the finished npm package so that, on platforms without prebuilt binaries, the compiler is built automatically when the npm package is installed.

There was a discussion in https://forum.rescript-lang.org/t/platform-support-and-prebuilt-binaries-postinstall-scripts/3443/9 if this is even needed or if it would be sufficient to provide prebuilt binaries for all platforms that we intend to support.

But even if we keep the "build on install" mechanism as it is, IMHO it should not be what happens when you check out the compiler repo (for compiler development purposes) and run "npm install" there. In this case, I would prefer to really just install the npm dependencies required for development, and run any build commands separately via make, dune etc.

There is already a packages folder in the repo. We could put the package.json as it is intended to go into the finished npm package into packages/rescript, and keep only what's needed for local development in the package.json in the project root.

cknitt avatar Sep 21 '22 14:09 cknitt

"on platforms without prebuilt binaries" and also when npm installing a specific commit

cristianoc avatar Sep 21 '22 15:09 cristianoc

Actually I think we should not build the compiler in postinstall at all, see my proposal in #5694.

cknitt avatar Sep 24 '22 15:09 cknitt

The compiler is not built from source on npm install anymore in v11/master.

cknitt avatar May 28 '23 17:05 cknitt