tree-sitter-hcl icon indicating copy to clipboard operation
tree-sitter-hcl copied to clipboard

Publish grammar to npm

Open szclentfort opened this issue 1 year ago • 9 comments

Is your feature request related to a problem? Please describe. I would like to use the hcl grammar from a nodejs project. However, it is not published to NPM and I need to set up a full build chain to build the project locally, which I'd like to avoid

Describe the solution you'd like Have the package available from npmjs as tree-sitter-hcl

Describe alternatives you've considered Building the grammar locally

szclentfort avatar Aug 20 '24 12:08 szclentfort

Notes on how I got this to run:

  1. Download release 1.1.0 from releases page
  2. Unpack release to ./vendor/tree-sitter-hcl-1.1.0/ in my project
  3. Run tree-sitter generate in vendor/tree-sitter-hcl-1.1.0/. This updates binding.gyp
  4. Update binding.gyp to include "src/scanner.css" in the sources-array
  5. Add "tree-sitter-hcl": "./vendor/tree-sitter-hcl-1.1.0/" to my dependencies in package.json
  6. Run npm i

szclentfort avatar Aug 20 '24 12:08 szclentfort

I think despite the name it's somewhat related to https://github.com/tree-sitter-grammars/tree-sitter-hcl/pull/52. We should have some actions to upload to npm and other package repositories. Cc @clason

MichaHoffmann avatar Aug 20 '24 13:08 MichaHoffmann

Yes. Upstream is working on it.

clason avatar Aug 20 '24 13:08 clason

We do have actions to upload to npm other package repositories.

ObserverOfTime avatar Aug 20 '24 15:08 ObserverOfTime

It would be great to publish to pypi as well.

Is there anything we could help to move this forward?

alejolagosm avatar Dec 10 '24 14:12 alejolagosm

@clason is there an org level token that we can use for non/pypi so we can start uploading with GitHub actions?

MichaHoffmann avatar Mar 30 '25 09:03 MichaHoffmann

Not that I know of (and, sorry to say, I personally don't care about package repositories, so I'm not really able to help here).

clason avatar Mar 30 '25 15:03 clason

We have NPM_TOKEN for the tree-sitter-grammars org but the namespace is required.

ObserverOfTime avatar Mar 31 '25 08:03 ObserverOfTime

It would be great to publish to pypi as well.

Is there anything we could help to move this forward? @alejolagosm

I made a fork for a personal project. It's not on PyPi but it can be directly imported from a pyproject.toml:

dependencies = [
    "pandas>=2.2.3",
    # [...]
    "tree-sitter-hcl @ git+https://github.com/VigorousWhimsicalGoat/tree-sitter-hcl",
]

edgarogh avatar Apr 03 '25 20:04 edgarogh