Skip to content

Commit

Permalink
Add babylon-lightscript CLI tool. (#2)
Browse files Browse the repository at this point in the history
* Added `babylon-lightscript` CLI command to mirror `babylon` CLI.

* Executable permission fixes
  • Loading branch information
wcjohnson authored and rattrayalex committed Mar 22, 2017
1 parent dc0cd5b commit e7e1744
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
16 changes: 16 additions & 0 deletions bin/babylon-lightscript.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/usr/bin/env node
/* eslint no-var: 0 */

var babylon = require("..");
var fs = require("fs");

var filename = process.argv[2];
if (!filename) {
console.error("no filename specified");
process.exit(0);
}

var file = fs.readFileSync(filename, "utf8");
var ast = babylon.parse(file, { plugins: ["lightscript"] });

console.log(JSON.stringify(ast, null, " "));
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@
"unicode-9.0.0": "~0.7.0"
},
"bin": {
"babylon": "./bin/babylon.js"
"babylon": "./bin/babylon.js",
"babylon-lightscript": "./bin/babylon-lightscript.js"
},
"scripts": {
"build": "npm run clean && rollup -c",
Expand Down

0 comments on commit e7e1744

Please sign in to comment.