neon-bindings / neon

Rust bindings for writing safe and fast native Node.js modules.
https://www.neon-bindings.com/
Apache License 2.0
7.98k stars 282 forks source link

`npm init -- --app` should create an `"install"` hook #1042

Closed dherman closed 3 months ago

dherman commented 3 months ago

There's no "install" hook for --app projects created by the new create-neon.

kjvalencik commented 3 months ago

Should it be prepare and exist for both apps and libraries?

dherman commented 3 months ago

Should it be prepare and exist for both apps and libraries?

Libraries aren't built on demand, they're built remotely on the CI/CD server across the full platform matrix and the binaries are published separately. The library itself doesn't require any local build process.

For apps, I think you're right that "prepare" is the right call.

dherman commented 3 months ago

I added this to #1041.

kjvalencik commented 3 months ago

The prepare hook only runs before a publish. That's not something we want to take advantage of for libs?

dherman commented 3 months ago

The prepare hook runs both before publish and install. You might be thinking of prepublishOnly, which only runs before publish.

For libs, we can't make use of a publish hook because it's synchronous, and libs need to fork off a bunch of remote prebuilds running on CI/CD servers. So publishing is actually done via CI/CD instead of locally. But if you can think of a way to do this with an npm publish workflow, I'm open to it!

kjvalencik commented 3 months ago

Is there some other hook we can use that always gets run when you locally pull for both types?

dherman commented 3 months ago

Can you say more? I don't quite know what you mean by locally pull.

dherman commented 3 months ago

Followup: based on discussion in #1041, we agreed that this isn't a great idea after all. Rationale: