Comparing version 1.1.1 to 1.2.0
@@ -0,1 +1,5 @@ | ||
## 1.2.0 (September 19, 2019) | ||
- Added `--sandbox` option to open data and query in sandbox (opens in a browser a web interface with injected data and query saved in a temporary file) | ||
## 1.1.1 (August 21, 2019) | ||
@@ -2,0 +6,0 @@ |
19
index.js
const fs = require('fs'); | ||
const path = require('path'); | ||
const cli = require('clap'); | ||
const tempfile = require('tempfile'); | ||
const open = require('open'); | ||
const createSandboxFileContent = require('jora-sandbox'); | ||
const jora = require('jora/dist/jora'); | ||
@@ -20,2 +23,3 @@ const colorize = require('./utils/colorize'); | ||
const color = options.color && colorize.supported; | ||
const sandbox = options.sandbox || false; | ||
let inputFile = options.input; | ||
@@ -42,2 +46,3 @@ let outputFile = options.output; | ||
color, | ||
sandbox, | ||
inputFile, | ||
@@ -87,3 +92,2 @@ outputFile | ||
function processStream(options) { | ||
const query = prepareQuery(options); | ||
const inputStream = options.inputFile === '<stdin>' | ||
@@ -95,2 +99,14 @@ ? process.stdin | ||
const data = prepareData(source); | ||
if (options.sandbox) { | ||
const filepath = tempfile('.html'); | ||
fs.writeFileSync(filepath, createSandboxFileContent( | ||
{ name: options.inputFile, data }, | ||
options.query | ||
)); | ||
open(filepath); | ||
return; | ||
} | ||
const query = prepareQuery(options); | ||
const result = performQuery(query, data, undefined); | ||
@@ -116,2 +132,3 @@ const serializedResult = serializeResult(convertUndefinedToNull(result), options); | ||
.option('--no-color', 'Suppress color output') | ||
.option('-s, --sandbox', 'Output data and query in sandbox') | ||
.action(function(args) { | ||
@@ -118,0 +135,0 @@ const options = processOptions(this.values, args); |
{ | ||
"name": "jora-cli", | ||
"version": "1.1.1", | ||
"version": "1.2.0", | ||
"description": "Command line interface for Jora", | ||
"keywords": [], | ||
"homepage": "https://github.com/discoveryjs/jora-cli", | ||
"keywords": [ | ||
"cli", | ||
"jora" | ||
], | ||
"maintainers": [ | ||
@@ -21,5 +23,2 @@ { | ||
"repository": "discoveryjs/jora-cli", | ||
"bugs": { | ||
"url": "https://github.com/discoveryjs/jora-cli/issues" | ||
}, | ||
"bin": { | ||
@@ -41,7 +40,10 @@ "jora": "./bin/jora" | ||
"jora": "1.0.0-alpha.10", | ||
"supports-color": "^7.0.0" | ||
"jora-sandbox": "^1.0.1", | ||
"open": "^6.4.0", | ||
"supports-color": "^7.0.0", | ||
"tempfile": "^3.0.0" | ||
}, | ||
"devDependencies": { | ||
"coveralls": "^3.0.4", | ||
"eslint": "^6.0.1", | ||
"eslint": "^6.4.0", | ||
"mocha": "^5.2.0", | ||
@@ -48,0 +50,0 @@ "nyc": "^14.1.1" |
@@ -33,2 +33,3 @@ # jora-cli | ||
-q, --query <query> Jora query | ||
-s, --sandbox Output data and query in sandbox | ||
-v, --version Output version | ||
@@ -35,0 +36,0 @@ ``` |
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
19797
419
68
0
7
2
1
+ Addedjora-sandbox@^1.0.1
+ Addedopen@^6.4.0
+ Addedtempfile@^3.0.0
+ Addedis-wsl@1.1.0(transitive)
+ Addedjora-sandbox@1.3.0(transitive)
+ Addedopen@6.4.0(transitive)
+ Addedtemp-dir@2.0.0(transitive)
+ Addedtempfile@3.0.0(transitive)
+ Addeduuid@3.4.0(transitive)