Skip to content

Commit 49a470c

Browse files
authored
Merge pull request #516 from jpmorganchase/perspective-cli
New package `perspective-cli`
2 parents 8c6cfd2 + e615849 commit 49a470c

File tree

15 files changed

+291
-138
lines changed

15 files changed

+291
-138
lines changed

cpp/perspective/src/cpp/emscripten.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1999,8 +1999,6 @@ using namespace perspective::binding;
19991999
*/
20002000
int
20012001
main(int argc, char** argv) {
2002-
std::cout << "Perspective initialized successfully" << std::endl;
2003-
20042002
// clang-format off
20052003
EM_ASM({
20062004

examples/cli/README.md

Lines changed: 0 additions & 7 deletions
This file was deleted.

examples/cli/index.css

Lines changed: 0 additions & 31 deletions
This file was deleted.

examples/cli/package.json

Lines changed: 0 additions & 20 deletions
This file was deleted.

examples/cli/server.js

Lines changed: 0 additions & 62 deletions
This file was deleted.

packages/perspective-cli/README.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Perspective CLI
2+
3+
```bash
4+
Usage: perspective [options] [command]
5+
6+
A convenient command-line client for Perspective.js. Can convert between Perspective supported format, or host a local web server.
7+
8+
Options:
9+
-V, --version output the version number
10+
-h, --help output usage information
11+
12+
Commands:
13+
convert [options] [filename] Convert a file into a new format. Reads from STDIN if no filename is provided
14+
Options:
15+
-f, --format <format> Which output format to use: arrow, csv, columns, json.
16+
-o, --output <filename> Filename to write to. If not supplied, writes to STDOUT
17+
-h, --help output usage information
18+
19+
host [options] [filename] Host a file on a local Websocket/HTTP server using a server-side Perspective. Reads from STDIN if no filename is provided
20+
Options:
21+
-p, --port <port> Which port to bind to (default: 8080)
22+
-o, --open Open a browser automagically
23+
-h, --help output usage information
24+
```
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
module.exports = {
2+
presets: [
3+
[
4+
"@babel/preset-env",
5+
{
6+
useBuiltIns: "usage"
7+
}
8+
]
9+
],
10+
sourceType: "unambiguous",
11+
plugins: [
12+
["@babel/plugin-proposal-decorators", {legacy: true}],
13+
"transform-custom-element-classes",
14+
[
15+
"@babel/plugin-transform-for-of",
16+
{
17+
loose: true
18+
}
19+
]
20+
]
21+
};
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
{
2+
"name": "@jpmorganchase/perspective-cli",
3+
"version": "0.2.20",
4+
"description": "Perspective.js CLI",
5+
"main": "build/index.js",
6+
"publishConfig": {
7+
"access": "public"
8+
},
9+
"files": [
10+
"build/**/*",
11+
"perspective",
12+
"babel.config.js"
13+
],
14+
"typings": "index.d.ts",
15+
"scripts": {
16+
"prebuild": "mkdirp build",
17+
"build": "babel src/js --source-maps --out-dir build && cpx \"src/html/*\" build/html",
18+
"clean": "rimraf build"
19+
},
20+
"repository": {
21+
"type": "git",
22+
"url": "https://github.com/jpmorganchase/perspective"
23+
},
24+
"author": "",
25+
"license": "Apache-2.0",
26+
"bin": {
27+
"perspective": "perspective"
28+
},
29+
"dependencies": {
30+
"@jpmorganchase/perspective": "^0.2.20",
31+
"@jpmorganchase/perspective-viewer": "^0.2.20",
32+
"@jpmorganchase/perspective-viewer-highcharts": "^0.2.20",
33+
"@jpmorganchase/perspective-viewer-hypergrid": "^0.2.20",
34+
"commander": "^2.19.0"
35+
}
36+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/usr/bin/env node
2+
/* eslint no-var: 0 */
3+
4+
require("@jpmorganchase/perspective-cli");

examples/cli/index.html renamed to packages/perspective-cli/src/html/index.html

Lines changed: 25 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,35 +11,46 @@
1111
<html>
1212

1313
<head>
14-
1514
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">
16-
1715
<script src="perspective.view.js"></script>
1816
<script src="hypergrid.plugin.js"></script>
1917
<script src="highcharts.plugin.js"></script>
20-
2118
<script src="perspective.js"></script>
22-
23-
<link rel='stylesheet' href="index.css">
2419
<link rel='stylesheet' href="material.css">
2520

21+
<style>
22+
perspective-viewer {
23+
position: absolute;
24+
top: 0;
25+
left: 0;
26+
right: 0;
27+
bottom: 0;
28+
}
29+
30+
@media (max-width: 600px) {
31+
html {
32+
overflow: hidden;
33+
}
34+
35+
body {
36+
position: fixed;
37+
height: 100%;
38+
width: 100%;
39+
margin: 0;
40+
overflow: hidden;
41+
touch-action: none;
42+
}
43+
}
44+
</style>
2645
</head>
27-
2846
<body>
29-
30-
<perspective-viewer
31-
id="view1">
32-
33-
</perspective-viewer>
34-
47+
<perspective-viewer id="view1"></perspective-viewer>
3548
<script>
3649
window.addEventListener('WebComponentsReady', function() {
3750
var elem = document.getElementById('view1');
3851
var worker = perspective.worker(window.location.origin.replace('http', 'ws'));
3952
elem.load(worker.open('data_source_one'));
4053
});
4154
</script>
42-
4355
</body>
44-
4556
</html>

0 commit comments

Comments
 (0)