esy / esy

package.json workflow for native development with Reason/OCaml
http://esy.sh
Other
845 stars 93 forks source link

Yarn offline cache doesn't include opam dependencies. #13

Closed jordwalke closed 7 years ago

jordwalke commented 7 years ago

Since moving ocaml compiler to npm, now the offline cache is no longer corrupt, but I noticed the offline cache doesn't include @opam packages.

This might be a quick/obvious fix, or it might be more involved. If it's more involved, I think we can deprioritized it and I can just find some other workaround to getting offline checkins of dependencies. Curious to hear @andreypopp's thoughts:

Here's my project's .yarnrc:

# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1

lastUpdateCheck 1508733111161
yarn-offline-mirror "./npm-packages-offline-cache"
yarn-offline-mirror-pruning true

Here's a sample section of my newly generated yarn.lock, which shows something interesting: The resolved field doesn't have a full url for @opam packages, but does for npm ones.

"@opam/utop@ >= 1.17.0":
  version "2.0.1"
  resolved "@opam/utop@2.0.1"
  dependencies:
    "@esy-ocaml/esy-installer" "^0.0.0"
    "@esy-ocaml/substs" "^0.0.1"
    "@opam/base-threads" "*"
    "@opam/base-unix" "*"
    "@opam/cppo" "  >= 1.1.2"
    "@opam/jbuilder" "  >= 1.0.0-beta9"
    "@opam/lambda-term" " >= 1.9.0"
    "@opam/lwt" "*"
    "@opam/ocamlfind" " >= 1.7.2"
    "@opam/react" " >= 1.0.0"
  peerDependencies:
    ocaml " >= 4.2.3  < 4.6.0"

"@opam/zed@ >= 1.2.0":
  version "1.5.0"
  resolved "@opam/zed@1.5.0"
  dependencies:
    "@esy-ocaml/esy-installer" "^0.0.0"
    "@esy-ocaml/substs" "^0.0.1"
    "@opam/base-bytes" "*"
    "@opam/camomile" " >= 0.8.0"
    "@opam/jbuilder" "  >= 1.0.0-beta7"
    "@opam/react" "*"
  peerDependencies:
    ocaml " >= 4.2.3"

ocaml@~4.2.3001:
  version "4.2.3001"
  resolved "https://registry.yarnpkg.com/ocaml/-/ocaml-4.2.3001.tgz#4bb250b8a842fb357acb2ebf1a13a0c3fa753dd6"

Here's the contents of the npm-packages-offline-cache directory:

npm-packages-offline-cache/
npm-packages-offline-cache/@esy-ocaml-esy-installer-0.0.0.tgz
npm-packages-offline-cache/ocaml-4.2.3001.tgz
npm-packages-offline-cache/@esy-ocaml-substs-0.0.1.tgz
andreypopp commented 7 years ago

It's not implemented for opam fetcher — working on it.

andreypopp commented 7 years ago

Should be fixed in esy@0.0.24. It's pretty significant rewrite of opam resolver/fetcher within the esy install so I've released it under next tag for now:

npm i -g esy@next

Let's test!

jordwalke commented 7 years ago

Will test! Hope it wasn't too much work.

jordwalke commented 7 years ago

Seems to be working great! There isn't a way to really force esy to use offline because esy install doesn't forward args to yarn right now, but I disconnected wifi to try it and it worked very well. Pretty cool that we have this offline feature - it's really important for companies that need to perform builds offline in an isolated environment.

andreypopp commented 7 years ago

esy install doesn't forward args to yarn right now

yeah, going to fix this and also expose esy add and few others.

Closing this issue for now.