tree-sitter / tree-sitter-typescript

TypeScript grammar for tree-sitter
MIT License
335 stars 104 forks source link

npm/yarn are used inconsistently #211

Closed resolritter closed 2 years ago

resolritter commented 2 years ago

I infer this project uses yarn as its package manager by the presence of yarn.lock (https://github.com/tree-sitter/tree-sitter-typescript/blob/8e9dba7bd7cf089838a036a98be94db53ba2d0a9/yarn.lock).

That being said it still uses npm in its scripts, which is not necessary: yarn could be used there

https://github.com/tree-sitter/tree-sitter-typescript/blob/8e9dba7bd7cf089838a036a98be94db53ba2d0a9/package.json#L25

https://github.com/tree-sitter/tree-sitter-typescript/blob/8e9dba7bd7cf089838a036a98be94db53ba2d0a9/package.json#L29

https://github.com/tree-sitter/tree-sitter-typescript/blob/8e9dba7bd7cf089838a036a98be94db53ba2d0a9/.github/workflows/build.yml#L26

Solution: use either yarn or npm, not both, for everything

NullVoxPopuli commented 2 years ago

Somewhat, related, when using yarn to install, I get an error:

error An unexpected error occurred: "Commit hash required".

idk what that's about.

and when I do npm install and then npm run build, I also get an error:

❯ npm run build

> tree-sitter-typescript@0.20.1 build
> npm run build-typescript && npm run build-tsx

> tree-sitter-typescript@0.20.1 build-typescript
> cd typescript && npx tree-sitter generate --no-bindings

node:events:505
      throw er; // Unhandled 'error' event
      ^

Error: spawn <repo>/node_modules/tree-sitter-cli/tree-sitter ENOENT
    at Process.ChildProcess._handle.onexit (node:internal/child_process:283:19)
    at onErrorNT (node:internal/child_process:478:16)
    at processTicksAndRejections (node:internal/process/task_queues:83:21)
Emitted 'error' event on ChildProcess instance at:
    at Process.ChildProcess._handle.onexit (node:internal/child_process:289:12)
    at onErrorNT (node:internal/child_process:478:16)
    at processTicksAndRejections (node:internal/process/task_queues:83:21) {
  errno: -2,
  code: 'ENOENT',
  syscall: 'spawn <repo>/node_modules/tree-sitter-cli/tree-sitter',
  path: '<repo>/node_modules/tree-sitter-cli/tree-sitter',
  spawnargs: [ 'generate', '--no-bindings' ]
}

tree-sitter-typescript on  master via 🦀 

  origin  https://github.com/tree-sitter/tree-sitter-typescript 

❯ 
NullVoxPopuli commented 2 years ago

tho, I recommend ditching both yarn (unmaintained) and npm (resolves peers incorrectly) in favor of pnpm (maintained and correct)

but anywho, the tree-sitter bin itself is failing -- not sure if upstream issue or not