create-graphene 0.0.20 → 0.0.22
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/dist/cli.js +42 -3
- package/package.json +2 -1
package/dist/cli.js
CHANGED
|
@@ -11,7 +11,7 @@ import { styleText } from "node:util";
|
|
|
11
11
|
// ../cli/package.json
|
|
12
12
|
var package_default = {
|
|
13
13
|
name: "@graphenedata/cli",
|
|
14
|
-
version: "0.0.
|
|
14
|
+
version: "0.0.22",
|
|
15
15
|
private: true,
|
|
16
16
|
license: "Elastic-2.0",
|
|
17
17
|
author: "Graphene Systems Inc",
|
|
@@ -58,6 +58,8 @@ var package_default = {
|
|
|
58
58
|
json5: "^2.2.3",
|
|
59
59
|
mdsvex: "^0.12.6",
|
|
60
60
|
"playwright-core": "1.58.2",
|
|
61
|
+
postcss: "8.5.10",
|
|
62
|
+
"postcss-safe-parser": "7.0.1",
|
|
61
63
|
"sanitize-html": "^2.17.4",
|
|
62
64
|
svelte: "5.55.7",
|
|
63
65
|
unified: "^11.0.5",
|
|
@@ -68,7 +70,7 @@ var package_default = {
|
|
|
68
70
|
devDependencies: {
|
|
69
71
|
"@aws-sdk/client-athena": "^3.1049.0",
|
|
70
72
|
"@clickhouse/client": "^1.18.2",
|
|
71
|
-
"@duckdb/node-api": "1.3
|
|
73
|
+
"@duckdb/node-api": "1.5.3-r.3",
|
|
72
74
|
"@google-cloud/bigquery": "^8.3.1",
|
|
73
75
|
"@types/fs-extra": "^11.0.4",
|
|
74
76
|
"@types/node": "^20.0.0",
|
|
@@ -84,7 +86,7 @@ var package_default = {
|
|
|
84
86
|
peerDependencies: {
|
|
85
87
|
"@aws-sdk/client-athena": "^3.1049.0",
|
|
86
88
|
"@clickhouse/client": "^1.18.2",
|
|
87
|
-
"@duckdb/node-api": "1.3
|
|
89
|
+
"@duckdb/node-api": "1.5.3-r.3",
|
|
88
90
|
"@google-cloud/bigquery": "^8.2.0",
|
|
89
91
|
pg: "8.13.3",
|
|
90
92
|
"snowflake-sdk": "2.4.0"
|
|
@@ -187,6 +189,8 @@ function renderTemplate({ answers, cliVersion }) {
|
|
|
187
189
|
if (answers.defaultNamespace) graphene.defaultNamespace = answers.defaultNamespace;
|
|
188
190
|
if (answers.database === "duckdb") {
|
|
189
191
|
if (answers.duckdbPath) graphene.duckdb = { path: answers.duckdbPath };
|
|
192
|
+
} else if (answers.database === "motherduck") {
|
|
193
|
+
graphene.motherduck = { database: answers.motherduckDatabase || "sample_data" };
|
|
190
194
|
} else if (answers.database === "snowflake") {
|
|
191
195
|
graphene.snowflake = { account: answers.snowflakeAccount || "", username: answers.snowflakeUsername || "" };
|
|
192
196
|
} else if (answers.database === "bigquery") {
|
|
@@ -277,6 +281,7 @@ function renderCodexConfig() {
|
|
|
277
281
|
].join("\n") + "\n";
|
|
278
282
|
}
|
|
279
283
|
function databaseLabel(database) {
|
|
284
|
+
if (database === "motherduck") return "MotherDuck";
|
|
280
285
|
if (database === "snowflake") return "Snowflake";
|
|
281
286
|
if (database === "bigquery") return "BigQuery";
|
|
282
287
|
if (database === "clickhouse") return "ClickHouse";
|
|
@@ -291,6 +296,8 @@ function renderEnvFile(answers) {
|
|
|
291
296
|
if (answers.database === "snowflake") {
|
|
292
297
|
lines.push(`SNOWFLAKE_PRI_KEY_PATH=${answers.snowflakeKeyPath || ""}`);
|
|
293
298
|
if (answers.snowflakePassphrase) lines.push(`SNOWFLAKE_PRI_PASSPHRASE=${answers.snowflakePassphrase}`);
|
|
299
|
+
} else if (answers.database === "motherduck") {
|
|
300
|
+
lines.push(`MOTHERDUCK_TOKEN=${answers.motherduckToken || ""}`);
|
|
294
301
|
} else if (answers.database === "bigquery") {
|
|
295
302
|
lines.push(`GOOGLE_APPLICATION_CREDENTIALS=${answers.bigqueryKeyPath || ""}`);
|
|
296
303
|
} else if (answers.database === "clickhouse") {
|
|
@@ -382,6 +389,25 @@ function getWarehouseClientVersion(packageName) {
|
|
|
382
389
|
return version;
|
|
383
390
|
}
|
|
384
391
|
async function promptWarehouseCredentials(answers, input, output) {
|
|
392
|
+
if (answers.database === "motherduck") {
|
|
393
|
+
answers.motherduckDatabase = unwrapPrompt(
|
|
394
|
+
await clack.text({
|
|
395
|
+
message: "MotherDuck database",
|
|
396
|
+
placeholder: "sample_data",
|
|
397
|
+
initialValue: answers.motherduckDatabase || "sample_data",
|
|
398
|
+
validate: validateRequired("MotherDuck database is required"),
|
|
399
|
+
...promptOptions(input, output)
|
|
400
|
+
})
|
|
401
|
+
);
|
|
402
|
+
answers.motherduckToken = unwrapPrompt(
|
|
403
|
+
await clack.password({
|
|
404
|
+
message: "MotherDuck token",
|
|
405
|
+
validate: validateRequired("MotherDuck token is required"),
|
|
406
|
+
...promptOptions(input, output)
|
|
407
|
+
})
|
|
408
|
+
);
|
|
409
|
+
return;
|
|
410
|
+
}
|
|
385
411
|
if (answers.database === "snowflake") {
|
|
386
412
|
answers.snowflakeAccount = unwrapPrompt(
|
|
387
413
|
await clack.text({
|
|
@@ -562,12 +588,24 @@ async function withTimeout(promise, ms, message) {
|
|
|
562
588
|
}
|
|
563
589
|
}
|
|
564
590
|
function runWarehouseCredentialTest(answers) {
|
|
591
|
+
if (answers.database === "motherduck") return testMotherDuckCredentials(answers);
|
|
565
592
|
if (answers.database === "snowflake") return testSnowflakeCredentials(answers);
|
|
566
593
|
if (answers.database === "bigquery") return testBigQueryCredentials(answers);
|
|
567
594
|
if (answers.database === "clickhouse") return testClickHouseCredentials(answers);
|
|
568
595
|
if (answers.database === "postgres") return testPostgresCredentials(answers);
|
|
569
596
|
return Promise.resolve();
|
|
570
597
|
}
|
|
598
|
+
async function testMotherDuckCredentials(answers) {
|
|
599
|
+
let { DuckDBInstance } = await import("@duckdb/node-api");
|
|
600
|
+
let db = await DuckDBInstance.create(`md:${answers.motherduckDatabase || "sample_data"}`, { motherduck_token: answers.motherduckToken || "", custom_user_agent: "graphene" });
|
|
601
|
+
let conn = await db.connect();
|
|
602
|
+
try {
|
|
603
|
+
await conn.runAndReadAll("SELECT 1");
|
|
604
|
+
} finally {
|
|
605
|
+
conn.closeSync();
|
|
606
|
+
db.closeSync();
|
|
607
|
+
}
|
|
608
|
+
}
|
|
571
609
|
async function testSnowflakeCredentials(answers) {
|
|
572
610
|
let snowflake = (await import("snowflake-sdk")).default;
|
|
573
611
|
snowflake.configure({ logLevel: "WARN", logFilePath: "/dev/null" });
|
|
@@ -664,6 +702,7 @@ async function collectAnswers({ options, packageManager, input, output }) {
|
|
|
664
702
|
message: "Database",
|
|
665
703
|
options: [
|
|
666
704
|
{ value: "snowflake", label: "Snowflake" },
|
|
705
|
+
{ value: "motherduck", label: "MotherDuck" },
|
|
667
706
|
{ value: "bigquery", label: "BigQuery" },
|
|
668
707
|
{ value: "clickhouse", label: "ClickHouse" },
|
|
669
708
|
{ value: "postgres", label: "Postgres" },
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-graphene",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.22",
|
|
4
4
|
"license": "Elastic-2.0",
|
|
5
5
|
"author": "Graphene Systems Inc",
|
|
6
6
|
"repository": {
|
|
@@ -27,6 +27,7 @@
|
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"@clack/prompts": "^1.2.0",
|
|
29
29
|
"@clickhouse/client": "^1.18.2",
|
|
30
|
+
"@duckdb/node-api": "1.5.3-r.3",
|
|
30
31
|
"@google-cloud/bigquery": "^8.3.1",
|
|
31
32
|
"pg": "8.13.3",
|
|
32
33
|
"snowflake-sdk": "2.4.0"
|