@graphenedata/cli 0.0.5 → 0.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cli.ts +20 -14
- package/dist/cli/cli.js +936 -413
- package/dist/docs/graphene.md +180 -133
- package/dist/ui/component-utilities/inputUtils.ts +11 -0
- package/dist/ui/components/Area.svelte +6 -3
- package/dist/ui/components/AreaChart.svelte +2 -1
- package/dist/ui/components/Bar.svelte +14 -8
- package/dist/ui/components/BarChart.svelte +3 -2
- package/dist/ui/components/Chart.svelte +48 -101
- package/dist/ui/components/Column.svelte +2 -0
- package/dist/ui/components/Line.svelte +8 -5
- package/dist/ui/components/LineChart.svelte +3 -3
- package/dist/ui/components/QueryLoad.svelte +1 -1
- package/dist/ui/internal/queryEngine.ts +29 -8
- package/dist/ui/web.js +3 -2
- package/package.json +2 -2
package/cli.ts
CHANGED
|
@@ -7,8 +7,9 @@ import fs from 'fs-extra'
|
|
|
7
7
|
import path from 'path'
|
|
8
8
|
import {loadConfig} from '../lang/config.ts'
|
|
9
9
|
import {runServeInBackground, stopGrapheneIfRunning} from './background.ts'
|
|
10
|
-
import {getConnection} from './connections/index.ts'
|
|
11
10
|
import {check} from './check.ts'
|
|
11
|
+
import {runQuery} from './connections/index.ts'
|
|
12
|
+
import {loginPkce} from './auth.ts'
|
|
12
13
|
|
|
13
14
|
const program = new Command()
|
|
14
15
|
|
|
@@ -46,31 +47,28 @@ program
|
|
|
46
47
|
let queries = analyze(gsql)
|
|
47
48
|
if (!validQuery(queries)) return
|
|
48
49
|
let sql = toSql(queries[0])
|
|
49
|
-
let
|
|
50
|
-
let res = await connection.runQuery(sql)
|
|
50
|
+
let res = await runQuery(sql)
|
|
51
51
|
printTable(res.rows)
|
|
52
52
|
})
|
|
53
53
|
|
|
54
54
|
program
|
|
55
55
|
.command('serve')
|
|
56
56
|
.description('Run the local server')
|
|
57
|
-
.option('--
|
|
58
|
-
.action(async (options: {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
await mod.serve2()
|
|
62
|
-
} else {
|
|
57
|
+
.option('--bg', 'Run the server in the background')
|
|
58
|
+
.action(async (options: {bg?: boolean}) => {
|
|
59
|
+
await stopGrapheneIfRunning()
|
|
60
|
+
if (options.bg) {
|
|
63
61
|
await runServeInBackground()
|
|
64
62
|
process.exit(0)
|
|
63
|
+
} else {
|
|
64
|
+
let mod = await import('./serve2.ts') // load dynamically, so we're not pulling in a bunch of deps we might not need
|
|
65
|
+
await mod.serve2()
|
|
65
66
|
}
|
|
66
67
|
})
|
|
67
68
|
|
|
68
|
-
program
|
|
69
|
-
.command('stop')
|
|
69
|
+
program.command('stop')
|
|
70
70
|
.description('Stop the local server')
|
|
71
|
-
.action(async () => {
|
|
72
|
-
await stopGrapheneIfRunning(process.cwd())
|
|
73
|
-
})
|
|
71
|
+
.action(async () => { await stopGrapheneIfRunning() })
|
|
74
72
|
|
|
75
73
|
program
|
|
76
74
|
.command('check')
|
|
@@ -82,6 +80,14 @@ program
|
|
|
82
80
|
process.exit(res ? 0 : 1) // import to call `exit`, bc if we started the server in the background, just returning won't actually exit the process.
|
|
83
81
|
})
|
|
84
82
|
|
|
83
|
+
program.command('login')
|
|
84
|
+
.description('Log in to Graphene Cloud')
|
|
85
|
+
.action(async () => {
|
|
86
|
+
await loginPkce()
|
|
87
|
+
console.log('Successfully logged in')
|
|
88
|
+
process.exit(0)
|
|
89
|
+
})
|
|
90
|
+
|
|
85
91
|
program.parse(process.argv)
|
|
86
92
|
|
|
87
93
|
async function readInput (arg): Promise<string> {
|