Open andreypopp opened 7 years ago
I'll address all the questions/ideas, but a couple of quick thoughts that might address some of your concerns:
esyc
for "Esy canary" like npmc
. If the main point of including it in reason-cli is to just let people get a preview of the wip. It also manages the expectations that it's still WIP.esy
be primarily its own managed installation, perhaps we could have the main esy install
command check some known directory locations/patterns to see if there are resources that can be relocated. Release packages like reason-cli
can in some cases help esy
out by leaving a symlink "note" for esy
to find in the home directory ~/esy/availableRelocations/reason-cli -> actualLocation
. Often, reason-cli
can't write to the home directory so that's a challenge. But in the cases when it can't write to the home directory, I would imagine that the install locations are pretty predictable. Just a thought. Can you think of any other easy-to-maintain way for installed packages to leave a "note" for the standaloneesy
package to find?It would be nice to have esy
in reason-cli
just to get it in peoples' hands, (and facilitate best-effort but not mandatory cache relocation), but without the downsides of getting in the way of another esy
installation.
I wonder if we can get the best of both worlds:
reason-cli
can include an up to date esy
embedded in it.reason-cli
can expose its own esy
binary, and esy
itself can expose two binaries: esy
and esy-actual
which both point to the exact same thing. What if the reason-cli
version of esy
(in addition to whatever other special things we want it to do), firsts checks for the presence of esy-actual
, and if it exists execs that, otherwise runs reason-cli
's own version of esy
.
esy
install, and then you later installed reason-cli
, which overwrote the esy
binary, but not the esy-actual
binary.reason-cli
, and then later install esy
globally - reason-cli
's own esy
binary gets overwritten by esy
's global esy
binary. If the only thing that reason-cli
's esy
binary did was check for esy-actual
, then this is perfectly fine.
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
.