pulsar-edit / ppm

Pulsar Package Manager
MIT License
35 stars 13 forks source link

Update npm and node-gyp, for macOS signing fix #94

Closed DeeDeeG closed 11 months ago

DeeDeeG commented 11 months ago

Reason for bumping node-gyp again (purpose of this PR)

There is an issue with code-signing apps built with node-gyp 9.1.0 or newer. (This is due to unforeseen consequences of a change I authored in node-gyp, unfortunately. The change in question: https://github.com/nodejs/node-gyp/commit/b9ddcd5bbd93b05b03674836b6ebdae2c2e74c8c.)

So, this PR bumps node-gyp to the latest commit from node-gyp repo's main branch, currently https://github.com/nodejs/node-gyp/commit/d3615c66f7e7a65de48ce9860b1fe13710d20988.

This includes a fix for better compatibility with app signing on macOS (https://github.com/nodejs/node-gyp/commit/0f1f667b737d21905e283df100a2cb639993562a).

Said commit with the fix isn't a part of any tagged or published-to-npm-package-registry releases yet, so we have to grab it from the node-gyp repo, rather than, say, as a version from the npm registry like we usually would.

How to do this (how to bump node-gyp in our fork of npm --> how to bump node-gyp in ppm:

Note: highly recommended to use npm 6 above, whenever running npm commands, since all the lockfiles for these packages are meant to be lockfile v1 format, which is the npm 6-era lockfile format.

Context/tech debt notes

This is how we get newer node-gyp in ppm at the moment. Not easy, but this is the cost of tech debt and being indebted to npm 6-era technology (especially the "require('npm')", AKA "use npm all at once as a single library" thing that got significantly changed in npm 7 and then dropped altogether in npm 8).

(It's also the consequence of npm tending to require node-gyp all over the place in multiple, roundabout ways, given the way they split up slightly related modules that handle all this stuff on the npm side of things.)

Ideally, from a technical implementation stand-point, I feel we should find some way to use the underlying libraries that make up npm as and where we need them. This has been discussed a bit on the Discord. Easier said than done.

For now, we have a fork on npm, one that hopefully we don't need to update all that often. (And especially we hopefully don't need to bump node-gyp very often, as it is one of the more painful/complicated dependencies to bump. For above-mentioned reasons.)

Verification process

DeeDeeG commented 11 months ago

Curious what those other thoughts are, I'd guess it's not rosy feedback about the tech debt and difficulty of updating these things, to which I'd have to agree...

Anyway, merging as it is, since the npm fork is already part of ppm master branch, this is just tweaking the node-gyp dependency again, through all that process it requires.

Thank you for the approve, though I understand the reservations about what lies under the hood of this, the npm fork brings blessings and curses, one might say. It is by no means a "perfect solution", it is full of compromises. So if anyone is able to bring a clean and easy alternative, I will be glad to look over it and try to adopt it if we can.