Add basic CLI
Original commit ae43b6017c776878b2e03ba08234ac63ebd84058
This commit is contained in:
Родитель
41e1548b12
Коммит
b81457d6f1
|
@ -22,6 +22,13 @@ $ npm start
|
|||
|
||||
The react app will live-reload when you edit any source.
|
||||
|
||||
## Install
|
||||
|
||||
```shell
|
||||
$ npm link
|
||||
$ quicktype https://blockchain.info/latestblock
|
||||
```
|
||||
|
||||
## Deploy
|
||||
|
||||
```shell
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
#!/usr/bin/env node
|
||||
|
||||
var shell = require("shelljs");
|
||||
const Main = require("../output/Main");
|
||||
|
||||
function render(json) {
|
||||
let renderer = Main.renderers[0];
|
||||
return Main.renderJson(renderer)(json).value0;
|
||||
}
|
||||
|
||||
let args = process.argv.slice(2);
|
||||
let url = args[0];
|
||||
|
||||
shell.exec(`curl -s ${url} 2> /dev/null`, { silent: true }, (code, json, stderr) => {
|
||||
let out = render(json);
|
||||
shell.echo(out);
|
||||
});
|
|
@ -2,7 +2,9 @@
|
|||
"name": "quicktype",
|
||||
"version": "0.1.0",
|
||||
"private": true,
|
||||
"dependencies": {},
|
||||
"dependencies": {
|
||||
"shelljs": "^0.7.8"
|
||||
},
|
||||
"scripts": {
|
||||
"setup": "npm install && cd app && npm install",
|
||||
"build": "pulp build",
|
||||
|
@ -15,5 +17,8 @@
|
|||
"bower": "^1.8.0",
|
||||
"pulp": "^11.0.2",
|
||||
"purescript": "^0.11.6"
|
||||
},
|
||||
"bin": {
|
||||
"quicktype": "bin/quicktype.js"
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче