-
-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for npm5 #83
Comments
So, there's two ways you can go about this: The way I think I most recommend is to run The other way, which will be only compatible with lmk if you have any questions about the cache format or the tools around it. shrinkpack is real cool. :) |
Thanks @zkat, I'll most likely go the |
In the meantime, it might be helpful to pass |
Thanks a lot for the tip @timdp |
@zkat should I consider rewriting the paths in |
@JamieMason If you do that, it HAS to be: I haven't tried this myself yet, but I would hope it would work. It should. If not, that's a bug I gotta fix. So, to summarize:
becomes
If the integrity hash doesn't match resolved, you'll get an integrity error. |
@JamieMason just wondering, any progress on this? Thanks! |
Hey @zkat, Thanks a lot, Jamie |
@JamieMason doing that is a ways away. You're free to implement it shrinkpack-side in he meantime -- it's gone pretty far down the queue in the past couple of months, and idk when we'd even get around to it, rn. |
righto, thanks a lot @zkat |
Is this something that is in progress? |
Hey again @zkat, hope you like @ mentions. If I wanted to keep the I'm thinking I would use that to report on whether the package was downloaded, but run @pietermees @cmandlbaur It hasn't been possible to work on If anyone knows of anything I can do to help make it easier for people to contribute, please let me know. I've spent a lot of time on the readme.md and contributing.md etc but there's probably all kinds of stuff that should be clear to people but really isn't. |
That's great news @JamieMason! I'm not entirely sure what would make contributing easier. I think there's a general sense (at least on my end) that I don't fully understand all the moving parts. And seeing that even you - after all this amazing work - still seem to rely on zkat's knowledge from time to time, makes me feel like the learning curve is relatively long and steep ;) On the one hand, having a number of smaller tasks that people can tackle to learn seems like a good idea, on the other hand people probably run into specific issues from time to time that they care about a lot (like this one) and are very happy the rest of the time. So not many people might pick up the smaller tasks. |
@JamieMason yeah. Although note that the cacache directory is inside |
Thanks again 👊 |
Sorry @zkat, can I nag you again please? 1I've noticed that sometimes entries have a semver string for
When running npm pack, should I eg. 2When I come to update the lockfile, what should the resulting
Would npm be able to resolve the dependency if that became this?
Or should it maybe become this?
3Can you point me to anything you'd recommend I should use to generate the sha512s please? also, 4EDIT: Following on from question 1, I wonder if I'll be able to maintain the file names of Sorry this is a huge list, thanks for all your help. |
|
Thanks a lot |
Just wanted to leave a note that I'm pleased that you've found time to work on this. Like @pietermees:
So I feel indebted to you for the work already done, and for the work you've now picked up again. I'm cheering for you, and I deeply appreciate your time and energy on this project. 🍻 🎉 |
I second that!
|
That's amazing, thanks so much. Just a note to people dropping in that I'm travelling now so won't be able to pick up again until mid-late next week. 😊👍 |
Some learnings today, I've created 4 branches which show different structures of Possible things to try next are updating the
...as that is what was produced when running the following to see how
that produced format 3 which is the only format which will let you install while offline and with an empty npm/cacache cache. But it has the following in package.json which will not be acceptable;
Strangely though, this version does not work. I'll post more as I find it, thanks all. |
Thanks for the continuing investigation and updates! |
Out of time for today but I have this branch https://github.com/JamieMason/shrinkpack/tree/npm5 which is a thin wrapper for EDIT: Apologies for the email spam subscribers probably got thanks to my repeated pushes to Travis ☝️ |
Any progress on this? I don't mind having a look if you're not able to work on it |
Thanks @peteward44 I appreciate the offer. I have to grudgingly admit that this issue has worn me down and by now I really struggle to find the energy and motivation to get it through. Kat and Rebecca from npm have been amazing and we couldn't ask any more from them, but in two days this issue will be a year old. That's a long slog for one person and over that time each fix has uncovered new issues which took time to resolve before continuing on again. The under-development version of shrinkpack works, at least on paper, the overall ongoing issue has been around gaining support in npm >=5 for fully offline installations using only a lockfile containing There is some good news though that npm have announced they will be:
In light of this, I think it would be better to wait until Sorry everyone for such a long wait, but as a result we will get |
OK fair enough. A shame as shrinkpack is a great tool, but native support for offline installs does make a lot more sense. |
npm taking over is definitely good - giving it a future as first class citizen. This probably only arrives in half a year or so. In the blog post they state "late summer and fall of 2018" and given they're loaded with work one could guess that the timeline for this feature slips further. I would welcome a quicker (interim) solution - and it seems we are already very close with shrinkpack working at the core. For folks who want to help and take over your excellent work to get it finally out of the door - what would be the next steps to be taken? To me, the next steps look like:
|
@mobidev111 the native npm version is pretty much already implemented and mostly needs attention and polish. You can try it right now with |
The reason it isn't shipped is because I need to take it over the finish line, make sure corner cases are covered, add tests, etc -- but I won't have time allocated to do this for the next couple of months, probably. |
(p.s. |
Great news @zkat. I'm not brave enough to use this in my production tool chain just yet, but i look forward to the official release 👍 We've been stuck on npm 4 due to this for a long time now and really can't wait to upgrade |
I have published It is a thin wrapper for Thanks all for your comments, @mobidev111 thanks a lot for that useful comment and organisation. |
Hi @JamieMason, Thanks for all your work, I know firsthand how building an open source project can be disorienting and tiring, and I just wanted to say that your efforts are very much appreciated and needed! Congrats on getting your code into npm archive! |
Hi. @JamieMason [ERROR] npm WARN optional SKIPPING OPTIONAL DEPENDENCY: aggregate error when running I'm using node v9.11.1 / npm 5.6.0 and shrinkpack 1 - alpha. |
npm/cli#1 got closed down :( |
@themoonrat we're looking into ways to reintegrate this and see where it fits into our product plans for the CLI. In the meantime, the core support for this kind of thing did land in npm. Any tool that does the same kind of rewriting should provide similar support. This means you can use |
Updated shrinkpack to work with (relatively) new versions of npm: JamieMason/shrinkpack#83 The new version stores the tars in the 'archived-packages' folder and not the 'node_shrinkwrap' one, that's why there are so many files in the diff. Change-Id: Iebcadaeee0e27f831b7ff16a50819a908e7f05a6 Reviewed-on: https://gerrit.libreoffice.org/69878 Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de> Tested-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
So it's been while. |
Hey @thomashardwick, check out #83 (comment) as I think it's still about right as a summary of where shrinkpack is at. Quite some time has passed though and I've lost touch with what npm provides out of the box in this area, there was talk of an |
@thomashardwick I know this is a very different solution, but have you tried something like https://www.snowpack.dev/ or my own much simpler (better, in my opinion) https://www.npmjs.com/package/@thomasrandolph/icepack? In both cases, instead of saving a local copy of the full dependency tree, those tools build a bundled copy of the appropriate dependencies. You would do that once, while you have an internet connection. Then, all future references to the dependency just reference the bundled file. One key part of both of these tools is the bundled version is always browser-safe, too, so you can run either tool ahead of time and then you have a set of dependencies that you never have to touch again, including compiling (if you ship ES6 modules to the browser). Again, I know this is a really big deviation from |
I've since changed to use Yarn and it's offline mirror, which works pretty much like shrinkpack does. https://classic.yarnpkg.com/blog/2016/11/24/offline-mirror/ It would seem NPM has lost interest in allowing users to offline dependencies as that goes against it's business model. A shame |
Keep an eye on yarnpkg/yarn#541 @peteward44 as Yarn's offline mirror can gradually harm the performance of your Git repo over time. |
I've got no idea what npm's plans are these days, but they do have an active rfc process going, and it may be useful to bring this up there again. |
Updated shrinkpack to work with (relatively) new versions of npm: JamieMason/shrinkpack#83 The new version stores the tars in the 'archived-packages' folder and not the 'node_shrinkwrap' one, that's why there are so many files in the diff. Change-Id: Iebcadaeee0e27f831b7ff16a50819a908e7f05a6 Reviewed-on: https://gerrit.libreoffice.org/69878 Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de> Tested-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de> Reviewed-on: https://gerrit.libreoffice.org/77796
shrinkpack@0.19.0 has been released which adds support for npm 7 and up. Thanks again to Kat and Rebecca for all of your help during your time at npm ❤️ . |
This is amazing |
npm install -g npm5
has a different cache structure so shrinkpack will need updating to support that, while being backwards compatible for older versions.The text was updated successfully, but these errors were encountered: