Skip to content
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

Allow to consume with C++ sources to build as part of npm install #191

Closed
bpasero opened this issue Sep 18, 2024 · 5 comments
Closed

Allow to consume with C++ sources to build as part of npm install #191

bpasero opened this issue Sep 18, 2024 · 5 comments

Comments

@bpasero
Copy link
Contributor

bpasero commented Sep 18, 2024

I think ever since 062bca4, components that depend on @parcel/watcher no longer compile the module from its C++ sources but get prebuild versions.

In VS Code we require to build C++ modules from sources, so it would be great to have the ability back to do so, so that we can move to newer versions of this module.

I think a starting point is to have the sources back in the NPM package: #157

Alternatively, maybe a different NPM package could be published that is strictly for building from sources?

//cc @devongovett

@devongovett
Copy link
Member

We may be able to publish the source files. The thing I'd be worried about and need to look into is whether including the binding.gyp causes npm to always build from source rather than using the prebuilds, and if there is a way to avoid that.

@deepak1556
Copy link

deepak1556 commented Sep 18, 2024

Hi! I believe npm will build following the default install script logic since this package does not override one since #144. An idea could be to override the install script section with a simple script that checks if process.env.npm_config_build_from_source set and proceeds to run node-gyp rebuild command otherwise do nothing.

@tmm1
Copy link
Contributor

tmm1 commented Sep 23, 2024

What's the simplest cross-platform solution for conditional npm script?

"install":"node -e \"if (process.env.npm_config_build_from_source) require('child_process')...

@deepak1556
Copy link

You can take https://github.com/prebuild/node-gyp-build/blob/master/bin.js as an example. Basically what we want is,

if (buildFromSource()) {
  build()
}

@deepak1556
Copy link

Thanks @devongovett 🚀

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

No branches or pull requests

4 participants