Create a wrapper script for npm package to fix npm install issues

This commit is contained in:
Max Brunsfeld 2019-01-17 15:15:34 -08:00
parent 14ecec1d4f
commit 53c8eaa4c2
3 changed files with 14 additions and 1 deletions

1
cli/npm/.gitignore vendored
View file

@ -1,3 +1,4 @@
tree-sitter
tree-sitter.exe
*.gz
*.tgz

12
cli/npm/cli.js Executable file
View file

@ -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)

View file

@ -17,6 +17,6 @@
"install": "node install.js"
},
"bin": {
"tree-sitter": "tree-sitter"
"tree-sitter": "cli.js"
}
}