diff --git a/cli/npm/.gitignore b/cli/npm/.gitignore index f04759458..2d3aa23a9 100644 --- a/cli/npm/.gitignore +++ b/cli/npm/.gitignore @@ -1,3 +1,4 @@ tree-sitter tree-sitter.exe *.gz +*.tgz diff --git a/cli/npm/cli.js b/cli/npm/cli.js new file mode 100755 index 000000000..404739fa8 --- /dev/null +++ b/cli/npm/cli.js @@ -0,0 +1,12 @@ +#!/usr/bin/env node + +const path = require('path'); +const spawn = require("child_process").spawn; +const executable = process.platform === 'win32' + ? 'tree-sitter.exe' + : 'tree-sitter'; +spawn( + path.join(__dirname, executable), + process.argv.slice(2), + {stdio: 'inherit'} +).on('close', process.exit) diff --git a/cli/npm/package.json b/cli/npm/package.json index 0155c8da0..230676f1f 100644 --- a/cli/npm/package.json +++ b/cli/npm/package.json @@ -17,6 +17,6 @@ "install": "node install.js" }, "bin": { - "tree-sitter": "tree-sitter" + "tree-sitter": "cli.js" } }