yarn run v1.22.21
$ ./tree-sitter/target/release/tree-sitter generate
/Users/rob/Projects/tree-sitter-yaml/grammar.js:568
for (const [rule_name, rule] of Object.entries(grammar_json.rules)) {
^
TypeError: Cannot read properties of undefined (reading 'rules')
at global_alias (/Users/rob/Projects/tree-sitter-yaml/grammar.js:568:63)
at Object.<anonymous> (/Users/rob/Projects/tree-sitter-yaml/grammar.js:470:39)
at Module._compile (node:internal/modules/cjs/loader:1198:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1252:10)
at Module.load (node:internal/modules/cjs/loader:1076:32)
at Function.Module._load (node:internal/modules/cjs/loader:911:12)
at Module.require (node:internal/modules/cjs/loader:1100:19)
at require (node:internal/modules/cjs/helpers:119:18)
at [stdin]:420:16
at Script.runInThisContext (node:vm:129:12)
Node process exited with status 1
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Second was to just use the latest tree-sitter (0.22.1, installed with Homebrew):
$ tree-sitter generate
Replacing nan dependency with node-addon-api in package.json
Adding node-gyp-build dependency to package.json
Adding prebuildify devDependency to package.json
Adding an install script to package.json
Adding a prebuildify script to package.json
Adding peerDependencies to package.json
Adding types to package.json
Failed to locate a package.json file that has a "tree-sitter" section, please ensure you have one, and if you don't then consult the docs
Expected Behavior/Parse Tree
I would expect that either the existing yarn tree-sitter generate or a generic tree-sitter generate would work. If not, I would like to see a script or docs for how to build, along the lines of a script in the package.json, a script in the scripts/ directory, or docs in the README.md or CONTRIBUTING.md.
Did you check existing issues?
Tree-Sitter CLI Version, if relevant (output of
tree-sitter --version
)tree-sitter 0.22.1
Describe the bug
I can't figure out how to run
tree-sitter generate
successfullySteps To Reproduce/Bad Parse Tree
Tried two methods.
First is the one that works on the upstream. Using node
v16.20.2
because node 18+ fails on theyarn
installation:With output:
Second was to just use the latest tree-sitter (0.22.1, installed with Homebrew):
Expected Behavior/Parse Tree
I would expect that either the existing
yarn tree-sitter generate
or a generictree-sitter generate
would work. If not, I would like to see a script or docs for how to build, along the lines of a script in the package.json, a script in thescripts/
directory, or docs in theREADME.md
orCONTRIBUTING.md
.For context, I have a commit that fixes https://github.com/ikatyang/tree-sitter-yaml/issues/29 with tests here: https://github.com/ikatyang/tree-sitter-yaml/commit/c1c2506543eb99abe0a0f305428b6432c71b30c0. Happy to submit a PR in this repo with that patch, I'm just not sure how to do that.
Repro
No response