Skip to content

Commit 49bf859

Browse files
committed
Add script to upgrade tree-sitter
1 parent a7eeb09 commit 49bf859

File tree

2 files changed

+15
-11
lines changed

2 files changed

+15
-11
lines changed

scripts/upgrade-tree-sitter.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/usr/bin/env bash
2+
3+
set -euox pipefail
4+
5+
cd server
6+
yarn add web-tree-sitter
7+
yarn add --dev tree-sitter-cli https://github.com/tree-sitter/tree-sitter-bash
8+
npx tree-sitter build-wasm node_modules/tree-sitter-bash
9+
10+
curl 'https://api.github.com/repos/tree-sitter/tree-sitter-bash/commits/master' | jq .commit.url > parser.info
11+
echo "tree-sitter-cli $(cat package.json | jq '.devDependencies["tree-sitter-cli"]')" >> parser.info
12+
13+
yarn remove tree-sitter-cli tree-sitter-bash
14+

server/src/parser.ts

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,7 @@ export async function initializeParser(): Promise<Parser> {
1717
* See https://github.com/tree-sitter/tree-sitter/tree/master/lib/binding_web#generate-wasm-language-files
1818
*
1919
* To compile and use a new tree-sitter-bash version:
20-
* cd server
21-
* yarn add web-tree-sitter
22-
* yarn add --dev tree-sitter-bash tree-sitter-cli
23-
* npx tree-sitter build-wasm node_modules/tree-sitter-bash
24-
*
25-
* Note down the versions (from the package.json) below and then run
26-
* yarn remove tree-sitter-bash tree-sitter-cli
27-
*
28-
* The current files was compiled with:
29-
* "tree-sitter-bash": "^0.19.0",
30-
* "tree-sitter-cli": "^0.20.0"
20+
* sh scripts/upgrade-tree-sitter.sh
3121
*/
3222
const lang = await Parser.Language.load(`${__dirname}/../tree-sitter-bash.wasm`)
3323

0 commit comments

Comments
 (0)