This repository has been archived by the owner on Oct 24, 2023. It is now read-only.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
DO NOT MERGE YET: let's have a discussion first
How does it work
esy
executable which (a) optionally relocates Reason CLI artefacts and then (b) executes real aesy
executable found in a bundled installation.What does it mean optionally? It relocates only if
~/.esy
isn't present, otherwise we assume that Esy is already installed (and most likely contain most of Reason CLI built artefacts) and do nothing. That meansesy
from Reason CLI is only useful for those users who didn't install esy themselves.Why
esy
installation is bundled with the release packages?The main reason not to use npm
"dependencies"
and depend on Esy in a regular way was that it's hard to locate theesy
executable in that case (especially given the differences in global installs between npm and yarn).One way would be to use
node -p "require.resolve(...)"
but that means imposing Node runtime startup toll on anyesy
invocation.Also in case of a bundled Esy installation we still have no deps in reason-cli package. That means
pack
andbin
releases still consist of a single tarball which can be installed offline. Though that might be less of an advantage as yarn/npm offline capabilities improved since (are they really?).How
esy
installation is bundledThe way we bundle an Esy installation is a little bit hacky:
npm install -g --prefix _esyInstallation esy
in release dir before packing it..tgz
out of_esyInstallation
Why? npm doesn't allow to include
node_modules
directories (even nested ones) inside packages unless you havebundledDependencies
but those don't work the same between npm and yarn.Questions / notes
esy
package is installed thenreason-cli
release package will overwriteesy
executable from theesy
package.~/.esy
(now it checks just for the existence of~/.esy
). But such check should also be performant as it is performed on each invocation ofesy
.