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
Shell build directive #57
Conversation
🤦♂️ Yep indeed it's caused by I don't see an immediate and obvious solution here, I'll need to think some more about it 😞 |
I found out something pretty interesting! If you look at the package.json for argon2@0.21.0 we see this: "scripts": {
"benchmark": "node test/benchmark.js",
"clean": "node-gyp clean",
"lint": "standard --verbose",
"test": "mocha test/test.js",
"test-ts": "tsc -p . && node test/test-d.js"
}, But if we look at the metadata returned by the registry for the 0.21.0 release, we see this: "scripts": {
"benchmark": "node test/benchmark.js",
"clean": "node-gyp clean",
"lint": "standard --verbose",
"test": "mocha test/test.js",
"test-ts": "tsc -p . && node test/test-d.js",
"install": "node-gyp rebuild"
}, As you can see, the So what I think could work: in the By doing this we ensure that |
Interesting! I'll look at implement it next week 😉 Just to be sure, it doesn't change the |
Yep! The build directive should still automatically inject a new "script" in the build pipeline when they detect bindings.gyp; it's just that the resolver should try to detect that the install script from the metadata references node-gyp and add it to the dependencies 👍 |
Ok, got it to work partially! It still isn't really usable: Firstly, the Then, I had to also unplug Any idea to how we can add node-gyp to the dependency tree when not using NpmResolver? |
I think we shouldn't have to, because the dependencies extracted from the lockfile have been saved from the ones initially returned by the npm resolver at the time the entry wasn't in the lockfile (meaning that they will include
I tried locally and it seemed to work as expected. Note that if the lockfile entry already exists you need to remove it first, otherwise it won't be updated until you bump
Some packages are whitelisted for being unplugged. I'd prefer not to have too many of them since it's not super scalable, but in this case it might make sense for now. Feel free to add it to your diff! |
Oh right! I got a little bit confused... I didn't realize that the For After that, there will be some tests to do and it should be good |
Let me know if you need help on something (btw we have a discord channel, that might be more convenient in some cases) 👍 |
Is it good for review? |
It's just missing a test. Also it must be rebased with master 😉 I didn't have a lot of time this week, taking a look now 🙂 |
No worry, I was just checking my backlog 😃 |
Now, it should be ready for review 👍 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I left a few comments here and there - mostly to make the change clearer. I think once it's done it'll be ready to merge 👍
packages/acceptance-tests/pkg-tests-fixtures/packages/node-gyp-1.0.0/node-gyp.js
Outdated
Show resolved
Hide resolved
packages/acceptance-tests/pkg-tests-specs/sources/commands/add.test.js
Outdated
Show resolved
Hide resolved
Looks good to me! Waiting for the tests to end, and if everything is green-ish it'll be time to merge 👌 |
EDIT: Closes #51
Following #51, I tried to implement a new BuildDirective enum.
For now, the build directive system work and the
node-gyp rebuild
action is called.But now I'm stuck because the
binding.gyp
require thenode-addon-api
:https://github.com/ranisalt/node-argon2/blob/48f4a48310c482937ddee9172d861ee8aa36fe1b/binding.gyp#L52-L57
I think it can't get the dependency because it uses
dlx
:I don't really know what to do about this now @arcanis 😁
Again, it's a special case for
node-addon-api
ornan
...