Skip to content

Commit

Permalink
fix: Install dep with specific version (#399)
Browse files Browse the repository at this point in the history
* fix: Install dep with specific version

* fix format string with cmd
  • Loading branch information
jcs090218 authored Feb 15, 2024
1 parent 5883dad commit 080382b
Showing 1 changed file with 15 additions and 10 deletions.
25 changes: 15 additions & 10 deletions tree-sitter-langs-build.el
Original file line number Diff line number Diff line change
Expand Up @@ -250,14 +250,14 @@ infrequent (grammar-only changes). It is different from the version of
"List of suffixes for shared libraries that define tree-sitter languages.")

(defconst tree-sitter-langs--langs-with-deps
'( arduino
astro
cpp
commonlisp
hlsl
glsl
toml
typescript)
'((arduino ("[email protected]"))
(astro)
(cpp ("[email protected]"))
(commonlisp)
(hlsl)
(glsl)
(toml)
(typescript))
"Languages that depend on another, thus requiring `npm install'.")

(defun tree-sitter-langs--bundle-file (&optional ext version os)
Expand Down Expand Up @@ -333,9 +333,14 @@ from the current state of the grammar repo, without cleanup."
(:synchronized nil)
(_
(error "Weird status from git-submodule '%s'" status))))
(let ((default-directory dir))
(when (member lang-symbol tree-sitter-langs--langs-with-deps)
(let ((default-directory dir)
(langs-with-deps (mapcar #'car tree-sitter-langs--langs-with-deps))
(cmds (cadr (assoc lang-symbol tree-sitter-langs--langs-with-deps))))
(when (member lang-symbol langs-with-deps)
(tree-sitter-langs--call "npm" "set" "progress=false")
(dolist (cmd cmds)
(with-demoted-errors (concat "Failed to run 'npm install " cmd "': %s")
(tree-sitter-langs--call "npm" "install" cmd)))
(with-demoted-errors "Failed to run 'npm install': %s"
(tree-sitter-langs--call "npm" "install")))
;; A repo can have multiple grammars (e.g. typescript + tsx).
Expand Down

0 comments on commit 080382b

Please sign in to comment.