From 53c8eaa4c2ad55daef39d877b4fbeb8daa42b162 Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Thu, 17 Jan 2019 15:15:34 -0800 Subject: [PATCH] Create a wrapper script for npm package to fix npm install issues --- cli/npm/.gitignore | 1 + cli/npm/cli.js | 12 ++++++++++++ cli/npm/package.json | 2 +- 3 files changed, 14 insertions(+), 1 deletion(-) create mode 100755 cli/npm/cli.js diff --git a/cli/npm/.gitignore b/cli/npm/.gitignore index f0475945..2d3aa23a 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 00000000..404739fa --- /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 0155c8da..230676f1 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" } }