Subject: [PATCH v6 22/27] gnu: Add tree-sitter-typescript.

From: Pierre Langlois <[email-masked]>
Date: Sun, 15 May 2022 19:38:29 +0100

* gnu/packages/tree-sitter.scm (tree-sitter-typescript): New variable.
---
 gnu/packages/tree-sitter.scm | 38 ++++++++++++++++++++++++++++++++++++
 1 file changed, 38 insertions(+)

diff --git a/gnu/packages/tree-sitter.scm b/gnu/packages/tree-sitter.scm
index c37183e131..04747f47e5 100644
--- a/gnu/packages/tree-sitter.scm
+++ b/gnu/packages/tree-sitter.scm
@@ -595,3 +595,41 @@ (define-public tree-sitter-rust
     (description
      "This package provides a Rust grammar for the Tree-sitter library.")
     (license license:expat)))
+
+(define-public tree-sitter-typescript
+  (package
+    (name "tree-sitter-typescript")
+    (version "0.20.1")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://github.com/tree-sitter/tree-sitter-typescript")
+                    (commit (string-append "v" version))))
+              (file-name (git-file-name name version))
+              (sha256
+               (base32 "07fl9d968lal0aqj4f0n16p3n94cjkgfp54wynfr8gbdkjss5v5x"))
+              (modules '((guix build utils)))
+              (snippet
+               '(begin
+                  (delete-file "binding.gyp")
+                  (delete-file-recursively "bindings")
+                  (for-each
+                   (lambda (lang)
+                     (with-directory-excursion lang
+                       (delete-file "src/grammar.json")
+                       (delete-file "src/node-types.json")
+                       (delete-file "src/parser.c")
+                       (delete-file-recursively "src/tree_sitter")))
+                   '("typescript" "tsx"))
+                  #t))))
+    (build-system tree-sitter-build-system)
+    (inputs (list tree-sitter-javascript))
+    (arguments
+     (list
+      #:grammar-directories '("typescript" "tsx")))
+    (home-page "https://github.com/tree-sitter/tree-sitter-typescript")
+    (synopsis "Tree-sitter Typescript grammar")
+    (description
+     "This package provides Typescript and TSX grammars for the Tree-sitter
+library.")
+    (license license:expat)))
--
2.36.0