Skip to content

Conversation

@MarshallOfSound
Copy link
Contributor

This fixes cases where modules do

require('node-gyp-build')(path.resolve(__dirname, '..'))

or something similar, this was the only one where __dirname was required, bindings and friends already do this resolution

Copy link

@Ethan-Arrowood Ethan-Arrowood left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As long as CI is green I'm okay landing this. I don't think we require a new unit test here but if others disagree we should definitely add one!

@Ethan-Arrowood
Copy link

I think a new unit test is required here. Please add one covering the case you're fixing and then this will be good to go

@MarshallOfSound
Copy link
Contributor Author

Test added, works locally 👍 I think it needs a button-push to run here

@Ethan-Arrowood
Copy link

Looks like it needs a linux and a windows output. Not sure how other tests accomplish this.

@MarshallOfSound
Copy link
Contributor Author

prebuilds/linux-x64/node.napi.node

Oh that is annoying 🤔 I can try figure out how to do this, maybe platform specific input/output files

@Ethan-Arrowood
Copy link

Yeah unfortunately I am not familiar with this repo or I'd offer to help more with the tests. The maintainers who know how this all works are on vacation at the moment 😅

@AlexDygma
Copy link

is this not going to be merged?

const os = __webpack_require__(87);
const path = __webpack_require__(622);

exports = module.exports = require(__webpack_require__.ab + "prebuilds/darwin-x64/node.napi.node");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like this test is failing on windows and linux because this is the result when running on macos.

You might need to do a find/replace on the output here before running the test to make sure it works on all platforms.

styfle pushed a commit that referenced this pull request May 16, 2024
This is based on existing PR #168 by @MarshallOfSound

I rebased the original commits except for the one introducing the tests
which I have rewritten

Instead of requiring an external library (ffi-napi), I created a dummy
binding that node-pre-gyp can use as input with a predictable binding
file path that won't depend on the platform.

---------

Co-authored-by: Samuel Attard <[email protected]>
Co-authored-by: Samuel Attard <[email protected]>
@styfle
Copy link
Member

styfle commented May 16, 2024

Closing since this landed in #185

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants