JamieMason / shrinkpack

Fast, resilient, reproducible builds with npm install.
https://www.npmjs.com/package/shrinkpack
MIT License
793 stars 38 forks source link

Reinstate resolving tarball URLs using a local package.json #65

Closed JamieMason closed 6 years ago

JamieMason commented 8 years ago

src/resolveTarball/resolveLocally/index.js was removed in eb594480bb697558e357a1f406ee301784874fe6 due to the complexity involved in trying to locate package.json and the differences in how this can be done in npm v2 and v3.

Windows users in particular seem to be affected by missing resolved properties in their npm-shrinkwrap.json files. Contacting the registry to find that information adds a lot of delay to shrinkpack.

One idea is to have a node.js file containing eg. require.resolve('lodash@4.0.0') which we run as if it were part of the host project – that way npm/node should resolve the dependency location for us, whatever the version.

Getting hold of the package.json should just be a case of a child_process.exec call to node path/to/our/hijack-resolve.js with the cwd set to the path to the project.