This repository was archived by the owner on Oct 24, 2023. It is now read-only.
  
  
  
  
Distribute Esy along with Reason-CLI #51
                
     Open
            
            
          
  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
esyexecutable which (a) optionally relocates Reason CLI artefacts and then (b) executes real aesyexecutable found in a bundled installation.What does it mean optionally? It relocates only if
~/.esyisn't present, otherwise we assume that Esy is already installed (and most likely contain most of Reason CLI built artefacts) and do nothing. That meansesyfrom Reason CLI is only useful for those users who didn't install esy themselves.Why
esyinstallation 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 theesyexecutable 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 anyesyinvocation.Also in case of a bundled Esy installation we still have no deps in reason-cli package. That means
packandbinreleases 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
esyinstallation is bundledThe way we bundle an Esy installation is a little bit hacky:
npm install -g --prefix _esyInstallation esyin release dir before packing it..tgzout of_esyInstallationWhy? npm doesn't allow to include
node_modulesdirectories (even nested ones) inside packages unless you havebundledDependenciesbut those don't work the same between npm and yarn.Questions / notes
esypackage is installed thenreason-clirelease package will overwriteesyexecutable from theesypackage.~/.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.