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

Add Node.js prebuilds to language grammars #3073

Closed
segevfiner opened this issue Feb 24, 2024 · 5 comments
Closed

Add Node.js prebuilds to language grammars #3073

segevfiner opened this issue Feb 24, 2024 · 5 comments
Labels
enhancement Feature request

Comments

@segevfiner
Copy link
Contributor

Problem

Having prebuilds is useful as you then don't have to have a compiler to use them, and can use the prebuilds to generate distributions for different operating systems without having to do so on each target operating system due to having to compile binaries.

This can be done by providing a GitHub Actions workflow, possibly generated by the cli generate command and appropriate config/scripts to be included in the package.json.

This will be easier if we migrate to napi as then we will only really need one binary per OS/arch combination rather than also for each major version of Node.js.

Expected behavior

For language grammar for Node to have prebuilds.

@segevfiner segevfiner added the enhancement Feature request label Feb 24, 2024
@ObserverOfTime
Copy link
Member

ObserverOfTime commented Feb 28, 2024

I tried that for tree-sitter-cli in ObserverOfTime@d1eace2 but the package would be too large.
Although, parser libraries should be considerably smaller so it might be doable for those.

@segevfiner
Copy link
Contributor Author

I meant using prebuild/prebuild-install, like already used in node-tree-sitter. This won't make the package larger as it downloads prebuilds from a GitHub release.

@segevfiner
Copy link
Contributor Author

Continuing on from #3106 (comment), if we want to use prebuildify instead of prebuild.

  • The workflows are not generated by default by generate so how are language authors supposed to know about them?
  • Do we want our own prebuildify workflow or is there any workflow/action that we can reuse?
  • Not using node-gyp-build is troublesome, as you need to for the install command for unsupported targets, and the logic to import the right addon module is quite a bit more complex with prebuildify than with prebuild.

@segevfiner
Copy link
Contributor Author

Anyhow, this is an example of adding prebuild: segevfiner/tree-sitter-hello@main...prebuild
And this one is an example of adding prebuildify: segevfiner/tree-sitter-hello@main...prebuildify

Let me know which one you want to turn into a PR. And whether you want to do something about what I wrote above. e.g. To let users know where the shared workflows are.

@amaanq @ObserverOfTime @verhovsky

@ObserverOfTime
Copy link
Member

ObserverOfTime commented Mar 9, 2024

The workflows are not generated by default by generate so how are language authors supposed to know about them?

The workflows are still subject to change but a reference in the docs would be nice to have.
Alternatively, there's a (not entirely official) template that includes them.

Do we want our own prebuildify workflow or is there any workflow/action that we can reuse?

I will update the package-npm workflow accordingly.

Let me know which one you want to turn into a PR.

prebuildify is definitely the better option.
I can add it to #3126 which has a few more npm stuff.

@amaanq amaanq closed this as completed Mar 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Feature request
Projects
None yet
Development

No branches or pull requests

3 participants