hi pact-js community - I'm working on a project ho...
# pact-js
m
hi pact-js community - I'm working on a project hosted in github that follows the zero-installs strategy (in short: we commit our
.yarn/cache
directory). we noticed that the pact-core npm package exceeds github's 100mb file size limit. we're not on the latest version of pact, but even the latest version of pact-core is large. if I understand correctly, pact-core is so large because of the included CLI tools, which we don't use directly. is there any way around this? or can anyone think of other creative solutions?
git-lfs
is an option, but one that we'd like to avoid if possible
y
even if you remove the cli tools (which has been proposed), the bundle will probably still be over 100mb, it includes 5 shared libs for the pact ffi (one for each support platform, x86_64 across windows/macos/linux and arm64 for macos/linux) - each one weighs in at 20mb+ You will always need at least one shared library for the system you are running on, you could do this with separate npm packages for each platform, I believe that was tried before in the pact-node but was removed
in previous versions there was a post install script that would fetch the remote sources, (the ruby tools ) which meant smaller bundle at download time, but the package still remains the same at the end once its usable (downloaded the files from the remote source) the shared libs from the pact reference core, could be fetched at install time from a github release, for the relevant platform. We elected not to do that, as we have users generally want to included
--ignore-scripts
so it would stop pact-js from fetching out the required libs.
m
thank you @Yousaf Nabi (pactflow.io) - that's very helpful context. I may reach out with other questions but I'll bring this back to our team in the meantime while we figure out what to do
👍 1
y
np, I think a quick solution would be maybe to mirror a fork of the project, that excludes the binaries from being packaged into the npm package, and fetch the required sources which are published on the pact-js-core release package we publish the required shared libary and associated pact.node native module that has been prebuilt per release of pact-js-core https://github.com/pact-foundation/pact-js-core/releases/tag/untagged-5c14dbdc4c8fa1c42fcb
👍 1
ps you can also override in Pact-js-core/pact-js-core with an env var as to where the binaries live, so they don’t need to be in the source npm package. if that helps
ps. first time I’ve heard of zero-install from yarn.
thanks for bringing it up 🙂
👍 1
m
hmm that link (zero installs) doesn’t work for me, and annoyingly, the search on that site isn’t working for me right now. Anyway, thanks for sharing. I think I can guess why
zero-installs
is a good idea.
m
that link (and a bunch of others on yarnpkg.com) stopped working just the other day - I read it, and found it gone when I went to review it 😕 I'm trying a different tack - using
yarn patch
to remove the /standalone directory. I'm having some trouble, though. I'm guessing nobody here has tried this before, but if you have any thoughts about that approach, please let me know