elixir-lang / tree-sitter-elixir

Elixir grammar for tree-sitter
https://elixir-lang.org/tree-sitter-elixir
Apache License 2.0
248 stars 25 forks source link

Publishing to NPM #44

Closed mykulyak closed 1 year ago

mykulyak commented 2 years ago

Could you please start publishing tree-sitter-elixir to NPM, like e.g. tree-sitter-ruby or tree-sitter-python do ?

Reasons are pretty obvious (for me):

  1. versioning / change control for free. There was a change around 2 weeks ago that broke Node bindings. With NPM, it wouldn't be a problem. Without, I had to spend a couple of hours to debug things.
  2. convenience

In principle, I can help with this, if needed.

jonatanklosko commented 2 years ago

Hey @mykulyak! I think we can publish yeah.

Also, I assume the change you mean was generating the parser with a newer tree-sitter-cli, did you need to update tree-sitter, or was it something else?

jonatanklosko commented 2 years ago

The question is what versioning we should follow. Currently pretty much all packages I looked at align the version with the tree-sitter version, but I think this has issues. For someone using the AST, we should bump the major version whenever the AST changes, and not try to mirror the tree-sitter versioning. There is more discussion in https://github.com/tree-sitter/tree-sitter/discussions/1768, however there's no standardization yet, as far as I can see.

Sidenote: when pointing the dependency to GitHub, it's a good idea to specify the SHA.

Related to #35.

shawa commented 1 year ago

Hi there, I also have a use case that would be aided greatly by an NPM package being available (getting Elixir support into cursorless 'just' requires adding in the right tree-sitter grammar to

Is there any possibility of using a non-standard (reasonably sensible) versioning scheme for tree-sitter-elixir on NPM, then switching over to whatever scheme the tree-sitter community settles on?

Thanks a million!

jonatanklosko commented 1 year ago

Hey @shawa, sorry for the late reply! Is there a reason you can't depend on npm package from GitHub directly with a specific SHA?

shawa commented 1 year ago

Hey @jonatanklosko likewise with the late reply :see_no_evil:

I wasn't as familiar with NPM at the time, I now realise I can just use a git dependency, which seems to be what cursorless is doing anyway. Feel free to disregard.

0-wiz-0 commented 1 year ago

My unscientific non-double-blind check of tree-sitter grammar versions makes me believe that people do 'whatever':

tree-sitter-0.20.7
tree-sitter-c-0.20.2
tree-sitter-cmake-0.1.0
tree-sitter-cpp-0.20.0
tree-sitter-dockerfile-0.1.2
tree-sitter-go-0.19.1
tree-sitter-heex-0.6.0
tree-sitter-html-0.19.0
tree-sitter-java-0.20.1
tree-sitter-json-0.19.0
tree-sitter-python-0.20.0
tree-sitter-ruby-0.19.0
tree-sitter-rust-0.20.3
tree-sitter-toml-0.5.1
tree-sitter-typescript-0.20.1
tree-sitter-yaml-0.5.0

So just choose a random number and go :)

jonatanklosko commented 1 year ago

@0-wiz-0 yeah fair, I published v0.1.0.

@the-mikedavis I invited you to the crates package, let me know if you have npm account and will send one there too :)

the-mikedavis commented 1 year ago

@jonatanklosko thanks for setting this up! I created an NPM account under my github username

jonatanklosko commented 1 year ago

@the-mikedavis perfect, invited!